private TypeBinding getArrayBinding(int dim, TypeBinding binding) { if (binding == null) return null; if (dim == 0) return binding; return this.environment.createArrayType(binding, dim); }
public TypeBinding elementsType() { if (this.dimensions == 1) return this.leafComponentType; return this.environment.createArrayType(this.leafComponentType, this.dimensions - 1); } /**
TypeBinding substituteInferenceVariable(InferenceVariable var, TypeBinding substituteType) { TypeBinding substitutedLeaf = this.leafComponentType.substituteInferenceVariable(var, substituteType); if (TypeBinding.notEquals(substitutedLeaf, this.leafComponentType)) return this.environment.createArrayType(substitutedLeaf, this.dimensions, this.typeAnnotations); return this; }
@Override public TypeBinding withoutToplevelNullAnnotation() { if (!hasNullTypeAnnotations()) return this; AnnotationBinding[] newAnnotations = this.environment.filterNullTypeAnnotations(this.typeAnnotations); return this.environment.createArrayType(this.leafComponentType, this.dimensions, newAnnotations); } @Override
@Override public TypeBinding uncapture(Scope scope) { if ((this.tagBits & TagBits.HasCapturedWildcard) == 0) return this; TypeBinding leafType = this.leafComponentType.uncapture(scope); return scope.environment().createArrayType(leafType, this.dimensions, this.typeAnnotations); } @Override
@Override public ArrayBinding upwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) { TypeBinding leafType = this.leafComponentType.upwardsProjection(scope, mentionedTypeVariables); return scope.environment().createArrayType(leafType, this.dimensions, this.typeAnnotations); }
@Override public ArrayBinding downwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) { TypeBinding leafType = this.leafComponentType.downwardsProjection(scope, mentionedTypeVariables); return scope.environment().createArrayType(leafType, this.dimensions, this.typeAnnotations); }
@Override TypeBinding substituteInferenceVariable(InferenceVariable var, TypeBinding substituteType) { TypeBinding substitutedLeaf = this.leafComponentType.substituteInferenceVariable(var, substituteType); if (TypeBinding.notEquals(substitutedLeaf, this.leafComponentType)) return this.environment.createArrayType(substitutedLeaf, this.dimensions, this.typeAnnotations); return this; }
/** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#erasure() */ @Override public TypeBinding erasure() { TypeBinding erasedType = this.leafComponentType.erasure(); if (TypeBinding.notEquals(this.leafComponentType, erasedType)) return this.environment.createArrayType(erasedType, this.dimensions); return this; }
TypeBinding substituteInferenceVariable(InferenceVariable var, TypeBinding substituteType) { TypeBinding substitutedLeaf = this.leafComponentType.substituteInferenceVariable(var, substituteType); if (TypeBinding.notEquals(substitutedLeaf, this.leafComponentType)) return this.environment.createArrayType(substitutedLeaf, this.dimensions, this.typeAnnotations); return this; }
@Override public TypeBinding uncapture(Scope scope) { if ((this.tagBits & TagBits.HasCapturedWildcard) == 0) return this; TypeBinding leafType = this.leafComponentType.uncapture(scope); return scope.environment().createArrayType(leafType, this.dimensions, this.typeAnnotations); }
@Override public TypeBinding uncapture(Scope scope) { if ((this.tagBits & TagBits.HasCapturedWildcard) == 0) return this; TypeBinding leafType = this.leafComponentType.uncapture(scope); return scope.environment().createArrayType(leafType, this.dimensions, this.typeAnnotations); } @Override
public TypeBinding closestMatch() { if (isValidBinding()) { return this; } TypeBinding leafClosestMatch = this.leafComponentType.closestMatch(); if (leafClosestMatch == null) { return null; } return this.environment.createArrayType(this.leafComponentType.closestMatch(), this.dimensions); }
private TypeBinding peelOneDimension(TypeBinding arrayType, LookupEnvironment env) { if (arrayType.dimensions() == 1) return arrayType.leafComponentType(); return env.createArrayType(arrayType.leafComponentType(), arrayType.dimensions()-1); }
public ArrayBinding createArrayType(TypeBinding type, int dimension, AnnotationBinding[] annotations) { if (type.isValidBinding()) return environment().createArrayType(type, dimension, annotations); // do not cache obvious invalid types return new ArrayBinding(type, dimension, environment()); }
public ArrayBinding createArrayType(TypeBinding type, int dimension, AnnotationBinding[] annotations) { if (type.isValidBinding()) return environment().createArrayType(type, dimension, annotations); // do not cache obvious invalid types return new ArrayBinding(type, dimension, environment()); }
public ArrayBinding createArrayType(TypeBinding type, int dimension) { if (type.isValidBinding()) return environment().createArrayType(type, dimension); // do not cache obvious invalid types return new ArrayBinding(type, dimension, environment()); }
public ArrayBinding createArrayType(TypeBinding type, int dimension, AnnotationBinding[] annotations) { if (type.isValidBinding()) return environment().createArrayType(type, dimension, annotations); // do not cache obvious invalid types return new ArrayBinding(type, dimension, environment()); }
@Override public ArrayType getArrayType(TypeMirror componentType) { TypeMirrorImpl typeMirrorImpl = (TypeMirrorImpl) componentType; TypeBinding typeBinding = (TypeBinding) typeMirrorImpl._binding; return (ArrayType) _env.getFactory().newTypeMirror( this._env.getLookupEnvironment().createArrayType( typeBinding.leafComponentType(), typeBinding.dimensions() + 1)); }
private static TypeBinding getRealErasure(TypeBinding type, LookupEnvironment environment) { TypeBinding erasure = type.erasure(); // could still be / contain a generic type that needs to be converted to raw: TypeBinding erasedLeaf = erasure.leafComponentType(); if (erasedLeaf.isGenericType()) erasedLeaf = environment.convertToRawType(erasedLeaf, false); if (erasure.isArrayType()) return environment.createArrayType(erasedLeaf, erasure.dimensions()); return erasedLeaf; }