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; } }
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; } }
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; } }
/** * Forcefully register the given type as a derived type. * If it itself is already registered as the key unannotated type of its family, * create a clone to play that role from now on and swap types in the types cache. */ public void forceRegisterAsDerived(TypeBinding derived) { int id = derived.id; if (id != TypeIds.NoId && this.types[id] != null) { TypeBinding unannotated = this.types[id][0]; if (unannotated == derived) { //$IDENTITY-COMPARISON$ // was previously registered as unannotated, replace by a fresh clone to remain unannotated: this.types[id][0] = unannotated = derived.clone(null); } // proceed as normal: cacheDerivedType(unannotated, derived); } else { throw new IllegalStateException("Type was not yet registered as expected: "+derived); //$NON-NLS-1$ } }
/** * Forcefully register the given type as a derived type. * If it itself is already registered as the key unannotated type of its family, * create a clone to play that role from now on and swap types in the types cache. */ public void forceRegisterAsDerived(TypeBinding derived) { int id = derived.id; if (id != TypeIds.NoId && this.types[id] != null) { TypeBinding unannotated = this.types[id][0]; if (unannotated == derived) { //$IDENTITY-COMPARISON$ // was previously registered as unannotated, replace by a fresh clone to remain unannotated: this.types[id][0] = unannotated = derived.clone(null); } // proceed as normal: cacheDerivedType(unannotated, derived); } else { throw new IllegalStateException("Type was not yet registered as expected: "+derived); //$NON-NLS-1$ } }
/** * Forcefully register the given type as a derived type. * If it itself is already registered as the key unannotated type of its family, * create a clone to play that role from now on and swap types in the types cache. */ public void forceRegisterAsDerived(TypeBinding derived) { int id = derived.id; if (id != TypeIds.NoId && this.types[id] != null) { TypeBinding unannotated = this.types[id][0]; if (unannotated == derived) { //$IDENTITY-COMPARISON$ // was previously registered as unannotated, replace by a fresh clone to remain unannotated: this.types[id][0] = unannotated = derived.clone(null); } // proceed as normal: cacheDerivedType(unannotated, derived); } else { throw new IllegalStateException("Type was not yet registered as expected: "+derived); //$NON-NLS-1$ } }
/** * Forcefully register the given type as a derived type. * If it itself is already registered as the key unannotated type of its family, * create a clone to play that role from now on and swap types in the types cache. */ public void forceRegisterAsDerived(TypeBinding derived) { int id = derived.id; if (id != TypeIds.NoId && this.types[id] != null) { TypeBinding unannotated = this.types[id][0]; if (unannotated == derived) { //$IDENTITY-COMPARISON$ // was previously registered as unannotated, replace by a fresh clone to remain unannotated: this.types[id][0] = unannotated = derived.clone(null); } // proceed as normal: cacheDerivedType(unannotated, derived); } else { throw new IllegalStateException("Type was not yet registered as expected: "+derived); //$NON-NLS-1$ } }
/** * Forcefully register the given type as a derived type. * If it itself is already registered as the key unannotated type of its family, * create a clone to play that role from now on and swap types in the types cache. */ public void forceRegisterAsDerived(TypeBinding derived) { int id = derived.id; if (id != TypeIds.NoId && this.types[id] != null) { TypeBinding unannotated = this.types[id][0]; if (unannotated == derived) { //$IDENTITY-COMPARISON$ // was previously registered as unannotated, replace by a fresh clone to remain unannotated: this.types[id][0] = unannotated = derived.clone(null); } // proceed as normal: cacheDerivedType(unannotated, derived); } else { throw new IllegalStateException("Type was not yet registered as expected: "+derived); //$NON-NLS-1$ } }
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 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 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 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 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 final TypeBinding getIntersectionCastType(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.isIntersectionCastType()) 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 IntersectionCastTypeBinding(intersectingTypes, this.environment)); } }
public CaptureBinding(WildcardBinding wildcard, ReferenceBinding sourceType, int start, int end, ASTNode cud, int captureID) { super(TypeConstants.WILDCARD_CAPTURE_NAME_PREFIX, wildcard.environment); this.wildcard = wildcard; this.modifiers = ClassFileConstants.AccPublic | ExtraCompilerModifiers.AccGenericSignature; // treat capture as public this.fPackage = wildcard.fPackage; this.sourceType = sourceType; this.start = start; this.end = end; this.captureID = captureID; this.tagBits |= TagBits.HasCapturedWildcard; this.cud = cud; if (wildcard.hasTypeAnnotations()) { // register an unannoted version before adding the annotated wildcard: CaptureBinding unannotated = (CaptureBinding) clone(null); unannotated.wildcard = (WildcardBinding) this.wildcard.unannotated(); this.environment.getUnannotatedType(unannotated); this.id = unannotated.id; // transfer fresh id // now register this annotated type: this.environment.typeSystem.cacheDerivedType(this, unannotated, this); // propagate from wildcard to capture - use super version, because our own method propagates type annotations in the opposite direction: super.setTypeAnnotations(wildcard.getTypeAnnotations(), wildcard.environment.globalOptions.isAnnotationBasedNullAnalysisEnabled); if (wildcard.hasNullTypeAnnotations()) this.tagBits |= TagBits.HasNullTypeAnnotation; } else { computeId(this.environment); } }
public CaptureBinding(WildcardBinding wildcard, ReferenceBinding sourceType, int start, int end, ASTNode cud, int captureID) { super(TypeConstants.WILDCARD_CAPTURE_NAME_PREFIX, wildcard.environment); this.wildcard = wildcard; this.modifiers = ClassFileConstants.AccPublic | ExtraCompilerModifiers.AccGenericSignature; // treat capture as public this.fPackage = wildcard.fPackage; this.sourceType = sourceType; this.start = start; this.end = end; this.captureID = captureID; this.tagBits |= TagBits.HasCapturedWildcard; this.cud = cud; if (wildcard.hasTypeAnnotations()) { // register an unannoted version before adding the annotated wildcard: CaptureBinding unannotated = (CaptureBinding) clone(null); unannotated.wildcard = (WildcardBinding) this.wildcard.unannotated(); this.environment.getUnannotatedType(unannotated); this.id = unannotated.id; // transfer fresh id // now register this annotated type: this.environment.typeSystem.cacheDerivedType(this, unannotated, this); // propagate from wildcard to capture - use super version, because our own method propagates type annotations in the opposite direction: super.setTypeAnnotations(wildcard.getTypeAnnotations(), wildcard.environment.globalOptions.isAnnotationBasedNullAnalysisEnabled); if (wildcard.hasNullTypeAnnotations()) this.tagBits |= TagBits.HasNullTypeAnnotation; } else { computeId(this.environment); } }
this.id = unannotated.id; // transfer fresh id this.environment.typeSystem.cacheDerivedType(this, unannotated, this);