return; this.currentClass.setAnnotated(true); if (!isAnnotationCompatible()) { addError("Annotations are not supported in the current runtime. " + JVM_ERROR_MESSAGE, node);
protected void visitAnnotations(AnnotatedNode node, int target) { if(node.getAnnotations().isEmpty()) { return; } this.currentClass.setAnnotated(true); if(!isAnnotationCompatible()) { addError("Annotations are not supported in the current runtime." + JVM_ERROR_MESSAGE, node); return; } Collection annotations = node.getAnnotations().values(); for(Iterator it = annotations.iterator(); it.hasNext(); ) { AnnotationNode an = (AnnotationNode) it.next(); AnnotationNode annotation = visitAnnotation(an); if(!annotation.isValid()) { return; } if(!annotation.isTargetAllowed(target)) { addError("Annotation @" + annotation.getClassNode().getName() + " is not allowed on element " + AnnotationNode.targetToName(target), annotation); } } }
protected void visitAnnotations(AnnotatedNode node, int target) { if (node.getAnnotations().isEmpty()) { return; } this.currentClass.setAnnotated(true); if (!isAnnotationCompatible()) { addError("Annotations are not supported in the current runtime. " + JVM_ERROR_MESSAGE, node); return; } Collection annotations = node.getAnnotations(); for (Iterator it = annotations.iterator(); it.hasNext();) { AnnotationNode annotation = visitAnnotation((AnnotationNode) it.next()); boolean isTargetAnnotation = annotation.getClassNode().isResolved() && annotation.getClassNode().getTypeClass() == Target.class; // Check if the annotation target is correct, unless it's the target annotating an annotation definition // defining on which target elements the annotation applies if (!isTargetAnnotation && !annotation.isTargetAllowed(target)) { addError("Annotation @" + annotation.getClassNode().getName() + " is not allowed on element " + AnnotationNode.targetToName(target), annotation); } } }
protected void visitAnnotations(AnnotatedNode node, int target) { if (node.getAnnotations().isEmpty()) { return; } this.currentClass.setAnnotated(true); if (!isAnnotationCompatible()) { addError("Annotations are not supported in the current runtime. " + JVM_ERROR_MESSAGE, node); return; } Collection annotations = node.getAnnotations(); for (Iterator it = annotations.iterator(); it.hasNext();) { AnnotationNode annotation = visitAnnotation((AnnotationNode) it.next()); boolean isTargetAnnotation = annotation.getClassNode().isResolved() && annotation.getClassNode().getTypeClass() == Target.class; // Check if the annotation target is correct, unless it's the target annotating an annotation definition // defining on which target elements the annotation applies if (!isTargetAnnotation && !annotation.isTargetAllowed(target)) { addError("Annotation @" + annotation.getClassNode().getName() + " is not allowed on element " + AnnotationNode.targetToName(target), annotation); } visitDeprecation(node, annotation); } }
protected void visitAnnotations(AnnotatedNode node, int target) { if (node.getAnnotations().isEmpty()) { return; } this.currentClass.setAnnotated(true); if (!isAnnotationCompatible()) { addError("Annotations are not supported in the current runtime. " + JVM_ERROR_MESSAGE, node); return; } for (AnnotationNode unvisited : node.getAnnotations()) { AnnotationNode visited = visitAnnotation(unvisited); boolean isTargetAnnotation = visited.getClassNode().isResolved() && visited.getClassNode().getName().equals("java.lang.annotation.Target"); // Check if the annotation target is correct, unless it's the target annotating an annotation definition // defining on which target elements the annotation applies if (!isTargetAnnotation && !visited.isTargetAllowed(target)) { addError("Annotation @" + visited.getClassNode().getName() + " is not allowed on element " + AnnotationNode.targetToName(target), visited); } visitDeprecation(node, visited); } }