case AST.JLS3_INTERNAL : case AST.JLS4_INTERNAL: type.setFlags(type.getFlags() | ASTNode.MALFORMED); break; default: if (annotations == null) break; int start = type.getStartPosition(); int length = type.getLength(); int annotationsLength = annotations.length; for (int i = 0; i < annotationsLength; i++) { if (typeAnnotation != null) { Annotation annotation = convert(typeAnnotation); type.annotations().add(annotation); annotationsEnd = annotation.getStartPosition() + annotation.getLength(); start = annotationsStart; type.setSourceRange(start, length);
private void visitTypeAnnotations(AnnotatableType node) { if (node.getAST().apiLevel() >= JLS8) { visitAnnotationsList(node.annotations()); } }
/** * Creates a new unparented node for an annotatable type owned by the given AST. * <p> * N.B. This constructor is package-private. * </p> * * @param ast the AST that is to own this node */ AnnotatableType(AST ast) { super(ast); if (ast.apiLevel >= AST.JLS8_INTERNAL) { this.annotations = new ASTNode.NodeList(getAnnotationsProperty()); } }
private Type annotateType(ITypeBinding binding, AST ast, ImportRewriteContext context, Type type, TypeLocation location) { IAnnotationBinding [] annotationBindings = binding.getTypeAnnotations(); if (annotationBindings != null && annotationBindings.length > 0 && type instanceof AnnotatableType) { annotateList(((AnnotatableType) type).annotations(), annotationBindings, ast, context, location, binding); } return type; }
@Override final List internalGetChildListProperty(ChildListPropertyDescriptor property) { if (property == ANNOTATIONS_PROPERTY) { return annotations(); } // allow default implementation to flag the error return super.internalGetChildListProperty(property); }
final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor property, boolean get, ASTNode child) { if (property == NAME_PROPERTY) { if (get) { return getName(); } else { setName((Name) child); return null; } } // allow default implementation to flag the error return super.internalGetSetChildProperty(property, get, child); }
private static String typeName(Type type) { if (type instanceof SimpleType) { return ((SimpleType) type).getName().toString().trim(); } if (type instanceof ArrayType) { return typeName(((ArrayType) type).getElementType()); } if (type instanceof ParameterizedType) { return typeName(((ParameterizedType) type).getType()); } if (type instanceof AnnotatableType) { AnnotatableType noAnnoType = (AnnotatableType) ASTNode.copySubtree(type.getAST(), type); noAnnoType.annotations().clear(); return noAnnoType.toString().trim(); } return type.toString().trim(); }
/** * Returns the structural property descriptor for the "annotations" property * of this node (element type: {@link Annotation}) (added in JLS8 API). * * @return the property descriptor */ public final ChildListPropertyDescriptor getAnnotationsProperty() { return internalAnnotationsProperty(); }
final boolean internalGetSetBooleanProperty(SimplePropertyDescriptor property, boolean get, boolean value) { if (property == UPPER_BOUND_PROPERTY) { if (get) { return isUpperBound(); } else { setUpperBound(value); return false; } } // allow default implementation to flag the error return super.internalGetSetBooleanProperty(property, get, value); }
private Type annotateType(ITypeBinding binding, AST ast, ImportRewriteContext context, Type type, TypeLocation location) { IAnnotationBinding [] annotationBindings = binding.getTypeAnnotations(); if (annotationBindings != null && annotationBindings.length > 0 && type instanceof AnnotatableType) { annotateList(((AnnotatableType) type).annotations(), annotationBindings, ast, context, location, binding); } return type; }
@Override final List internalGetChildListProperty(ChildListPropertyDescriptor property) { if (property == ANNOTATIONS_PROPERTY) { return annotations(); } // allow default implementation to flag the error return super.internalGetChildListProperty(property); }
final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor property, boolean get, ASTNode child) { if (property == BOUND_PROPERTY) { if (get) { return getBound(); } else { setBound((Type) child); return null; } } // allow default implementation to flag the error return super.internalGetSetChildProperty(property, get, child); }
/** * Returns the structural property descriptor for the "annotations" property * of this node (element type: {@link Annotation}) (added in JLS8 API). * * @return the property descriptor */ public final ChildListPropertyDescriptor getAnnotationsProperty() { return internalAnnotationsProperty(); }
final boolean internalGetSetBooleanProperty(SimplePropertyDescriptor property, boolean get, boolean value) { if (property == UPPER_BOUND_PROPERTY) { if (get) { return isUpperBound(); } else { setUpperBound(value); return false; } } // allow default implementation to flag the error return super.internalGetSetBooleanProperty(property, get, value); }
case AST.JLS3_INTERNAL : case AST.JLS4_INTERNAL: type.setFlags(type.getFlags() | ASTNode.MALFORMED); break; default: if (annotations == null) break; int start = type.getStartPosition(); int length = type.getLength(); int annotationsLength = annotations.length; for (int i = 0; i < annotationsLength; i++) { if (typeAnnotation != null) { Annotation annotation = convert(typeAnnotation); type.annotations().add(annotation); annotationsEnd = annotation.getStartPosition() + annotation.getLength(); start = annotationsStart; type.setSourceRange(start, length);
private void visitAnnotations(AnnotatableType node) { if (node.getAST().apiLevel() >= AST.JLS8) { doVisitChildren(node.annotations()); } }
private Type annotateType(ITypeBinding binding, AST ast, ImportRewriteContext context, Type type) { IAnnotationBinding [] annotationBindings = binding.getTypeAnnotations(); if (annotationBindings != null && annotationBindings.length > 0 && type instanceof AnnotatableType) { annotateList(((AnnotatableType) type).annotations(), annotationBindings, ast, context); } return type; }
@Override final List internalGetChildListProperty(ChildListPropertyDescriptor property) { if (property == ANNOTATIONS_PROPERTY) { return annotations(); } // allow default implementation to flag the error return super.internalGetChildListProperty(property); }
final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor property, boolean get, ASTNode child) { if (property == NAME_PROPERTY) { if (get) { return getName(); } else { setName((Name) child); return null; } } // allow default implementation to flag the error return super.internalGetSetChildProperty(property, get, child); }
/** * Creates a new unparented node for an annotatable type owned by the given AST. * <p> * N.B. This constructor is package-private. * </p> * * @param ast the AST that is to own this node */ AnnotatableType(AST ast) { super(ast); if (ast.apiLevel >= AST.JLS8_INTERNAL) { this.annotations = new ASTNode.NodeList(getAnnotationsProperty()); } }