public void emptyDeclarationMustHaveNoModifiers(EmptyDeclaration node) { Modifiers modifiers = node.astModifiers(); if (!modifiers.astKeywords().isEmpty() || !modifiers.astAnnotations().isEmpty()) { node.addMessage(error(MODIFIERS_MODIFIER_NOT_ALLOWED, "Empty Declarations cannot have modifiers.")); } }
public void emptyDeclarationMustHaveNoModifiers(EmptyDeclaration node) { Modifiers modifiers = node.astModifiers(); if (!modifiers.astKeywords().isEmpty() || !modifiers.astAnnotations().isEmpty()) { node.addMessage(error(MODIFIERS_MODIFIER_NOT_ALLOWED, "Empty Declarations cannot have modifiers.")); } }
public void emptyDeclarationMustHaveNoModifiers(EmptyDeclaration node) { Modifiers modifiers = node.astModifiers(); if (!modifiers.astKeywords().isEmpty() || !modifiers.astAnnotations().isEmpty()) { node.addMessage(error(MODIFIERS_MODIFIER_NOT_ALLOWED, "Empty Declarations cannot have modifiers.")); } }
@Override public boolean visitAnnotationDeclaration(lombok.ast.AnnotationDeclaration node) { TypeDeclaration decl = createTypeBody(node.astBody().astMembers(), node, false, ClassFileConstants.AccAnnotation | ClassFileConstants.AccInterface); decl.annotations = toArray(Annotation.class, node.astModifiers().astAnnotations()); decl.name = toName(node.astName()); updateTypeBits(node.getParent(), decl, false); setupJavadoc(decl, node); return set(node, decl); }
@Override public boolean visitAnnotationDeclaration(lombok.ast.AnnotationDeclaration node) { TypeDeclaration decl = createTypeBody(node.astBody().astMembers(), node, false, ClassFileConstants.AccAnnotation | ClassFileConstants.AccInterface); decl.annotations = toArray(Annotation.class, node.astModifiers().astAnnotations()); decl.name = toName(node.astName()); updateTypeBits(node.getParent(), decl, false); setupJavadoc(decl, node); return set(node, decl); }
@Override public boolean visitAnnotationDeclaration(lombok.ast.AnnotationDeclaration node) { TypeDeclaration decl = createTypeBody(node.astBody().astMembers(), node, false, ClassFileConstants.AccAnnotation | ClassFileConstants.AccInterface); decl.annotations = toArray(Annotation.class, node.astModifiers().astAnnotations()); decl.name = toName(node.astName()); updateTypeBits(node.getParent(), decl, false); setupJavadoc(decl, node); return set(node, decl); }
@Override public boolean visitInterfaceDeclaration(lombok.ast.InterfaceDeclaration node) { TypeDeclaration decl = createTypeBody(node.astBody().astMembers(), node, false, ClassFileConstants.AccInterface); decl.annotations = toArray(Annotation.class, node.astModifiers().astAnnotations()); decl.superInterfaces = toArray(TypeReference.class, node.astExtending()); markTypeReferenceIsSuperType(decl); decl.typeParameters = toArray(TypeParameter.class, node.astTypeVariables()); decl.name = toName(node.astName()); updateTypeBits(node.getParent(), decl, false); setupJavadoc(decl, node); return set(node, decl); }
@Override public boolean visitInterfaceDeclaration(lombok.ast.InterfaceDeclaration node) { TypeDeclaration decl = createTypeBody(node.astBody().astMembers(), node, false, ClassFileConstants.AccInterface); decl.annotations = toArray(Annotation.class, node.astModifiers().astAnnotations()); decl.superInterfaces = toArray(TypeReference.class, node.astExtending()); markTypeReferenceIsSuperType(decl); decl.typeParameters = toArray(TypeParameter.class, node.astTypeVariables()); decl.name = toName(node.astName()); updateTypeBits(node.getParent(), decl, false); setupJavadoc(decl, node); return set(node, decl); }
@Override public boolean visitInterfaceDeclaration(lombok.ast.InterfaceDeclaration node) { TypeDeclaration decl = createTypeBody(node.astBody().astMembers(), node, false, ClassFileConstants.AccInterface); decl.annotations = toArray(Annotation.class, node.astModifiers().astAnnotations()); decl.superInterfaces = toArray(TypeReference.class, node.astExtending()); markTypeReferenceIsSuperType(decl); decl.typeParameters = toArray(TypeParameter.class, node.astTypeVariables()); decl.name = toName(node.astName()); updateTypeBits(node.getParent(), decl, false); setupJavadoc(decl, node); return set(node, decl); }
@Override public boolean visitClassDeclaration(lombok.ast.ClassDeclaration node) { TypeDeclaration decl = createTypeBody(node.astBody().astMembers(), node, true, 0); decl.annotations = toArray(Annotation.class, node.astModifiers().astAnnotations()); decl.superclass = (TypeReference) toTree(node.astExtending()); decl.superInterfaces = toArray(TypeReference.class, node.astImplementing()); markTypeReferenceIsSuperType(decl); decl.typeParameters = toArray(TypeParameter.class, node.astTypeVariables()); decl.name = toName(node.astName()); updateTypeBits(node.getParent(), decl, false); setupJavadoc(decl, node); //TODO test inner types. Give em everything - (abstract) methods, initializers, static initializers, MULTIPLE initializers. return set(node, decl); }
@Override public boolean visitClassDeclaration(lombok.ast.ClassDeclaration node) { TypeDeclaration decl = createTypeBody(node.astBody().astMembers(), node, true, 0); decl.annotations = toArray(Annotation.class, node.astModifiers().astAnnotations()); decl.superclass = (TypeReference) toTree(node.astExtending()); decl.superInterfaces = toArray(TypeReference.class, node.astImplementing()); markTypeReferenceIsSuperType(decl); decl.typeParameters = toArray(TypeParameter.class, node.astTypeVariables()); decl.name = toName(node.astName()); updateTypeBits(node.getParent(), decl, false); setupJavadoc(decl, node); //TODO test inner types. Give em everything - (abstract) methods, initializers, static initializers, MULTIPLE initializers. return set(node, decl); }
@Override public boolean visitClassDeclaration(lombok.ast.ClassDeclaration node) { TypeDeclaration decl = createTypeBody(node.astBody().astMembers(), node, true, 0); decl.annotations = toArray(Annotation.class, node.astModifiers().astAnnotations()); decl.superclass = (TypeReference) toTree(node.astExtending()); decl.superInterfaces = toArray(TypeReference.class, node.astImplementing()); markTypeReferenceIsSuperType(decl); decl.typeParameters = toArray(TypeParameter.class, node.astTypeVariables()); decl.name = toName(node.astName()); updateTypeBits(node.getParent(), decl, false); setupJavadoc(decl, node); //TODO test inner types. Give em everything - (abstract) methods, initializers, static initializers, MULTIPLE initializers. return set(node, decl); }
if (node instanceof VariableDeclaration) { addToMap(((VariableDeclaration)node).astDefinition().astModifiers(), node); addToMap(((VariableDeclaration)node).astDefinition().astModifiers().astAnnotations(), node); addToMap(((VariableDeclaration)node).astDefinition().astTypeReference(), node); addToMap(((VariableDeclaration)node).astDefinition().astVariables().first().astName(), node); } else if (node instanceof TypeDeclaration) { addToMap(((TypeDeclaration)node).astModifiers(), node); addToMap(((TypeDeclaration)node).astModifiers().astAnnotations(), node); } else if (node instanceof MethodDeclaration) { addToMap(((MethodDeclaration)node).astModifiers(), node); addToMap(((MethodDeclaration)node).astModifiers().astAnnotations(), node); addToMap(((MethodDeclaration)node).astTypeVariables().first(), node); addToMap(((MethodDeclaration)node).astReturnTypeReference(), node); } else if (node instanceof ConstructorDeclaration) { addToMap(((ConstructorDeclaration)node).astModifiers(), node); addToMap(((ConstructorDeclaration)node).astModifiers().astAnnotations(), node); addToMap(((ConstructorDeclaration)node).astTypeVariables().first(), node); addToMap(((ConstructorDeclaration)node).astTypeName(), node); } else if (node instanceof AnnotationMethodDeclaration) { addToMap(((AnnotationMethodDeclaration)node).astModifiers(), node); addToMap(((AnnotationMethodDeclaration)node).astModifiers().astAnnotations(), node); addToMap(((AnnotationMethodDeclaration)node).astReturnTypeReference(), node); addToMap(((AnnotationMethodDeclaration)node).astMethodName(), node);
@Override public boolean visitEnumDeclaration(lombok.ast.EnumDeclaration node) { FieldDeclaration[] fields = null; if (node.astBody() != null) { fields = toArray(FieldDeclaration.class, node.astBody().astConstants()); } TypeDeclaration decl = createTypeBody(node.astBody().astMembers(), node, true, ClassFileConstants.AccEnum, fields); decl.annotations = toArray(Annotation.class, node.astModifiers().astAnnotations()); decl.superInterfaces = toArray(TypeReference.class, node.astImplementing()); markTypeReferenceIsSuperType(decl); decl.name = toName(node.astName()); updateTypeBits(node.getParent(), decl, true); setupJavadoc(decl, node); return set(node, decl); }
@Override public boolean visitEnumDeclaration(lombok.ast.EnumDeclaration node) { FieldDeclaration[] fields = null; if (node.astBody() != null) { fields = toArray(FieldDeclaration.class, node.astBody().astConstants()); } TypeDeclaration decl = createTypeBody(node.astBody().astMembers(), node, true, ClassFileConstants.AccEnum, fields); decl.annotations = toArray(Annotation.class, node.astModifiers().astAnnotations()); decl.superInterfaces = toArray(TypeReference.class, node.astImplementing()); markTypeReferenceIsSuperType(decl); decl.name = toName(node.astName()); updateTypeBits(node.getParent(), decl, true); setupJavadoc(decl, node); return set(node, decl); }
@Override public boolean visitEnumDeclaration(lombok.ast.EnumDeclaration node) { FieldDeclaration[] fields = null; if (node.astBody() != null) { fields = toArray(FieldDeclaration.class, node.astBody().astConstants()); } TypeDeclaration decl = createTypeBody(node.astBody().astMembers(), node, true, ClassFileConstants.AccEnum, fields); decl.annotations = toArray(Annotation.class, node.astModifiers().astAnnotations()); decl.superInterfaces = toArray(TypeReference.class, node.astImplementing()); markTypeReferenceIsSuperType(decl); decl.name = toName(node.astName()); updateTypeBits(node.getParent(), decl, true); setupJavadoc(decl, node); return set(node, decl); }
decl.modifiers |= ClassFileConstants.AccAnnotationDefault; decl.annotations = toArray(Annotation.class, node.astModifiers().astAnnotations()); decl.defaultValue = toExpression(node.astDefaultValue()); decl.selector = toName(node.astMethodName());
@Override public boolean visitModifiers(Modifiers node) { JCModifiers mods = treeMaker.Modifiers(node.getExplicitModifierFlags(), toList(JCAnnotation.class, node.astAnnotations())); Comment javadoc = null; if (node.getParent() instanceof JavadocContainer) { javadoc = ((JavadocContainer)node.getParent()).astJavadoc(); } else if (node.getParent() instanceof VariableDefinition && node.getParent().getParent() instanceof VariableDeclaration) { javadoc = ((VariableDeclaration)node.getParent().getParent()).astJavadoc(); } if (javadoc != null && javadoc.isMarkedDeprecated()) mods.flags |= Flags.DEPRECATED; if (node.isEmpty() && !hasConversionStructureInfo(node, "converted")) { //Workaround for a javac bug; start (but not end!) gets set of an empty modifiers object, //but only if these represent the modifiers of a constructor or method that has type variables. if ( (node.getParent() instanceof MethodDeclaration && ((MethodDeclaration)node.getParent()).astTypeVariables().size() > 0) || (node.getParent() instanceof ConstructorDeclaration && ((ConstructorDeclaration)node.getParent()).astTypeVariables().size() > 0)) { mods.pos = node.getParent().getPosition().getStart(); } return set(node, mods); } else { return posSet(node, mods); } }
@Override public boolean visitModifiers(Modifiers node) { JCModifiers mods = treeMaker.Modifiers(node.getExplicitModifierFlags(), toList(JCAnnotation.class, node.astAnnotations())); Comment javadoc = null; if (node.getParent() instanceof JavadocContainer) { javadoc = ((JavadocContainer)node.getParent()).astJavadoc(); } else if (node.getParent() instanceof VariableDefinition && node.getParent().getParent() instanceof VariableDeclaration) { javadoc = ((VariableDeclaration)node.getParent().getParent()).astJavadoc(); } if (javadoc != null && javadoc.isMarkedDeprecated()) mods.flags |= Flags.DEPRECATED; if (node.isEmpty() && !hasConversionStructureInfo(node, "converted")) { //Workaround for a javac bug; start (but not end!) gets set of an empty modifiers object, //but only if these represent the modifiers of a constructor or method that has type variables. if ( (node.getParent() instanceof MethodDeclaration && ((MethodDeclaration)node.getParent()).astTypeVariables().size() > 0) || (node.getParent() instanceof ConstructorDeclaration && ((ConstructorDeclaration)node.getParent()).astTypeVariables().size() > 0)) { mods.pos = node.getParent().getPosition().getStart(); } return set(node, mods); } else { return posSet(node, mods); } }
@Override public boolean visitModifiers(Modifiers node) { JCModifiers mods = treeMaker.Modifiers(node.getExplicitModifierFlags(), toList(JCAnnotation.class, node.astAnnotations())); Comment javadoc = null; if (node.getParent() instanceof JavadocContainer) { javadoc = ((JavadocContainer)node.getParent()).astJavadoc(); } else if (node.getParent() instanceof VariableDefinition && node.getParent().getParent() instanceof VariableDeclaration) { javadoc = ((VariableDeclaration)node.getParent().getParent()).astJavadoc(); } if (javadoc != null && javadoc.isMarkedDeprecated()) mods.flags |= Flags.DEPRECATED; if (node.isEmpty() && !hasConversionStructureInfo(node, "converted")) { //Workaround for a javac bug; start (but not end!) gets set of an empty modifiers object, //but only if these represent the modifiers of a constructor or method that has type variables. if ( (node.getParent() instanceof MethodDeclaration && ((MethodDeclaration)node.getParent()).astTypeVariables().size() > 0) || (node.getParent() instanceof ConstructorDeclaration && ((ConstructorDeclaration)node.getParent()).astTypeVariables().size() > 0)) { mods.pos = node.getParent().getPosition().getStart(); } return set(node, mods); } else { return posSet(node, mods); } }