public void visitClass(ClassNode node, SourceUnit source) { this.source = source; this.inAnnotationDef = node.isAnnotationDefinition(); super.visitClass(node); this.inAnnotationDef = false; }
if (value instanceof ClassExpression) { ClassExpression ce = (ClassExpression) value; if (ce.getType() != null && ce.getType().isAnnotationDefinition()) { repeatable = ce.getType(); break;
boolean isAnnotationDefinition = classNode.isAnnotationDefinition(); printAnnotations(out, classNode); printModifiers(out, classNode.getModifiers()
public void visitClass(ClassNode node) { AnnotationConstantsVisitor acv = new AnnotationConstantsVisitor(); acv.visitClass(node, this.source); this.currentClass = node; if (node.isAnnotationDefinition()) { visitAnnotations(node, AnnotationNode.ANNOTATION_TARGET); } else { visitAnnotations(node, AnnotationNode.TYPE_TARGET); } PackageNode packageNode = node.getPackage(); if (packageNode != null) { visitAnnotations(packageNode, AnnotationNode.PACKAGE_TARGET); } node.visitContents(this); }
if (controller.getClassNode().isAnnotationDefinition() && !node.isStaticConstructor()) { visitAnnotationDefault(node, mv); } else if (!node.isAbstract()) {
out.println(";"); } else if (isAbstract(methodNode) && !clazz.isEnum()) { if (clazz.isAnnotationDefinition() && methodNode.hasAnnotationDefault()) { Statement fs = methodNode.getFirstStatement(); if (fs instanceof ExpressionStatement) {
if (classNode != null && !classNode.isAnnotationDefinition()) { if (classNode.getNameWithoutPackage().equals(name)) { if (isAnInterface()) { ClassNode[] exceptions = ClassNode.EMPTY_ARRAY; if (classNode == null || !classNode.isAnnotationDefinition()) { } else if (node != null && classNode.isAnnotationDefinition()) { code = statement(node); hasAnnotationDefault = true;
private void visitConstructorOrMethod(MethodNode node, int methodTarget) { visitAnnotations(node, methodTarget); for (int i = 0; i < node.getParameters().length; i++) { Parameter parameter = node.getParameters()[i]; visitAnnotations(parameter, AnnotationNode.PARAMETER_TARGET); } if (this.currentClass.isAnnotationDefinition() && !node.isStaticConstructor()) { ErrorCollector errorCollector = new ErrorCollector(this.source.getConfiguration()); AnnotationVisitor visitor = new AnnotationVisitor(this.source, errorCollector); visitor.setReportClass(currentClass); visitor.checkReturnType(node.getReturnType(), node); if (node.getParameters().length > 0) { addError("Annotation members may not have parameters.", node.getParameters()[0]); } if (node.getExceptions().length > 0) { addError("Annotation members may not have a throws clause.", node.getExceptions()[0]); } ReturnStatement code = (ReturnStatement) node.getCode(); if (code != null) { visitor.visitExpression(node.getName(), code.getExpression(), node.getReturnType()); visitor.checkCircularReference(currentClass, node.getReturnType(), code.getExpression()); } this.source.getErrorCollector().addCollectorContents(errorCollector); } Statement code = node.getCode(); if (code != null) { code.visit(this); } }
public void visitClass(ClassNode node) { this.currentClass = node; if (node.isAnnotationDefinition()) { visitAnnotations(node, AnnotationNode.ANNOTATION_TARGET); } else { visitAnnotations(node, AnnotationNode.TYPE_TARGET); } node.visitContents(this); }
public void visitClass(ClassNode node) { this.currentClass = node; if (node.isAnnotationDefinition()) { visitAnnotations(node, AnnotationNode.ANNOTATION_TARGET); } else { visitAnnotations(node, AnnotationNode.TYPE_TARGET); } node.visitContents(this); }
protected int getBytecodeVersion() { if ( !classNode.isUsingGenerics() && !classNode.isAnnotated() && !classNode.isAnnotationDefinition() ) { return Opcodes.V1_3; } final String target = getCompileUnit().getConfig().getTargetBytecode(); return CompilerConfiguration.POST_JDK5.equals(target) ? Opcodes.V1_5 : Opcodes.V1_3; }
protected int getBytecodeVersion() { if ( !classNode.isUsingGenerics() && !classNode.isAnnotated() && !classNode.isAnnotationDefinition() ) { return Opcodes.V1_3; } final String target = getCompileUnit().getConfig().getTargetBytecode(); return CompilerConfiguration.POST_JDK5.equals(target) ? Opcodes.V1_5 : Opcodes.V1_3; }
public void visitClass(ClassNode node) { this.currentClass = node; if (node.isAnnotationDefinition()) { visitAnnotations(node, AnnotationNode.ANNOTATION_TARGET); } else { visitAnnotations(node, AnnotationNode.TYPE_TARGET); } PackageNode packageNode = node.getPackage(); if (packageNode != null) { visitAnnotations(packageNode, AnnotationNode.PACKAGE_TARGET); } node.visitContents(this); }
protected void visitConstructorOrMethod(MethodNode node, boolean isConstructor) { lineNumber = -1; columnNumber = -1; Parameter[] parameters = node.getParameters(); String methodType = BytecodeHelper.getMethodDescriptor(node.getReturnType(), parameters); String signature = BytecodeHelper.getGenericsMethodSignature(node); int modifiers = node.getModifiers(); if (isVargs(node.getParameters())) modifiers |= Opcodes.ACC_VARARGS; mv = cv.visitMethod(modifiers, node.getName(), methodType, signature, buildExceptions(node.getExceptions())); mv = new MyMethodAdapter(); visitAnnotations(node, mv); for (int i = 0; i < parameters.length; i++) { visitParameterAnnotations(parameters[i], i, mv); } helper = new BytecodeHelper(mv); if (classNode.isAnnotationDefinition()) { visitAnnotationDefault(node, mv); } else if (!node.isAbstract()) { Statement code = node.getCode(); // fast path for getter/setters etc. if (code instanceof BytecodeSequence && ((BytecodeSequence)code).getInstructions().size() == 1 && ((BytecodeSequence)code).getInstructions().get(0) instanceof BytecodeInstruction) { ((BytecodeInstruction)((BytecodeSequence)code).getInstructions().get(0)).visit(mv); } else{ visitStdMethod(node, isConstructor, parameters, code); } mv.visitMaxs(0, 0); } mv.visitEnd(); }
protected void visitConstructorOrMethod(MethodNode node, boolean isConstructor) { Parameter[] parameters = node.getParameters(); String methodType = BytecodeHelper.getMethodDescriptor(node.getReturnType(), parameters); String signature = BytecodeHelper.getGenericsMethodSignature(node); int modifiers = node.getModifiers(); if (isVargs(node.getParameters())) modifiers |= Opcodes.ACC_VARARGS; mv = cv.visitMethod(modifiers, node.getName(), methodType, signature, buildExceptions(node.getExceptions())); mv = new MyMethodAdapter(); visitAnnotations(node, mv); for (int i = 0; i < parameters.length; i++) { visitParameterAnnotations(parameters[i], i, mv); } helper = new BytecodeHelper(mv); if (classNode.isAnnotationDefinition()) { visitAnnotationDefault(node, mv); } else if (!node.isAbstract()) { Statement code = node.getCode(); // fast path for getter/setters etc. if (code instanceof BytecodeSequence && ((BytecodeSequence)code).getInstructions().size() == 1 && ((BytecodeSequence)code).getInstructions().get(0) instanceof BytecodeInstruction) { ((BytecodeInstruction)((BytecodeSequence)code).getInstructions().get(0)).visit(mv); } else{ visitStdMethod(node, isConstructor, parameters, code); } mv.visitMaxs(0, 0); } mv.visitEnd(); }
if (classNode != null && !classNode.isAnnotationDefinition()) { if (classNode.getNameWithoutPackage().equals(name)) { if (isAnInterface()) { ClassNode[] exceptions = ClassNode.EMPTY_ARRAY; if (classNode == null || !classNode.isAnnotationDefinition()) { } else if (node != null && classNode.isAnnotationDefinition()) { code = statement(node); hasAnnotationDefault = true;
protected void visitConstructorOrMethod(MethodNode node, boolean isConstructor) { controller.resetLineNumber(); Parameter[] parameters = node.getParameters(); String methodType = BytecodeHelper.getMethodDescriptor(node.getReturnType(), parameters); String signature = BytecodeHelper.getGenericsMethodSignature(node); int modifiers = node.getModifiers(); if (isVargs(node.getParameters())) modifiers |= Opcodes.ACC_VARARGS; MethodVisitor mv = cv.visitMethod(modifiers, node.getName(), methodType, signature, buildExceptions(node.getExceptions())); controller.setMethodVisitor(mv); visitAnnotations(node, mv); for (int i = 0; i < parameters.length; i++) { visitParameterAnnotations(parameters[i], i, mv); } if (controller.getClassNode().isAnnotationDefinition() && !node.isStaticConstructor()) { visitAnnotationDefault(node, mv); } else if (!node.isAbstract()) { Statement code = node.getCode(); mv.visitCode(); // fast path for getter/setters etc. if (code instanceof BytecodeSequence && ((BytecodeSequence)code).getInstructions().size() == 1 && ((BytecodeSequence)code).getInstructions().get(0) instanceof BytecodeInstruction) { ((BytecodeInstruction)((BytecodeSequence)code).getInstructions().get(0)).visit(mv); } else { visitStdMethod(node, isConstructor, parameters, code); } // we use this NOP to have a valid jump target for the various labels //mv.visitInsn(NOP); mv.visitMaxs(0, 0); } mv.visitEnd(); }
private void visitConstructorOrMethod(MethodNode node, int methodTarget) { visitAnnotations(node, methodTarget); for (int i = 0; i < node.getParameters().length; i++) { Parameter parameter = node.getParameters()[i]; visitAnnotations(parameter, AnnotationNode.PARAMETER_TARGET); } if (this.currentClass.isAnnotationDefinition()) { ErrorCollector errorCollector = new ErrorCollector(this.source.getConfiguration()); AnnotationVisitor visitor = new AnnotationVisitor(this.source, errorCollector); visitor.setReportClass(currentClass); visitor.checkReturnType(node.getReturnType(),node); if (node.getParameters().length>0) { addError ("Annotation members may not have parameters.",node.getParameters()[0]); } if (node.getExceptions().length>0) { addError ("Annotation members may not have a throws clause.",node.getExceptions()[0]); } ReturnStatement code = (ReturnStatement) node.getCode(); if (code!=null) { visitor.visitExpression(node.getName(),code.getExpression(),node.getReturnType()); visitor.checkcircularReference(currentClass,node.getReturnType(),code.getExpression()); } this.source.getErrorCollector().addCollectorContents(errorCollector); } }
public void visitMethod(MethodNode node) { visitAnnotations(node, AnnotationNode.METHOD_TARGET); for (int i = 0; i < node.getParameters().length; i++) { Parameter parameter = node.getParameters()[i]; visitAnnotations(parameter, AnnotationNode.PARAMETER_TARGET); } if (this.currentClass.isAnnotationDefinition()) { ErrorCollector errorCollector = new ErrorCollector(this.source.getConfiguration()); AnnotationVisitor visitor = new AnnotationVisitor(this.source, errorCollector); visitor.setReportClass(currentClass); visitor.checkReturnType(node.getReturnType(),node); if (node.getParameters().length>0) { addError ("Annotation members may not have parameters.",node.getParameters()[0]); } if (node.getExceptions().length>0) { addError ("Annotation members may not have a throws clause.",node.getExceptions()[0]); } ReturnStatement code = (ReturnStatement) node.getCode(); if (code!=null) { visitor.visitExpression(node.getName(),code.getExpression(),node.getReturnType()); visitor.checkcircularReference(currentClass,node.getReturnType(),code.getExpression()); } this.source.getErrorCollector().addCollectorContents(errorCollector); } }
private void visitConstructorOrMethod(MethodNode node, int methodTarget) { visitAnnotations(node, methodTarget); for (int i = 0; i < node.getParameters().length; i++) { Parameter parameter = node.getParameters()[i]; visitAnnotations(parameter, AnnotationNode.PARAMETER_TARGET); } if (this.currentClass.isAnnotationDefinition() && !node.isStaticConstructor()) { ErrorCollector errorCollector = new ErrorCollector(this.source.getConfiguration()); AnnotationVisitor visitor = new AnnotationVisitor(this.source, errorCollector); visitor.setReportClass(currentClass); visitor.checkReturnType(node.getReturnType(), node); if (node.getParameters().length > 0) { addError("Annotation members may not have parameters.", node.getParameters()[0]); } if (node.getExceptions().length > 0) { addError("Annotation members may not have a throws clause.", node.getExceptions()[0]); } ReturnStatement code = (ReturnStatement) node.getCode(); if (code != null) { visitor.visitExpression(node.getName(), code.getExpression(), node.getReturnType()); visitor.checkCircularReference(currentClass, node.getReturnType(), code.getExpression()); } this.source.getErrorCollector().addCollectorContents(errorCollector); } }