/** * Searches the given field node for annotations and returns each one that matches the provided regular expression pattern. * * Only the simple name is checked - the package and any containing class are ignored. */ public static Annotation[] findAnnotations(FieldDeclaration field, Pattern namePattern) { List<Annotation> result = new ArrayList<Annotation>(); if (field.annotations == null) return EMPTY_ANNOTATIONS_ARRAY; for (Annotation annotation : field.annotations) { TypeReference typeRef = annotation.type; if (typeRef != null && typeRef.getTypeName() != null) { char[][] typeName = typeRef.getTypeName(); String suspect = new String(typeName[typeName.length - 1]); if (namePattern.matcher(suspect).matches()) { result.add(annotation); } } } return result.toArray(EMPTY_ANNOTATIONS_ARRAY); }
static List<Extension> getApplicableExtensionMethods(EclipseNode typeNode, Annotation ann, TypeBinding receiverType) { List<Extension> extensions = new ArrayList<Extension>(); if ((typeNode != null) && (ann != null) && (receiverType != null)) { BlockScope blockScope = ((TypeDeclaration) typeNode.get()).initializerScope; EclipseNode annotationNode = typeNode.getNodeFor(ann); AnnotationValues<ExtensionMethod> annotation = createAnnotation(ExtensionMethod.class, annotationNode); boolean suppressBaseMethods = false; try { suppressBaseMethods = annotation.getInstance().suppressBaseMethods(); } catch (AnnotationValueDecodeFail fail) { fail.owner.setError(fail.getMessage(), fail.idx); } for (Object extensionMethodProvider : annotation.getActualExpressions("value")) { if (extensionMethodProvider instanceof ClassLiteralAccess) { TypeBinding binding = ((ClassLiteralAccess) extensionMethodProvider).type.resolveType(blockScope); if (binding == null) continue; if (!binding.isClass() && !binding.isEnum()) continue; Extension e = new Extension(); e.extensionMethods = getApplicableExtensionMethodsDefinedInProvider(typeNode, (ReferenceBinding) binding, receiverType); e.suppressBaseMethods = suppressBaseMethods; extensions.add(e); } } } return extensions; }
/** {@inheritDoc} */ @Override protected EclipseNode buildTree(ASTNode node, Kind kind) { switch (kind) { case COMPILATION_UNIT: return buildCompilationUnit((CompilationUnitDeclaration) node); case TYPE: return buildType((TypeDeclaration) node); case FIELD: return buildField((FieldDeclaration) node); case INITIALIZER: return buildInitializer((Initializer) node); case METHOD: return buildMethod((AbstractMethodDeclaration) node); case ARGUMENT: return buildLocal((Argument) node, kind); case LOCAL: return buildLocal((LocalDeclaration) node, kind); case STATEMENT: return buildStatement((Statement) node); case ANNOTATION: return buildAnnotation((Annotation) node, false); default: throw new AssertionError("Did not expect to arrive here: " + kind); } }
@Override public Expression createFactoryParameter(ClassLiteralAccess type, Annotation source) { int pS = source.sourceStart, pE = source.sourceEnd; long p = (long)pS << 32 | pE; MessageSend factoryParameterCall = new MessageSend(); setGeneratedBy(factoryParameterCall, source); factoryParameterCall.receiver = super.createFactoryParameter(type, source); factoryParameterCall.selector = "getName".toCharArray(); factoryParameterCall.nameSourcePosition = p; factoryParameterCall.sourceStart = pS; factoryParameterCall.sourceEnd = factoryParameterCall.statementEnd = pE; return factoryParameterCall; }
@Override public void handle(AnnotationValues<NoArgsConstructor> annotation, Annotation ast, EclipseNode annotationNode) { handleFlagUsage(annotationNode, ConfigurationKeys.NO_ARGS_CONSTRUCTOR_FLAG_USAGE, "@NoArgsConstructor", ConfigurationKeys.ANY_CONSTRUCTOR_FLAG_USAGE, "any @xArgsConstructor"); EclipseNode typeNode = annotationNode.up(); if (!checkLegality(typeNode, annotationNode, NoArgsConstructor.class.getSimpleName())) return; NoArgsConstructor ann = annotation.getInstance(); AccessLevel level = ann.access(); String staticName = ann.staticName(); if (level == AccessLevel.NONE) return; boolean force = ann.force(); List<EclipseNode> fields = force ? findFinalFields(typeNode) : Collections.<EclipseNode>emptyList(); List<Annotation> onConstructor = unboxAndRemoveAnnotationParameter(ast, "onConstructor", "@NoArgsConstructor(onConstructor=", annotationNode); new HandleConstructor().generateConstructor(typeNode, level, fields, force, staticName, SkipIfConstructorExists.NO, null, onConstructor, annotationNode); }
@Override public void handle(AnnotationValues<RequiredArgsConstructor> annotation, Annotation ast, EclipseNode annotationNode) { handleFlagUsage(annotationNode, ConfigurationKeys.REQUIRED_ARGS_CONSTRUCTOR_FLAG_USAGE, "@RequiredArgsConstructor", ConfigurationKeys.ANY_CONSTRUCTOR_FLAG_USAGE, "any @xArgsConstructor"); EclipseNode typeNode = annotationNode.up(); if (!checkLegality(typeNode, annotationNode, RequiredArgsConstructor.class.getSimpleName())) return; RequiredArgsConstructor ann = annotation.getInstance(); AccessLevel level = ann.access(); if (level == AccessLevel.NONE) return; String staticName = ann.staticName(); Boolean suppressConstructorProperties = null; if (annotation.isExplicit("suppressConstructorProperties")) { @SuppressWarnings("deprecation") boolean suppress = ann.suppressConstructorProperties(); suppressConstructorProperties = suppress; } List<Annotation> onConstructor = unboxAndRemoveAnnotationParameter(ast, "onConstructor", "@RequiredArgsConstructor(onConstructor=", annotationNode); new HandleConstructor().generateConstructor( typeNode, level, findRequiredFields(typeNode), false, staticName, SkipIfConstructorExists.NO, suppressConstructorProperties, onConstructor, annotationNode); }
@Override public void handle(AnnotationValues<AllArgsConstructor> annotation, Annotation ast, EclipseNode annotationNode) { handleFlagUsage(annotationNode, ConfigurationKeys.ALL_ARGS_CONSTRUCTOR_FLAG_USAGE, "@AllArgsConstructor", ConfigurationKeys.ANY_CONSTRUCTOR_FLAG_USAGE, "any @xArgsConstructor"); EclipseNode typeNode = annotationNode.up(); if (!checkLegality(typeNode, annotationNode, AllArgsConstructor.class.getSimpleName())) return; AllArgsConstructor ann = annotation.getInstance(); AccessLevel level = ann.access(); if (level == AccessLevel.NONE) return; String staticName = ann.staticName(); Boolean suppressConstructorProperties = null; if (annotation.isExplicit("suppressConstructorProperties")) { @SuppressWarnings("deprecation") boolean suppress = ann.suppressConstructorProperties(); suppressConstructorProperties = suppress; } List<Annotation> onConstructor = unboxAndRemoveAnnotationParameter(ast, "onConstructor", "@AllArgsConstructor(onConstructor=", annotationNode); new HandleConstructor().generateConstructor( typeNode, level, findAllFields(typeNode), false, staticName, SkipIfConstructorExists.NO, suppressConstructorProperties, onConstructor, annotationNode); }
public void handle(AnnotationValues<Setter> annotation, Annotation ast, EclipseNode annotationNode) { handleFlagUsage(annotationNode, ConfigurationKeys.SETTER_FLAG_USAGE, "@Setter"); EclipseNode node = annotationNode.up(); AccessLevel level = annotation.getInstance().value(); if (level == AccessLevel.NONE || node == null) return; List<Annotation> onMethod = unboxAndRemoveAnnotationParameter(ast, "onMethod", "@Setter(onMethod=", annotationNode); List<Annotation> onParam = unboxAndRemoveAnnotationParameter(ast, "onParam", "@Setter(onParam=", annotationNode); switch (node.getKind()) { case FIELD: createSetterForFields(level, annotationNode.upFromAnnotationToFields(), annotationNode, true, onMethod, onParam); break; case TYPE: if (!onMethod.isEmpty()) { annotationNode.addError("'onMethod' is not supported for @Setter on a type."); } if (!onParam.isEmpty()) { annotationNode.addError("'onParam' is not supported for @Setter on a type."); } generateSetterForType(node, annotationNode, level, false); break; } }
public static void sanityCheckForMethodGeneratingAnnotationsOnBuilderClass(EclipseNode typeNode, EclipseNode errorNode) { List<String> disallowed = null; for (EclipseNode child : typeNode.down()) { if (child.getKind() != Kind.ANNOTATION) continue; for (Class<? extends java.lang.annotation.Annotation> annType : INVALID_ON_BUILDERS) { if (annotationTypeMatches(annType, child)) { if (disallowed == null) disallowed = new ArrayList<String>(); disallowed.add(annType.getSimpleName()); } } } int size = disallowed == null ? 0 : disallowed.size(); if (size == 0) return; if (size == 1) { errorNode.addError("@" + disallowed.get(0) + " is not allowed on builder classes."); return; } StringBuilder out = new StringBuilder(); for (String a : disallowed) out.append("@").append(a).append(", "); out.setLength(out.length() - 2); errorNode.addError(out.append(" are not allowed on builder classes.").toString()); }
public static boolean hasAnnotation(Class<? extends java.lang.annotation.Annotation> type, EclipseNode node) { if (node == null) return false; if (type == null) return false; switch (node.getKind()) { case ARGUMENT: case FIELD: case LOCAL: case TYPE: case METHOD: for (EclipseNode child : node.down()) { if (annotationTypeMatches(type, child)) return true; } // intentional fallthrough default: return false; } }
/** * Checks if there is a (non-default) constructor. In case of multiple constructors (overloading), only * the first constructor decides if EXISTS_BY_USER or EXISTS_BY_LOMBOK is returned. * * @param node Any node that represents the Type (TypeDeclaration) to look in, or any child node thereof. */ public static MemberExistsResult constructorExists(EclipseNode node) { while (node != null && !(node.get() instanceof TypeDeclaration)) { node = node.up(); } if (node != null && node.get() instanceof TypeDeclaration) { TypeDeclaration typeDecl = (TypeDeclaration)node.get(); if (typeDecl.methods != null) top: for (AbstractMethodDeclaration def : typeDecl.methods) { if (def instanceof ConstructorDeclaration) { if ((def.bits & ASTNode.IsDefaultConstructor) != 0) continue; if (def.annotations != null) for (Annotation anno : def.annotations) { if (typeMatches(Tolerate.class, node, anno.type)) continue top; } return getGeneratedBy(def) == null ? MemberExistsResult.EXISTS_BY_USER : MemberExistsResult.EXISTS_BY_LOMBOK; } } } return MemberExistsResult.NOT_EXISTS; }
@Override public void handle(AnnotationValues<Wither> annotation, Annotation ast, EclipseNode annotationNode) { handleExperimentalFlagUsage(annotationNode, ConfigurationKeys.WITHER_FLAG_USAGE, "@Wither"); EclipseNode node = annotationNode.up(); AccessLevel level = annotation.getInstance().value(); if (level == AccessLevel.NONE || node == null) return; List<Annotation> onMethod = unboxAndRemoveAnnotationParameter(ast, "onMethod", "@Wither(onMethod=", annotationNode); List<Annotation> onParam = unboxAndRemoveAnnotationParameter(ast, "onParam", "@Wither(onParam=", annotationNode); switch (node.getKind()) { case FIELD: createWitherForFields(level, annotationNode.upFromAnnotationToFields(), annotationNode, true, onMethod, onParam); break; case TYPE: if (!onMethod.isEmpty()) { annotationNode.addError("'onMethod' is not supported for @Wither on a type."); } if (!onParam.isEmpty()) { annotationNode.addError("'onParam' is not supported for @Wither on a type."); } generateWitherForType(node, annotationNode, level, false); break; } }
private void makeSimpleSetterMethodForBuilder(EclipseNode builderType, EclipseNode fieldNode, EclipseNode sourceNode, boolean fluent, boolean chain) { TypeDeclaration td = (TypeDeclaration) builderType.get(); AbstractMethodDeclaration[] existing = td.methods; if (existing == null) existing = EMPTY; int len = existing.length; FieldDeclaration fd = (FieldDeclaration) fieldNode.get(); char[] name = fd.name; for (int i = 0; i < len; i++) { if (!(existing[i] instanceof MethodDeclaration)) continue; char[] existingName = existing[i].selector; if (Arrays.equals(name, existingName)) return; } String setterName = fluent ? fieldNode.getName() : HandlerUtil.buildAccessorName("set", fieldNode.getName()); MethodDeclaration setter = HandleSetter.createSetter(td, fieldNode, setterName, chain, ClassFileConstants.AccPublic, sourceNode, Collections.<Annotation>emptyList(), Collections.<Annotation>emptyList()); injectMethod(builderType, setter); }
@Override public void handle(AnnotationValues<RequiredArgsConstructor> annotation, Annotation ast, EclipseNode annotationNode) { handleFlagUsage(annotationNode, ConfigurationKeys.REQUIRED_ARGS_CONSTRUCTOR_FLAG_USAGE, "@RequiredArgsConstructor", ConfigurationKeys.ANY_CONSTRUCTOR_FLAG_USAGE, "any @xArgsConstructor"); EclipseNode typeNode = annotationNode.up(); if (!checkLegality(typeNode, annotationNode, RequiredArgsConstructor.class.getSimpleName())) return; RequiredArgsConstructor ann = annotation.getInstance(); AccessLevel level = ann.access(); if (level == AccessLevel.NONE) return; String staticName = ann.staticName(); Boolean suppressConstructorProperties = null; if (annotation.isExplicit("suppressConstructorProperties")) { @SuppressWarnings("deprecation") boolean suppress = ann.suppressConstructorProperties(); suppressConstructorProperties = suppress; } List<Annotation> onConstructor = unboxAndRemoveAnnotationParameter(ast, "onConstructor", "@RequiredArgsConstructor(onConstructor=", annotationNode); new HandleConstructor().generateConstructor( typeNode, level, findRequiredFields(typeNode), staticName, SkipIfConstructorExists.NO, suppressConstructorProperties, onConstructor, annotationNode); }
@Override public void handle(AnnotationValues<AllArgsConstructor> annotation, Annotation ast, EclipseNode annotationNode) { handleFlagUsage(annotationNode, ConfigurationKeys.ALL_ARGS_CONSTRUCTOR_FLAG_USAGE, "@AllArgsConstructor", ConfigurationKeys.ANY_CONSTRUCTOR_FLAG_USAGE, "any @xArgsConstructor"); EclipseNode typeNode = annotationNode.up(); if (!checkLegality(typeNode, annotationNode, AllArgsConstructor.class.getSimpleName())) return; AllArgsConstructor ann = annotation.getInstance(); AccessLevel level = ann.access(); if (level == AccessLevel.NONE) return; String staticName = ann.staticName(); Boolean suppressConstructorProperties = null; if (annotation.isExplicit("suppressConstructorProperties")) { @SuppressWarnings("deprecation") boolean suppress = ann.suppressConstructorProperties(); suppressConstructorProperties = suppress; } List<Annotation> onConstructor = unboxAndRemoveAnnotationParameter(ast, "onConstructor", "@AllArgsConstructor(onConstructor=", annotationNode); new HandleConstructor().generateConstructor( typeNode, level, findAllFields(typeNode), staticName, SkipIfConstructorExists.NO, suppressConstructorProperties, onConstructor, annotationNode); }
public void handle(AnnotationValues<FieldDefaults> annotation, Annotation ast, EclipseNode annotationNode) { handleExperimentalFlagUsage(annotationNode, ConfigurationKeys.FIELD_DEFAULTS_FLAG_USAGE, "@FieldDefaults"); EclipseNode node = annotationNode.up(); FieldDefaults instance = annotation.getInstance(); AccessLevel level = instance.level(); boolean makeFinal = instance.makeFinal(); if (level == AccessLevel.NONE && !makeFinal) { annotationNode.addError("This does nothing; provide either level or makeFinal or both."); return; } if (level == AccessLevel.PACKAGE) { annotationNode.addError("Setting 'level' to PACKAGE does nothing. To force fields as package private, use the @PackagePrivate annotation on the field."); } if (!makeFinal && annotation.isExplicit("makeFinal")) { annotationNode.addError("Setting 'makeFinal' to false does nothing. To force fields to be non-final, use the @NonFinal annotation on the field."); } if (node == null) return; generateFieldDefaultsForType(node, annotationNode, level, makeFinal, false); }
@Override public boolean visit(Argument argument, BlockScope scope) { Annotation[] annotations = argument.annotations; ReferenceContext referenceContext = scope.referenceContext(); if (referenceContext instanceof AbstractMethodDeclaration) { MethodBinding binding = ((AbstractMethodDeclaration) referenceContext).binding; if (binding != null) { TypeDeclaration typeDeclaration = scope.referenceType(); typeDeclaration.binding.resolveTypesFor(binding); if (argument.binding != null) { argument.binding = new AptSourceLocalVariableBinding(argument.binding, binding); } } if (annotations != null) { this.resolveAnnotations( scope, annotations, argument.binding); } } return false; }
private void resolveAnnotations(BlockScope scope, Annotation[] annotations, Binding currentBinding) { int length = annotations == null ? 0 : annotations.length; if (length == 0) return; boolean old = scope.insideTypeAnnotation; scope.insideTypeAnnotation = true; ASTNode.resolveAnnotations(scope, annotations, currentBinding); scope.insideTypeAnnotation = old; ElementImpl element = (ElementImpl) _factory.newElement(currentBinding); AnnotationBinding [] annotationBindings = element.getPackedAnnotationBindings(); // discovery is never in terms of repeating annotation. for (AnnotationBinding binding : annotationBindings) { if (binding != null) { // binding should be resolved, but in case it's not, ignore it: it could have been wrapped into a container. TypeElement anno = (TypeElement)_factory.newElement(binding.getAnnotationType()); _annoToElement.put(anno, element); } } }
private boolean formatInlineAnnotations(final Annotation[] annotations, boolean spaceBefore) { if (annotations != null ) { if (spaceBefore) this.scribe.space(); int length = annotations.length; for (int i = 0; i < length; ++i) { if (i != 0) this.scribe.space(); annotations[i].traverse(this, (BlockScope)null); } if (length > 0 && (!this.isNextTokenPunctuation() || this.isNextToken(TerminalTokens.TokenNameLBRACKET))) { this.scribe.space(); } if (this.scribe.formatter.preferences.insert_new_line_after_type_annotation) { this.scribe.printNewLine(); } return true; } return false; }
private void generateTypeAnnotation(AnnotationContext annotationContext, int currentOffset) { Annotation annotation = annotationContext.annotation.getPersistibleAnnotation(); if (annotation == null || annotation.resolvedType == null) return; int targetType = annotationContext.targetType; int[] locations = Annotation.getLocations( annotationContext.typeReference, annotationContext.annotation); if (this.contentsOffset + 5 >= this.contents.length) { resizeContents(5); } this.contents[this.contentsOffset++] = (byte) targetType; dumpTargetTypeContents(targetType, annotationContext); dumpLocations(locations); generateAnnotation(annotation, currentOffset); }
public void attach(RecoveredAnnotation[] annots, int annotCount, int mods, int modsSourceStart) { if (annotCount > 0) { Annotation[] existingAnnotations = this.fieldDeclaration.annotations; if (existingAnnotations != null) { this.annotations = new RecoveredAnnotation[annotCount]; this.annotationCount = 0; next : for (int i = 0; i < annotCount; i++) { for (int j = 0; j < existingAnnotations.length; j++) { if (annots[i].annotation == existingAnnotations[j]) continue next; } this.annotations[this.annotationCount++] = annots[i]; } } else { this.annotations = annots; this.annotationCount = annotCount; } } if (mods != 0) { this.modifiers = mods; this.modifiersStart = modsSourceStart; } }
public void attach(RecoveredAnnotation[] annots, int annotCount, int mods, int modsSourceStart) { if (annotCount > 0) { Annotation[] existingAnnotations = this.typeDeclaration.annotations; if (existingAnnotations != null) { this.annotations = new RecoveredAnnotation[annotCount]; this.annotationCount = 0; next : for (int i = 0; i < annotCount; i++) { for (int j = 0; j < existingAnnotations.length; j++) { if (annots[i].annotation == existingAnnotations[j]) continue next; } this.annotations[this.annotationCount++] = annots[i]; } } else { this.annotations = annots; this.annotationCount = annotCount; } } if (mods != 0) { this.modifiers = mods; this.modifiersStart = modsSourceStart; } }
public void annotationsConsumed(Annotation[] consumedAnnotations) { RecoveredAnnotation[] keep = new RecoveredAnnotation[this.pendingAnnotationCount]; int numKeep = 0; int pendingCount = this.pendingAnnotationCount; int consumedLength = consumedAnnotations.length; outerLoop: for (int i = 0; i < pendingCount; i++) { Annotation pendingAnnotationAST = this.pendingAnnotations[i].annotation; for (int j = 0; j < consumedLength; j++) { if (consumedAnnotations[j] == pendingAnnotationAST) continue outerLoop; } keep[numKeep++] = this.pendingAnnotations[i]; } if (numKeep != this.pendingAnnotationCount) { this.pendingAnnotations = keep; this.pendingAnnotationCount = numKeep; } }
public void attach(RecoveredAnnotation[] annots, int annotCount, int mods, int modsSourceStart) { if (annotCount > 0) { Annotation[] existingAnnotations = this.methodDeclaration.annotations; if (existingAnnotations != null) { this.annotations = new RecoveredAnnotation[annotCount]; this.annotationCount = 0; next : for (int i = 0; i < annotCount; i++) { for (int j = 0; j < existingAnnotations.length; j++) { if (annots[i].annotation == existingAnnotations[j]) continue next; } this.annotations[this.annotationCount++] = annots[i]; } } else { this.annotations = annots; this.annotationCount = annotCount; } } if (mods != 0) { this.modifiers = mods; this.modifiersStart = modsSourceStart; } }
public void attach(RecoveredAnnotation[] annots, int annotCount, int mods, int modsSourceStart) { if (annotCount > 0) { Annotation[] existingAnnotations = this.localDeclaration.annotations; if (existingAnnotations != null) { this.annotations = new RecoveredAnnotation[annotCount]; this.annotationCount = 0; next : for (int i = 0; i < annotCount; i++) { for (int j = 0; j < existingAnnotations.length; j++) { if (annots[i].annotation == existingAnnotations[j]) continue next; } this.annotations[this.annotationCount++] = annots[i]; } } else { this.annotations = annots; this.annotationCount = annotCount; } } if (mods != 0) { this.modifiers = mods; this.modifiersStart = modsSourceStart; } }
protected Annotation[][] getAnnotationsOnDimensions(int dimensionsCount) { Annotation [][] dimensionsAnnotations = null; if (dimensionsCount > 0) { for (int i = 0; i < dimensionsCount; i++) { Annotation [] annotations = null; int length; if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) { System.arraycopy( this.typeAnnotationStack, (this.typeAnnotationPtr -= length) + 1, annotations = new Annotation[length], 0, length); if (dimensionsAnnotations == null) { dimensionsAnnotations = new Annotation[dimensionsCount][]; } dimensionsAnnotations[dimensionsCount - i - 1] = annotations; } } } return dimensionsAnnotations; }
protected void consumeNonTypeUseName() { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=383596 // RejectTypeAnnotations ::= $empty // We can get here with type annotation stack empty, because completion parser manipulates the identifier stacks even without rule reduction. See completionIdentifierCheck for (int i = this.identifierLengthStack[this.identifierLengthPtr]; i > 0 && this.typeAnnotationLengthPtr >= 0; --i) { int length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]; Annotation [] typeAnnotations; if (length != 0) { System.arraycopy( this.typeAnnotationStack, (this.typeAnnotationPtr -= length) + 1, typeAnnotations = new Annotation[length], 0, length); problemReporter().misplacedTypeAnnotations(typeAnnotations[0], typeAnnotations[typeAnnotations.length - 1]); } } }
protected void annotateTypeReference(Wildcard ref) { int length; if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) { if (ref.annotations == null) ref.annotations = new Annotation[ref.getAnnotatableLevels()][]; System.arraycopy( this.typeAnnotationStack, (this.typeAnnotationPtr -= length) + 1, ref.annotations[0] = new Annotation[length], 0, length); if (ref.sourceStart > ref.annotations[0][0].sourceStart) { ref.sourceStart = ref.annotations[0][0].sourceStart; } ref.bits |= ASTNode.HasTypeAnnotations; } if (ref.bound != null) { ref.bits |= (ref.bound.bits & ASTNode.HasTypeAnnotations); } }
protected void pushOnTypeAnnotationStack(Annotation annotation) { int stackLength = this.typeAnnotationStack.length; if (++this.typeAnnotationPtr >= stackLength) { System.arraycopy( this.typeAnnotationStack, 0, this.typeAnnotationStack = new Annotation[stackLength + TypeAnnotationStackIncrement], 0, stackLength); } this.typeAnnotationStack[this.typeAnnotationPtr] = annotation; stackLength = this.typeAnnotationLengthStack.length; if (++this.typeAnnotationLengthPtr >= stackLength) { System.arraycopy( this.typeAnnotationLengthStack, 0, this.typeAnnotationLengthStack = new int[stackLength + TypeAnnotationStackIncrement], 0, stackLength); } this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr] = 1; }