@Override public boolean visit(ReferenceBinding referenceBinding) { IBinaryAnnotation[] binaryAnnotations = this.currentWalker.getAnnotationsAtCursor(referenceBinding.id); if (binaryAnnotations != ITypeAnnotationWalker.NO_ANNOTATIONS) this.typeReplacement = this.environment.createAnnotatedType(referenceBinding, BinaryTypeBinding.createAnnotations(binaryAnnotations, this.environment, null)); return false; } @Override
@Override public boolean visit(ReferenceBinding referenceBinding) { IBinaryAnnotation[] binaryAnnotations = this.currentWalker.getAnnotationsAtCursor(referenceBinding.id, false); if (binaryAnnotations != ITypeAnnotationWalker.NO_ANNOTATIONS) this.typeReplacement = this.environment.createAnnotatedType(referenceBinding, BinaryTypeBinding.createAnnotations(binaryAnnotations, this.environment, null)); return false; } @Override
@Override public boolean visit(ReferenceBinding referenceBinding) { IBinaryAnnotation[] binaryAnnotations = this.currentWalker.getAnnotationsAtCursor(referenceBinding.id, false); if (binaryAnnotations != ITypeAnnotationWalker.NO_ANNOTATIONS) this.typeReplacement = this.environment.createAnnotatedType(referenceBinding, BinaryTypeBinding.createAnnotations(binaryAnnotations, this.environment, null)); return false; } @Override
@Override public boolean visit(ReferenceBinding referenceBinding) { IBinaryAnnotation[] binaryAnnotations = this.currentWalker.getAnnotationsAtCursor(referenceBinding.id); if (binaryAnnotations != ITypeAnnotationWalker.NO_ANNOTATIONS) this.typeReplacement = this.environment.createAnnotatedType(referenceBinding, BinaryTypeBinding.createAnnotations(binaryAnnotations, this.environment, null)); return false; } @Override
@Override public boolean visit(ReferenceBinding referenceBinding) { IBinaryAnnotation[] binaryAnnotations = this.currentWalker.getAnnotationsAtCursor(referenceBinding.id); if (binaryAnnotations != ITypeAnnotationWalker.NO_ANNOTATIONS) this.typeReplacement = this.environment.createAnnotatedType(referenceBinding, BinaryTypeBinding.createAnnotations(binaryAnnotations, this.environment, null)); return false; } @Override
private TypeBinding getTypeFromTypeVariable(TypeVariableBinding typeVariableBinding, int dimension, AnnotationBinding [][] annotationsOnDimensions, ITypeAnnotationWalker walker, char [][][] missingTypeNames) { AnnotationBinding [] annotations = BinaryTypeBinding.createAnnotations(walker.getAnnotationsAtCursor(-1, false), this, missingTypeNames); if (annotations != null && annotations != Binding.NO_ANNOTATIONS) typeVariableBinding = (TypeVariableBinding) createAnnotatedType(typeVariableBinding, new AnnotationBinding [][] { annotations }); if (dimension == 0) { return typeVariableBinding; } return this.typeSystem.getArrayType(typeVariableBinding, dimension, AnnotatableTypeSystem.flattenedAnnotations(annotationsOnDimensions)); }
private TypeBinding getTypeFromTypeVariable(TypeVariableBinding typeVariableBinding, int dimension, AnnotationBinding [][] annotationsOnDimensions, ITypeAnnotationWalker walker, char [][][] missingTypeNames) { AnnotationBinding [] annotations = BinaryTypeBinding.createAnnotations(walker.getAnnotationsAtCursor(-1), this, missingTypeNames); if (annotations != null && annotations != Binding.NO_ANNOTATIONS) typeVariableBinding = (TypeVariableBinding) createAnnotatedType(typeVariableBinding, new AnnotationBinding [][] { annotations }); if (dimension == 0) { return typeVariableBinding; } return this.typeSystem.getArrayType(typeVariableBinding, dimension, AnnotatableTypeSystem.flattenedAnnotations(annotationsOnDimensions)); }
private TypeBinding getTypeFromTypeVariable(TypeVariableBinding typeVariableBinding, int dimension, AnnotationBinding [][] annotationsOnDimensions, ITypeAnnotationWalker walker, char [][][] missingTypeNames) { AnnotationBinding [] annotations = BinaryTypeBinding.createAnnotations(walker.getAnnotationsAtCursor(-1, false), this, missingTypeNames); if (annotations != null && annotations != Binding.NO_ANNOTATIONS) typeVariableBinding = (TypeVariableBinding) createAnnotatedType(typeVariableBinding, new AnnotationBinding [][] { annotations }); if (dimension == 0) { return typeVariableBinding; } return this.typeSystem.getArrayType(typeVariableBinding, dimension, AnnotatableTypeSystem.flattenedAnnotations(annotationsOnDimensions)); }
private TypeBinding getTypeFromTypeVariable(TypeVariableBinding typeVariableBinding, int dimension, AnnotationBinding [][] annotationsOnDimensions, ITypeAnnotationWalker walker, char [][][] missingTypeNames) { AnnotationBinding [] annotations = BinaryTypeBinding.createAnnotations(walker.getAnnotationsAtCursor(-1), this, missingTypeNames); if (annotations != null && annotations != Binding.NO_ANNOTATIONS) typeVariableBinding = (TypeVariableBinding) createAnnotatedType(typeVariableBinding, new AnnotationBinding [][] { annotations }); if (dimension == 0) { return typeVariableBinding; } return this.typeSystem.getArrayType(typeVariableBinding, dimension, AnnotatableTypeSystem.flattenedAnnotations(annotationsOnDimensions)); }
private TypeBinding getTypeFromTypeVariable(TypeVariableBinding typeVariableBinding, int dimension, AnnotationBinding [][] annotationsOnDimensions, ITypeAnnotationWalker walker, char [][][] missingTypeNames) { AnnotationBinding [] annotations = BinaryTypeBinding.createAnnotations(walker.getAnnotationsAtCursor(-1), this, missingTypeNames); if (annotations != null && annotations != Binding.NO_ANNOTATIONS) typeVariableBinding = (TypeVariableBinding) createAnnotatedType(typeVariableBinding, new AnnotationBinding [][] { annotations }); if (dimension == 0) { return typeVariableBinding; } return this.typeSystem.getArrayType(typeVariableBinding, dimension, AnnotatableTypeSystem.flattenedAnnotations(annotationsOnDimensions)); }
@Override public boolean visit(WildcardBinding wildcardBinding) { TypeBinding bound = wildcardBinding.bound; ExternalAnnotationSuperimposer memento = snapshot(); try { if (bound != null) { bound = goAndSuperimpose(memento.currentWalker.toWildcardBound(), bound); } IBinaryAnnotation[] binaryAnnotations = memento.currentWalker.getAnnotationsAtCursor(-1); if (this.isReplacing || binaryAnnotations != ITypeAnnotationWalker.NO_ANNOTATIONS) { TypeBinding[] otherBounds = wildcardBinding.otherBounds; if (binaryAnnotations != ITypeAnnotationWalker.NO_ANNOTATIONS) { AnnotationBinding[] annotations = BinaryTypeBinding.createAnnotations(binaryAnnotations, this.environment, null); this.typeReplacement = this.environment.createWildcard(wildcardBinding.genericType, wildcardBinding.rank, bound, otherBounds, wildcardBinding.boundKind, annotations); } else { this.typeReplacement = this.environment.createWildcard(wildcardBinding.genericType, wildcardBinding.rank, bound, otherBounds, wildcardBinding.boundKind); } } } finally { restore(memento); } return false; } }
@Override public boolean visit(WildcardBinding wildcardBinding) { TypeBinding bound = wildcardBinding.bound; ExternalAnnotationSuperimposer memento = snapshot(); try { if (bound != null) { bound = goAndSuperimpose(memento.currentWalker.toWildcardBound(), bound); } IBinaryAnnotation[] binaryAnnotations = memento.currentWalker.getAnnotationsAtCursor(-1, false); if (this.isReplacing || binaryAnnotations != ITypeAnnotationWalker.NO_ANNOTATIONS) { TypeBinding[] otherBounds = wildcardBinding.otherBounds; if (binaryAnnotations != ITypeAnnotationWalker.NO_ANNOTATIONS) { AnnotationBinding[] annotations = BinaryTypeBinding.createAnnotations(binaryAnnotations, this.environment, null); this.typeReplacement = this.environment.createWildcard(wildcardBinding.genericType, wildcardBinding.rank, bound, otherBounds, wildcardBinding.boundKind, annotations); } else { this.typeReplacement = this.environment.createWildcard(wildcardBinding.genericType, wildcardBinding.rank, bound, otherBounds, wildcardBinding.boundKind); } } } finally { restore(memento); } return false; } }
private TypeBinding annotateType(TypeBinding binding, ITypeAnnotationWalker walker, char[][][] missingTypeNames) { int depth = binding.depth() + 1; if (depth > 1) { // need to count non-static nesting levels, resolved binding required for precision if (binding.isUnresolvedType()) binding = ((UnresolvedReferenceBinding) binding).resolve(this, true); depth = countNonStaticNestingLevels(binding) + 1; } AnnotationBinding [][] annotations = null; for (int i = 0; i < depth; i++) { AnnotationBinding[] annots = BinaryTypeBinding.createAnnotations(walker.getAnnotationsAtCursor(binding.id, i == depth - 1), this, missingTypeNames); if (annots != null && annots.length > 0) { if (annotations == null) annotations = new AnnotationBinding[depth][]; annotations[i] = annots; } walker = walker.toNextNestedType(); } if (annotations != null) binding = createAnnotatedType(binding, annotations); return binding; }
private TypeBinding annotateType(TypeBinding binding, ITypeAnnotationWalker walker, char[][][] missingTypeNames) { int depth = binding.depth() + 1; if (depth > 1) { // need to count non-static nesting levels, resolved binding required for precision if (binding.isUnresolvedType()) binding = ((UnresolvedReferenceBinding) binding).resolve(this, true); depth = countNonStaticNestingLevels(binding) + 1; } AnnotationBinding [][] annotations = null; for (int i = 0; i < depth; i++) { AnnotationBinding[] annots = BinaryTypeBinding.createAnnotations(walker.getAnnotationsAtCursor(binding.id, i == depth - 1), this, missingTypeNames); if (annots != null && annots.length > 0) { if (annotations == null) annotations = new AnnotationBinding[depth][]; annotations[i] = annots; } walker = walker.toNextNestedType(); } if (annotations != null) binding = createAnnotatedType(binding, annotations); return binding; }
@Override public boolean visit(ArrayBinding arrayBinding) { ExternalAnnotationSuperimposer memento = snapshot(); try { int dims = arrayBinding.dimensions; AnnotationBinding[][] annotsOnDims = new AnnotationBinding[dims][]; ITypeAnnotationWalker walker = this.currentWalker; for (int i = 0; i < dims; i++) { IBinaryAnnotation[] binaryAnnotations = walker.getAnnotationsAtCursor(arrayBinding.id); if (binaryAnnotations != ITypeAnnotationWalker.NO_ANNOTATIONS) { annotsOnDims[i] = BinaryTypeBinding.createAnnotations(binaryAnnotations, this.environment, null); this.isReplacing = true; } else { annotsOnDims[i] = Binding.NO_ANNOTATIONS; } walker = walker.toNextArrayDimension(); } TypeBinding leafComponentType = goAndSuperimpose(walker, arrayBinding.leafComponentType()); if (this.isReplacing) { this.typeReplacement = this.environment.createArrayType(leafComponentType, dims, AnnotatableTypeSystem.flattenedAnnotations(annotsOnDims)); } } finally { restore(memento); } return false; } @Override
@Override public boolean visit(ParameterizedTypeBinding parameterizedTypeBinding) { ExternalAnnotationSuperimposer memento = snapshot(); try { IBinaryAnnotation[] binaryAnnotations = this.currentWalker.getAnnotationsAtCursor(parameterizedTypeBinding.id, false); AnnotationBinding[] annotations = Binding.NO_ANNOTATIONS; if (binaryAnnotations != ITypeAnnotationWalker.NO_ANNOTATIONS) { annotations = BinaryTypeBinding.createAnnotations(binaryAnnotations, this.environment, null); this.isReplacing = true; } TypeBinding[] typeArguments = parameterizedTypeBinding.typeArguments(); TypeBinding[] newArguments = new TypeBinding[typeArguments.length]; for (int i = 0; i < typeArguments.length; i++) { newArguments[i] = goAndSuperimpose(memento.currentWalker.toTypeArgument(i), typeArguments[i]); } if (this.isReplacing) this.typeReplacement = this.environment.createParameterizedType(parameterizedTypeBinding.genericType(), newArguments, parameterizedTypeBinding.enclosingType(), annotations); return false; } finally { restore(memento); } } @Override
@Override public boolean visit(ParameterizedTypeBinding parameterizedTypeBinding) { ExternalAnnotationSuperimposer memento = snapshot(); try { IBinaryAnnotation[] binaryAnnotations = this.currentWalker.getAnnotationsAtCursor(parameterizedTypeBinding.id); AnnotationBinding[] annotations = Binding.NO_ANNOTATIONS; if (binaryAnnotations != ITypeAnnotationWalker.NO_ANNOTATIONS) { annotations = BinaryTypeBinding.createAnnotations(binaryAnnotations, this.environment, null); this.isReplacing = true; } TypeBinding[] typeArguments = parameterizedTypeBinding.typeArguments(); TypeBinding[] newArguments = new TypeBinding[typeArguments.length]; for (int i = 0; i < typeArguments.length; i++) { newArguments[i] = goAndSuperimpose(memento.currentWalker.toTypeArgument(i), typeArguments[i]); } if (this.isReplacing) this.typeReplacement = this.environment.createParameterizedType(parameterizedTypeBinding.genericType(), newArguments, parameterizedTypeBinding.enclosingType(), annotations); return false; } finally { restore(memento); } } @Override
@Override public boolean visit(ParameterizedTypeBinding parameterizedTypeBinding) { ExternalAnnotationSuperimposer memento = snapshot(); try { IBinaryAnnotation[] binaryAnnotations = this.currentWalker.getAnnotationsAtCursor(parameterizedTypeBinding.id); AnnotationBinding[] annotations = Binding.NO_ANNOTATIONS; if (binaryAnnotations != ITypeAnnotationWalker.NO_ANNOTATIONS) { annotations = BinaryTypeBinding.createAnnotations(binaryAnnotations, this.environment, null); this.isReplacing = true; } TypeBinding[] typeArguments = parameterizedTypeBinding.typeArguments(); TypeBinding[] newArguments = new TypeBinding[typeArguments.length]; for (int i = 0; i < typeArguments.length; i++) { newArguments[i] = goAndSuperimpose(memento.currentWalker.toTypeArgument(i), typeArguments[i]); } if (this.isReplacing) this.typeReplacement = this.environment.createParameterizedType(parameterizedTypeBinding.genericType(), newArguments, parameterizedTypeBinding.enclosingType(), annotations); return false; } finally { restore(memento); } } @Override
@Override public boolean visit(ParameterizedTypeBinding parameterizedTypeBinding) { ExternalAnnotationSuperimposer memento = snapshot(); try { IBinaryAnnotation[] binaryAnnotations = this.currentWalker.getAnnotationsAtCursor(parameterizedTypeBinding.id); AnnotationBinding[] annotations = Binding.NO_ANNOTATIONS; if (binaryAnnotations != ITypeAnnotationWalker.NO_ANNOTATIONS) { annotations = BinaryTypeBinding.createAnnotations(binaryAnnotations, this.environment, null); this.isReplacing = true; } TypeBinding[] typeArguments = parameterizedTypeBinding.typeArguments(); TypeBinding[] newArguments = new TypeBinding[typeArguments.length]; for (int i = 0; i < typeArguments.length; i++) { newArguments[i] = goAndSuperimpose(memento.currentWalker.toTypeArgument(i), typeArguments[i]); } if (this.isReplacing) this.typeReplacement = this.environment.createParameterizedType(parameterizedTypeBinding.genericType(), newArguments, parameterizedTypeBinding.enclosingType(), annotations); return false; } finally { restore(memento); } } @Override
@Override public boolean visit(ParameterizedTypeBinding parameterizedTypeBinding) { ExternalAnnotationSuperimposer memento = snapshot(); try { IBinaryAnnotation[] binaryAnnotations = this.currentWalker.getAnnotationsAtCursor(parameterizedTypeBinding.id, false); AnnotationBinding[] annotations = Binding.NO_ANNOTATIONS; if (binaryAnnotations != ITypeAnnotationWalker.NO_ANNOTATIONS) { annotations = BinaryTypeBinding.createAnnotations(binaryAnnotations, this.environment, null); this.isReplacing = true; } TypeBinding[] typeArguments = parameterizedTypeBinding.typeArguments(); TypeBinding[] newArguments = new TypeBinding[typeArguments.length]; for (int i = 0; i < typeArguments.length; i++) { newArguments[i] = goAndSuperimpose(memento.currentWalker.toTypeArgument(i), typeArguments[i]); } if (this.isReplacing) this.typeReplacement = this.environment.createParameterizedType(parameterizedTypeBinding.genericType(), newArguments, parameterizedTypeBinding.enclosingType(), annotations); return false; } finally { restore(memento); } } @Override