private final class InternalParameterizedTypeBinding extends ParameterizedTypeBinding { public InternalParameterizedTypeBinding(ReferenceBinding genericType, TypeBinding[] typeArguments, ReferenceBinding enclosingType, LookupEnvironment environment) { super(genericType, typeArguments, enclosingType, environment); } public boolean equals(Object other) { ParameterizedTypeBinding that = (ParameterizedTypeBinding) other; // homogeneous container. return this.type == that.type && this.enclosingType == that.enclosingType && Util.effectivelyEqual(this.arguments, that.arguments); //$IDENTITY-COMPARISON$ } public int hashCode() { int hashCode = this.type.hashCode() + 13 * (this.enclosingType != null ? this.enclosingType.hashCode() : 0); for (int i = 0, length = this.arguments == null ? 0 : this.arguments.length; i < length; i++) { hashCode += (i + 1) * this.arguments[i].id * this.arguments[i].hashCode(); } return hashCode; } }
public TypeBinding createAnnotatedType(TypeBinding type, AnnotationBinding[][] annotations) { return this.typeSystem.getAnnotatedType(type, annotations); }
public TypeBinding[] getAnnotatedTypes(TypeBinding type) { return this.typeSystem.getAnnotatedTypes(type); } }
public final TypeBinding getIntersectionType18(ReferenceBinding[] intersectingTypes) { int intersectingTypesLength = intersectingTypes == null ? 0 : intersectingTypes.length; if (intersectingTypesLength == 0) return null; TypeBinding keyType = intersectingTypes[0]; if (keyType == null || intersectingTypesLength == 1) return keyType; TypeBinding[] derivedTypes = getDerivedTypes(keyType); int i, length = derivedTypes.length; next: for (i = 0; i < length; i++) { TypeBinding derivedType = derivedTypes[i]; if (derivedType == null) break; if (!derivedType.isIntersectionType18()) continue; ReferenceBinding [] priorIntersectingTypes = derivedType.getIntersectingTypes(); if (priorIntersectingTypes.length != intersectingTypesLength) continue; for (int j = 0; j < intersectingTypesLength; j++) { if (intersectingTypes[j] != priorIntersectingTypes[j]) //$IDENTITY-COMPARISON$ continue next; } return derivedType; } return cacheDerivedType(keyType, new IntersectionTypeBinding18(intersectingTypes, this.environment)); }
public ParameterizedTypeBinding getParameterizedType(ReferenceBinding genericType, TypeBinding[] typeArguments, ReferenceBinding enclosingType) { ReferenceBinding unannotatedGenericType = (ReferenceBinding) getUnannotatedType(genericType); int typeArgumentsLength = typeArguments == null ? 0: typeArguments.length; TypeBinding [] unannotatedTypeArguments = typeArguments == null ? null : new TypeBinding[typeArgumentsLength]; for (int i = 0; i < typeArgumentsLength; i++) { unannotatedTypeArguments[i] = getUnannotatedType(typeArguments[i]); } ReferenceBinding unannotatedEnclosingType = enclosingType == null ? null : (ReferenceBinding) getUnannotatedType(enclosingType); ParameterizedTypeBinding parameterizedType = this.parameterizedTypes.get(unannotatedGenericType, unannotatedTypeArguments, unannotatedEnclosingType, Binding.NO_ANNOTATIONS); if (parameterizedType != null) return parameterizedType; parameterizedType = new ParameterizedTypeBinding(unannotatedGenericType, unannotatedTypeArguments, unannotatedEnclosingType, this.environment); cacheDerivedType(unannotatedGenericType, parameterizedType); this.parameterizedTypes.put(genericType, typeArguments, enclosingType, parameterizedType); int typesLength = this.types.length; if (this.typeid == typesLength) System.arraycopy(this.types, 0, this.types = new TypeBinding[typesLength * 2][], 0, typesLength); this.types[this.typeid] = new TypeBinding[1]; return (ParameterizedTypeBinding) (this.types[parameterizedType.id = this.typeid++][0] = parameterizedType); }
public AnnotationBinding getNonNullAnnotation() { if (this.nonNullAnnotation != null) return this.nonNullAnnotation; ReferenceBinding nonNull = getResolvedType(this.globalOptions.nonNullAnnotationName, null); return this.nonNullAnnotation = this.typeSystem.getAnnotationType(nonNull, true); }
public ArrayBinding createArrayType(TypeBinding leafComponentType, int dimensionCount) { return this.typeSystem.getArrayType(leafComponentType, dimensionCount); }
public RawTypeBinding getRawType(ReferenceBinding genericType, ReferenceBinding enclosingType, AnnotationBinding[] annotations) { return getRawType(genericType, enclosingType); }
public ReferenceBinding createMemberType(ReferenceBinding memberType, ReferenceBinding enclosingType) { return this.typeSystem.getMemberType(memberType, enclosingType); } public ParameterizedTypeBinding createParameterizedType(ReferenceBinding genericType, TypeBinding[] typeArguments, ReferenceBinding enclosingType) {
public ParameterizedTypeBinding createParameterizedType(ReferenceBinding genericType, TypeBinding[] typeArguments, ReferenceBinding enclosingType, AnnotationBinding [] annotations) { return this.typeSystem.getParameterizedType(genericType, typeArguments, enclosingType, annotations); } public ReferenceBinding maybeCreateParameterizedType(ReferenceBinding nonGenericType, ReferenceBinding enclosingType) {
public LookupEnvironment(ITypeRequestor typeRequestor, CompilerOptions globalOptions, ProblemReporter problemReporter, INameEnvironment nameEnvironment) { this.typeRequestor = typeRequestor; this.globalOptions = globalOptions; this.problemReporter = problemReporter; this.defaultPackage = new PackageBinding(this); // assume the default package always exists this.defaultImports = null; this.nameEnvironment = nameEnvironment; this.knownPackages = new HashtableOfPackage(); this.uniqueParameterizedGenericMethodBindings = new SimpleLookupTable(3); this.uniquePolymorphicMethodBindings = new SimpleLookupTable(3); this.missingTypes = null; this.accessRestrictions = new HashMap(3); this.classFilePool = ClassFilePool.newInstance(); this.typesBeingConnected = new HashSet<>(); this.typeSystem = this.globalOptions.sourceLevel >= ClassFileConstants.JDK1_8 && this.globalOptions.storeAnnotations ? new AnnotatableTypeSystem(this) : new TypeSystem(this); }
@Override protected TypeBinding[] getDerivedTypesForDeferredInitialization() { TypeBinding[] derived = this.environment.typeSystem.getDerivedTypes(this); if (derived.length > 0) { int count = 0; for (int i = 0; i < derived.length; i++) { if (derived[i] != null && derived[i].id == this.id) derived[count++] = derived[i]; } if (count < derived.length) System.arraycopy(derived, 0, derived = new TypeBinding[count], 0, count); } return derived; }
public final TypeBinding getIntersectionType18(ReferenceBinding[] intersectingTypes) { int intersectingTypesLength = intersectingTypes == null ? 0 : intersectingTypes.length; if (intersectingTypesLength == 0) return null; TypeBinding keyType = intersectingTypes[0]; if (keyType == null || intersectingTypesLength == 1) return keyType; TypeBinding[] derivedTypes = getDerivedTypes(keyType); int i, length = derivedTypes.length; next: for (i = 0; i < length; i++) { TypeBinding derivedType = derivedTypes[i]; if (derivedType == null) break; if (!derivedType.isIntersectionType18()) continue; ReferenceBinding [] priorIntersectingTypes = derivedType.getIntersectingTypes(); if (priorIntersectingTypes.length != intersectingTypesLength) continue; for (int j = 0; j < intersectingTypesLength; j++) { if (intersectingTypes[j] != priorIntersectingTypes[j]) //$IDENTITY-COMPARISON$ continue next; } return derivedType; } return cacheDerivedType(keyType, new IntersectionTypeBinding18(intersectingTypes, this.environment)); }
public ParameterizedTypeBinding getParameterizedType(ReferenceBinding genericType, TypeBinding[] typeArguments, ReferenceBinding enclosingType) { ReferenceBinding unannotatedGenericType = (ReferenceBinding) getUnannotatedType(genericType); int typeArgumentsLength = typeArguments == null ? 0: typeArguments.length; TypeBinding [] unannotatedTypeArguments = typeArguments == null ? null : new TypeBinding[typeArgumentsLength]; for (int i = 0; i < typeArgumentsLength; i++) { unannotatedTypeArguments[i] = getUnannotatedType(typeArguments[i]); } ReferenceBinding unannotatedEnclosingType = enclosingType == null ? null : (ReferenceBinding) getUnannotatedType(enclosingType); ParameterizedTypeBinding parameterizedType = this.parameterizedTypes.get(unannotatedGenericType, unannotatedTypeArguments, unannotatedEnclosingType, Binding.NO_ANNOTATIONS); if (parameterizedType != null) return parameterizedType; parameterizedType = new ParameterizedTypeBinding(unannotatedGenericType, unannotatedTypeArguments, unannotatedEnclosingType, this.environment); cacheDerivedType(unannotatedGenericType, parameterizedType); this.parameterizedTypes.put(genericType, typeArguments, enclosingType, parameterizedType); int typesLength = this.types.length; if (this.typeid == typesLength) System.arraycopy(this.types, 0, this.types = new TypeBinding[typesLength * 2][], 0, typesLength); this.types[this.typeid] = new TypeBinding[1]; return (ParameterizedTypeBinding) (this.types[parameterizedType.id = this.typeid++][0] = parameterizedType); }
public AnnotationBinding createUnresolvedAnnotation(ReferenceBinding annotationType, ElementValuePair[] pairs) { if (pairs.length != 0) { return new UnresolvedAnnotationBinding(annotationType, pairs, this); } return this.typeSystem.getAnnotationType(annotationType, false); }
public ArrayBinding createArrayType(TypeBinding leafComponentType, int dimensionCount, AnnotationBinding [] annotations) { return this.typeSystem.getArrayType(leafComponentType, dimensionCount, annotations); }
public RawTypeBinding createRawType(ReferenceBinding genericType, ReferenceBinding enclosingType, AnnotationBinding [] annotations) { return this.typeSystem.getRawType(genericType, enclosingType, annotations); }
public ReferenceBinding createMemberType(ReferenceBinding memberType, ReferenceBinding enclosingType) { return this.typeSystem.getMemberType(memberType, enclosingType); } public ParameterizedTypeBinding createParameterizedType(ReferenceBinding genericType, TypeBinding[] typeArguments, ReferenceBinding enclosingType) {
public ParameterizedTypeBinding getParameterizedType(ReferenceBinding genericType, TypeBinding[] typeArguments, ReferenceBinding enclosingType, AnnotationBinding[] annotations) { return getParameterizedType(genericType, typeArguments, enclosingType); }
public LookupEnvironment(ITypeRequestor typeRequestor, CompilerOptions globalOptions, ProblemReporter problemReporter, INameEnvironment nameEnvironment) { this.typeRequestor = typeRequestor; this.globalOptions = globalOptions; this.problemReporter = problemReporter; this.defaultPackage = new PackageBinding(this); // assume the default package always exists this.defaultImports = null; this.nameEnvironment = nameEnvironment; this.knownPackages = new HashtableOfPackage(); this.uniqueParameterizedGenericMethodBindings = new SimpleLookupTable(3); this.uniquePolymorphicMethodBindings = new SimpleLookupTable(3); this.missingTypes = null; this.accessRestrictions = new HashMap(3); this.classFilePool = ClassFilePool.newInstance(); this.typesBeingConnected = new HashSet<>(); this.typeSystem = this.globalOptions.sourceLevel >= ClassFileConstants.JDK1_8 && this.globalOptions.storeAnnotations ? new AnnotatableTypeSystem(this) : new TypeSystem(this); }