@Override public IBinaryAnnotation[] getAnnotationsAtCursor() { IBinaryAnnotation[] normalAnnotations = this.isEmpty ? null : super.getAnnotationsAtCursor(); if (this.atDefaultLocation) { if (normalAnnotations == null || normalAnnotations.length == 0) return new IBinaryAnnotation[] { this.nonNullAnnotation }; int len = normalAnnotations.length; IBinaryAnnotation[] newAnnots = new IBinaryAnnotation[len+1]; System.arraycopy(normalAnnotations, 0, newAnnots, 0, len); newAnnots[len] = this.nonNullAnnotation; return newAnnots; } return normalAnnotations; } }
@Override public IBinaryAnnotation[] getAnnotationsAtCursor() { IBinaryAnnotation[] normalAnnotations = this.isEmpty ? null : super.getAnnotationsAtCursor(); if (this.atDefaultLocation) { if (normalAnnotations == null || normalAnnotations.length == 0) return new IBinaryAnnotation[] { this.nonNullAnnotation }; int len = normalAnnotations.length; IBinaryAnnotation[] newAnnots = new IBinaryAnnotation[len+1]; System.arraycopy(normalAnnotations, 0, newAnnots, 0, len); newAnnots[len] = this.nonNullAnnotation; return newAnnots; } return normalAnnotations; } }
@Override public IBinaryAnnotation[] getAnnotationsAtCursor() { IBinaryAnnotation[] normalAnnotations = this.isEmpty ? null : super.getAnnotationsAtCursor(); if (this.atDefaultLocation) { if (normalAnnotations == null || normalAnnotations.length == 0) return new IBinaryAnnotation[] { this.nonNullAnnotation }; int len = normalAnnotations.length; IBinaryAnnotation[] newAnnots = new IBinaryAnnotation[len+1]; System.arraycopy(normalAnnotations, 0, newAnnots, 0, len); newAnnots[len] = this.nonNullAnnotation; return newAnnots; } return normalAnnotations; } }
@Override public IBinaryAnnotation[] getAnnotationsAtCursor(int currentTypeId, boolean mayApplyArrayContentsDefaultNullness) { IBinaryAnnotation[] normalAnnotations = this.isEmpty ? NO_ANNOTATIONS : super.getAnnotationsAtCursor(currentTypeId, mayApplyArrayContentsDefaultNullness); if ((this.atDefaultLocation || (mayApplyArrayContentsDefaultNullness && this.currentArrayContentIsNonNull)) && !(currentTypeId == -1) && // never apply default on type variable use or wildcard !(this.atTypeBound && currentTypeId == TypeIds.T_JavaLangObject)) // for CLIMB-to-top consider a j.l.Object type bound as no explicit type bound { if (normalAnnotations == null || normalAnnotations.length == 0) return new IBinaryAnnotation[] { this.nonNullAnnotation }; if (this.environment.containsNullTypeAnnotation(normalAnnotations)) { // no default annotation if explicit annotation exists return normalAnnotations; } else { // merge: int len = normalAnnotations.length; IBinaryAnnotation[] newAnnots = new IBinaryAnnotation[len+1]; System.arraycopy(normalAnnotations, 0, newAnnots, 0, len); newAnnots[len] = this.nonNullAnnotation; return newAnnots; } } return normalAnnotations; }
@Override public IBinaryAnnotation[] getAnnotationsAtCursor(int currentTypeId) { IBinaryAnnotation[] normalAnnotations = this.isEmpty ? NO_ANNOTATIONS : super.getAnnotationsAtCursor(currentTypeId); if (this.atDefaultLocation && !(currentTypeId == -1) && // never apply default on type variable use or wildcard !(this.atTypeBound && currentTypeId == TypeIds.T_JavaLangObject)) // for CLIMB-to-top consider a j.l.Object type bound as no explicit type bound { if (normalAnnotations == null || normalAnnotations.length == 0) return new IBinaryAnnotation[] { this.nonNullAnnotation }; if (this.environment.containsNullTypeAnnotation(normalAnnotations)) { // no default annotation if explicit annotation exists return normalAnnotations; } else { // merge: int len = normalAnnotations.length; IBinaryAnnotation[] newAnnots = new IBinaryAnnotation[len+1]; System.arraycopy(normalAnnotations, 0, newAnnots, 0, len); newAnnots[len] = this.nonNullAnnotation; return newAnnots; } } return normalAnnotations; } }
@Override public IBinaryAnnotation[] getAnnotationsAtCursor(int currentTypeId) { IBinaryAnnotation[] normalAnnotations = this.isEmpty ? NO_ANNOTATIONS : super.getAnnotationsAtCursor(currentTypeId); if (this.atDefaultLocation && !(currentTypeId == -1) && // never apply default on type variable use or wildcard !(this.atTypeBound && currentTypeId == TypeIds.T_JavaLangObject)) // for CLIMB-to-top consider a j.l.Object type bound as no explicit type bound { if (normalAnnotations == null || normalAnnotations.length == 0) return new IBinaryAnnotation[] { this.nonNullAnnotation }; if (this.environment.containsNullTypeAnnotation(normalAnnotations)) { // no default annotation if explicit annotation exists return normalAnnotations; } else { // merge: int len = normalAnnotations.length; IBinaryAnnotation[] newAnnots = new IBinaryAnnotation[len+1]; System.arraycopy(normalAnnotations, 0, newAnnots, 0, len); newAnnots[len] = this.nonNullAnnotation; return newAnnots; } } return normalAnnotations; } }
@Override public IBinaryAnnotation[] getAnnotationsAtCursor(int currentTypeId, boolean mayApplyArrayContentsDefaultNullness) { IBinaryAnnotation[] normalAnnotations = this.isEmpty ? NO_ANNOTATIONS : super.getAnnotationsAtCursor(currentTypeId, mayApplyArrayContentsDefaultNullness); if ((this.atDefaultLocation || (mayApplyArrayContentsDefaultNullness && this.currentArrayContentIsNonNull)) && !(currentTypeId == -1) && // never apply default on type variable use or wildcard !(this.atTypeBound && currentTypeId == TypeIds.T_JavaLangObject)) // for CLIMB-to-top consider a j.l.Object type bound as no explicit type bound { if (normalAnnotations == null || normalAnnotations.length == 0) return new IBinaryAnnotation[] { this.nonNullAnnotation }; if (this.environment.containsNullTypeAnnotation(normalAnnotations)) { // no default annotation if explicit annotation exists return normalAnnotations; } else { // merge: int len = normalAnnotations.length; IBinaryAnnotation[] newAnnots = new IBinaryAnnotation[len+1]; System.arraycopy(normalAnnotations, 0, newAnnots, 0, len); newAnnots[len] = this.nonNullAnnotation; return newAnnots; } } return normalAnnotations; }
@Override public IBinaryAnnotation[] getAnnotationsAtCursor(int currentTypeId) { IBinaryAnnotation[] normalAnnotations = this.isEmpty ? NO_ANNOTATIONS : super.getAnnotationsAtCursor(currentTypeId); if (this.atDefaultLocation && !(currentTypeId == -1) && // never apply default on type variable use or wildcard !(this.atTypeBound && currentTypeId == TypeIds.T_JavaLangObject)) // for CLIMB-to-top consider a j.l.Object type bound as no explicit type bound { if (normalAnnotations == null || normalAnnotations.length == 0) return new IBinaryAnnotation[] { this.nonNullAnnotation }; if (this.environment.containsNullTypeAnnotation(normalAnnotations)) { // no default annotation if explicit annotation exists return normalAnnotations; } else { // merge: int len = normalAnnotations.length; IBinaryAnnotation[] newAnnots = new IBinaryAnnotation[len+1]; System.arraycopy(normalAnnotations, 0, newAnnots, 0, len); newAnnots[len] = this.nonNullAnnotation; return newAnnots; } } return normalAnnotations; } }
private TypeBinding getTypeFromTypeVariable(TypeVariableBinding typeVariableBinding, int dimension, AnnotationBinding [][] annotationsOnDimensions, TypeAnnotationWalker walker, char [][][] missingTypeNames) { AnnotationBinding [] annotations = BinaryTypeBinding.createAnnotations(walker.getAnnotationsAtCursor(), 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, TypeAnnotationWalker walker, char [][][] missingTypeNames) { AnnotationBinding [] annotations = BinaryTypeBinding.createAnnotations(walker.getAnnotationsAtCursor(), 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, TypeAnnotationWalker walker, char [][][] missingTypeNames) { AnnotationBinding [] annotations = BinaryTypeBinding.createAnnotations(walker.getAnnotationsAtCursor(), 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)); }
AnnotationBinding [] annotations = BinaryTypeBinding.createAnnotations(walker.getAnnotationsAtCursor(), this, missingTypeNames); return this.typeSystem.getWildcard(genericType, rank, bound, null /*no extra bound*/, Wildcard.SUPER, annotations); case '+' : annotations = BinaryTypeBinding.createAnnotations(walker.getAnnotationsAtCursor(), this, missingTypeNames); return this.typeSystem.getWildcard(genericType, rank, bound, null /*no extra bound*/, Wildcard.EXTENDS, annotations); case '*' : annotations = BinaryTypeBinding.createAnnotations(walker.getAnnotationsAtCursor(), this, missingTypeNames); return this.typeSystem.getWildcard(genericType, rank, null, null /*no extra bound*/, Wildcard.UNBOUND, annotations); default :
AnnotationBinding [] annotations = BinaryTypeBinding.createAnnotations(walker.getAnnotationsAtCursor(), this, missingTypeNames); return this.typeSystem.getWildcard(genericType, rank, bound, null /*no extra bound*/, Wildcard.SUPER, annotations); case '+' : annotations = BinaryTypeBinding.createAnnotations(walker.getAnnotationsAtCursor(), this, missingTypeNames); return this.typeSystem.getWildcard(genericType, rank, bound, null /*no extra bound*/, Wildcard.EXTENDS, annotations); case '*' : annotations = BinaryTypeBinding.createAnnotations(walker.getAnnotationsAtCursor(), this, missingTypeNames); return this.typeSystem.getWildcard(genericType, rank, null, null /*no extra bound*/, Wildcard.UNBOUND, annotations); default :
AnnotationBinding [] annotations = BinaryTypeBinding.createAnnotations(walker.getAnnotationsAtCursor(), this, missingTypeNames); return this.typeSystem.getWildcard(genericType, rank, bound, null /*no extra bound*/, Wildcard.SUPER, annotations); case '+' : annotations = BinaryTypeBinding.createAnnotations(walker.getAnnotationsAtCursor(), this, missingTypeNames); return this.typeSystem.getWildcard(genericType, rank, bound, null /*no extra bound*/, Wildcard.EXTENDS, annotations); case '*' : annotations = BinaryTypeBinding.createAnnotations(walker.getAnnotationsAtCursor(), this, missingTypeNames); return this.typeSystem.getWildcard(genericType, rank, null, null /*no extra bound*/, Wildcard.UNBOUND, annotations); default :
char[] variableName = CharOperation.subarray(typeSignature, i, colon); TypeVariableBinding typeVariable = new TypeVariableBinding(variableName, this, rank, this.environment); AnnotationBinding [] annotations = BinaryTypeBinding.createAnnotations(walker.toTypeParameter(isClassTypeParameter, rank++).getAnnotationsAtCursor(), this.environment, missingTypeNames); if (annotations != null && annotations != Binding.NO_ANNOTATIONS)
char[] variableName = CharOperation.subarray(typeSignature, i, colon); TypeVariableBinding typeVariable = new TypeVariableBinding(variableName, this, rank, this.environment); AnnotationBinding [] annotations = BinaryTypeBinding.createAnnotations(walker.toTypeParameter(isClassTypeParameter, rank++).getAnnotationsAtCursor(), this.environment, missingTypeNames); if (annotations != null && annotations != Binding.NO_ANNOTATIONS)
char[] variableName = CharOperation.subarray(typeSignature, i, colon); TypeVariableBinding typeVariable = new TypeVariableBinding(variableName, this, rank, this.environment); AnnotationBinding [] annotations = BinaryTypeBinding.createAnnotations(walker.toTypeParameter(isClassTypeParameter, rank++).getAnnotationsAtCursor(), this.environment, missingTypeNames); if (annotations != null && annotations != Binding.NO_ANNOTATIONS)
private TypeBinding annotateType(TypeBinding binding, TypeAnnotationWalker 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); TypeBinding currentBinding = binding; depth = 0; while (currentBinding != null) { depth++; if (currentBinding.isStatic()) break; currentBinding = currentBinding.enclosingType(); } } AnnotationBinding [][] annotations = null; for (int i = 0; i < depth; i++) { AnnotationBinding[] annots = BinaryTypeBinding.createAnnotations(walker.getAnnotationsAtCursor(), 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, TypeAnnotationWalker 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); TypeBinding currentBinding = binding; depth = 0; while (currentBinding != null) { depth++; if (currentBinding.isStatic()) break; currentBinding = currentBinding.enclosingType(); } } AnnotationBinding [][] annotations = null; for (int i = 0; i < depth; i++) { AnnotationBinding[] annots = BinaryTypeBinding.createAnnotations(walker.getAnnotationsAtCursor(), 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, TypeAnnotationWalker 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); TypeBinding currentBinding = binding; depth = 0; while (currentBinding != null) { depth++; if (currentBinding.isStatic()) break; currentBinding = currentBinding.enclosingType(); } } AnnotationBinding [][] annotations = null; for (int i = 0; i < depth; i++) { AnnotationBinding[] annots = BinaryTypeBinding.createAnnotations(walker.getAnnotationsAtCursor(), 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; }