/** * Substitute any type variables mentioned in 'type' by the corresponding inference variable, if one exists. */ public TypeBinding substitute(TypeBinding type) { InferenceSubstitution inferenceSubstitution = new InferenceSubstitution(this); return inferenceSubstitution.substitute(inferenceSubstitution, type); }
InferenceSubstitution enrichSubstitution(InferenceSubstitution substitution, Invocation innerInvocation, MethodBinding innerMethod) { if (innerMethod instanceof ParameterizedGenericMethodBinding) { InferenceContext18 innerContext = innerInvocation.getInferenceContext((ParameterizedMethodBinding) innerMethod); if (innerContext != null) return substitution.addContext(innerContext); } return substitution; }
InferenceSubstitution subst = new InferenceSubstitution(this.environment, null, null) {
static TypeBound createBoundOrDependency(InferenceSubstitution theta, TypeBinding type, InferenceVariable variable) { // Part of JLS8 sect 18.1.3: return new TypeBound(variable, theta.substitute(theta, type), SUBTYPE, true); }
/** * Override method {@link Scope.Substitutor#substitute(Substitution, TypeBinding)}, * to add substitution of types other than type variables. */ public TypeBinding substitute(Substitution substitution, TypeBinding originalType) { for (int i = 0; i < this.variables.length; i++) { InferenceVariable variable = this.variables[i]; if (TypeBinding.equalsEquals(getP(i), originalType)) { variable.nullHints |= originalType.tagBits & TagBits.AnnotationNullMASK; return variable; } } return super.substitute(substitution, originalType); }
/** * Override method {@link Scope.Substitutor#substitute(Substitution, TypeBinding)}, * to add substitution of types other than type variables. */ public TypeBinding substitute(Substitution substitution, TypeBinding originalType) { for (int i = 0; i < this.variables.length; i++) { InferenceVariable variable = this.variables[i]; if (isInSites(variable.site) && isSameParameter(getP(i), originalType)) { if (this.environment.globalOptions.isAnnotationBasedNullAnalysisEnabled && originalType.hasNullTypeAnnotations()) return this.environment.createAnnotatedType(variable.withoutToplevelNullAnnotation(), originalType.getTypeAnnotations()); return variable; } } return super.substitute(substitution, originalType); }
InferenceSubstitution subst = new InferenceSubstitution(this.environment, null, null) {
static TypeBound createBoundOrDependency(InferenceSubstitution theta, TypeBinding type, InferenceVariable variable) { // Part of JLS8 sect 18.1.3: return new TypeBound(variable, theta.substitute(theta, type), SUBTYPE, true); }
/** * Override method {@link Scope.Substitutor#substitute(Substitution, TypeBinding)}, * to add substitution of types other than type variables. */ public TypeBinding substitute(Substitution substitution, TypeBinding originalType) { for (int i = 0; i < this.variables.length; i++) { InferenceVariable variable = this.variables[i]; if (TypeBinding.equalsEquals(getP(i), originalType)) { variable.nullHints |= originalType.tagBits & TagBits.AnnotationNullMASK; return variable; } } return super.substitute(substitution, originalType); }
/** * Override method {@link Scope.Substitutor#substitute(Substitution, TypeBinding)}, * to add substitution of types other than type variables. */ @Override public TypeBinding substitute(Substitution substitution, TypeBinding originalType) { for (int i = 0; i < this.variables.length; i++) { InferenceVariable variable = this.variables[i]; if (isInSites(variable.site) && isSameParameter(getP(i), originalType)) { if (this.environment.globalOptions.isAnnotationBasedNullAnalysisEnabled && originalType.hasNullTypeAnnotations()) return this.environment.createAnnotatedType(variable.withoutToplevelNullAnnotation(), originalType.getTypeAnnotations()); return variable; } } return super.substitute(substitution, originalType); }
/** * Substitute any type variables mentioned in 'type' by the corresponding inference variable, if one exists. */ public TypeBinding substitute(TypeBinding type) { InferenceSubstitution inferenceSubstitution = new InferenceSubstitution(this); return inferenceSubstitution.substitute(inferenceSubstitution, type); }
public void addBoundsFromTypeParameters(InferenceContext18 context, TypeVariableBinding[] typeParameters, InferenceVariable[] variables) { int length = typeParameters.length; for (int i = 0; i < length; i++) { TypeVariableBinding typeParameter = typeParameters[i]; InferenceVariable variable = variables[i]; TypeBound[] someBounds = typeParameter.getTypeBounds(variable, new InferenceSubstitution(context)); boolean hasProperBound = false; if (someBounds.length > 0) hasProperBound = addBounds(someBounds, context.environment); if (!hasProperBound) addBound(new TypeBound(variable, context.object, ReductionResult.SUBTYPE), context.environment); } }
static TypeBound createBoundOrDependency(InferenceSubstitution theta, TypeBinding type, InferenceVariable variable) { // Part of JLS8 sect 18.1.3: return new TypeBound(variable, theta.substitute(theta, type), SUBTYPE, true); }
/** * Override method {@link Scope.Substitutor#substitute(Substitution, TypeBinding)}, * to add substitution of types other than type variables. */ public TypeBinding substitute(Substitution substitution, TypeBinding originalType) { for (int i = 0; i < this.variables.length; i++) { InferenceVariable variable = this.variables[i]; if (TypeBinding.equalsEquals(getP(i), originalType)) { variable.nullHints |= originalType.tagBits & TagBits.AnnotationNullMASK; return variable; } } return super.substitute(substitution, originalType); }
InferenceSubstitution enrichSubstitution(InferenceSubstitution substitution, Invocation innerInvocation, MethodBinding innerMethod) { if (innerMethod instanceof ParameterizedGenericMethodBinding) { InferenceContext18 innerContext = innerInvocation.getInferenceContext((ParameterizedMethodBinding) innerMethod); if (innerContext != null) return substitution.addContext(innerContext); } return substitution; }
/** * Substitute any type variables mentioned in 'type' by the corresponding inference variable, if one exists. */ public TypeBinding substitute(TypeBinding type) { InferenceSubstitution inferenceSubstitution = new InferenceSubstitution(this); return inferenceSubstitution.substitute(inferenceSubstitution, type); }
public void addBoundsFromTypeParameters(InferenceContext18 context, TypeVariableBinding[] typeParameters, InferenceVariable[] variables) { int length = typeParameters.length; for (int i = 0; i < length; i++) { TypeVariableBinding typeParameter = typeParameters[i]; InferenceVariable variable = variables[i]; TypeBound[] someBounds = typeParameter.getTypeBounds(variable, new InferenceSubstitution(context)); boolean hasProperBound = false; if (someBounds.length > 0) hasProperBound = addBounds(someBounds, context.environment); if (!hasProperBound) addBound(new TypeBound(variable, context.object, ReductionResult.SUBTYPE), context.environment); } }
static TypeBound createBoundOrDependency(InferenceSubstitution theta, TypeBinding type, InferenceVariable variable) { // Part of JLS8 sect 18.1.3: return new TypeBound(variable, theta.substitute(theta, type), SUBTYPE, true); }
variableLoop: for (int i = 0; i < this.variables.length; i++) { InferenceVariable variable = this.variables[i]; TypeBinding pi = getP(i); if (TypeBinding.equalsEquals(pi, typeVariable)) return variable;
/** * Substitute any type variables mentioned in 'type' by the corresponding inference variable, if one exists. */ public TypeBinding substitute(TypeBinding type) { InferenceSubstitution inferenceSubstitution = new InferenceSubstitution(this); return inferenceSubstitution.substitute(inferenceSubstitution, type); }