@Override public void checkBounds(Scope scope) { if (this.resolvedType == null) return; if (this.resolvedType.leafComponentType() instanceof ParameterizedTypeBinding) { ParameterizedTypeBinding parameterizedType = (ParameterizedTypeBinding) this.resolvedType.leafComponentType(); TypeBinding[] argTypes = parameterizedType.arguments; if (argTypes != null) { // may be null in error cases parameterizedType.boundCheck(scope, this.typeArguments); } } }
public void notAnnotationType(TypeBinding actualType, ASTNode location) { this.handle( IProblem.NotAnnotationType, new String[] {new String(actualType.leafComponentType().readableName())}, new String[] {new String(actualType.leafComponentType().shortReadableName())}, location.sourceStart, location.sourceEnd); } public void typeMismatchError(TypeBinding actualType, TypeBinding expectedType, ASTNode location, ASTNode expectingLocation) {
public void notAnnotationType(TypeBinding actualType, ASTNode location) { this.handle( IProblem.NotAnnotationType, new String[] {new String(actualType.leafComponentType().readableName())}, new String[] {new String(actualType.leafComponentType().shortReadableName())}, location.sourceStart, location.sourceEnd); } public void typeMismatchError(TypeBinding actualType, TypeBinding expectedType, ASTNode location, ASTNode expectingLocation) {
public void notAnnotationType(TypeBinding actualType, ASTNode location) { this.handle( IProblem.NotAnnotationType, new String[] {new String(actualType.leafComponentType().readableName())}, new String[] {new String(actualType.leafComponentType().shortReadableName())}, location.sourceStart, location.sourceEnd); } public void typeMismatchError(TypeBinding actualType, TypeBinding expectedType, ASTNode location, ASTNode expectingLocation) {
arrayref = tmp; arrayref.setComponentType(getTypeReference(binding.leafComponentType(), resolveGeneric)); } else if (binding instanceof PolyTypeBinding) {
@Override public void checkBounds(Scope scope) { if (this.resolvedType == null || !this.resolvedType.isValidBinding()) return; checkBounds( (ReferenceBinding) this.resolvedType.leafComponentType(), scope, this.typeArguments.length - 1); } public void checkBounds(ReferenceBinding type, Scope scope, int index) {
public final boolean isMain() { if (this.selector.length == 4 && CharOperation.equals(this.selector, TypeConstants.MAIN) && ((this.modifiers & (ClassFileConstants.AccPublic | ClassFileConstants.AccStatic)) != 0) && TypeBinding.VOID == this.returnType && this.parameters.length == 1) { TypeBinding paramType = this.parameters[0]; if (paramType.dimensions() == 1 && paramType.leafComponentType().id == TypeIds.T_JavaLangString) { return true; } } return false; }
public void anonymousDiamondWithNonDenotableTypeArguments(TypeReference type, TypeBinding tb) { this.handle( IProblem.NonDenotableTypeArgumentForAnonymousDiamond, new String[]{new String(tb.leafComponentType().shortReadableName()), type.toString()}, new String[]{new String(tb.leafComponentType().shortReadableName()), type.toString()}, type.sourceStart, type.sourceEnd); } public void redundantSpecificationOfTypeArguments(ASTNode location, TypeBinding[] argumentTypes) {
public final boolean isMain() { if (this.selector.length == 4 && CharOperation.equals(this.selector, TypeConstants.MAIN) && ((this.modifiers & (ClassFileConstants.AccPublic | ClassFileConstants.AccStatic)) != 0) && TypeBinding.VOID == this.returnType && this.parameters.length == 1) { TypeBinding paramType = this.parameters[0]; if (paramType.dimensions() == 1 && paramType.leafComponentType().id == TypeIds.T_JavaLangString) { return true; } } return false; }
public int literalIndex(TypeBinding binding) { TypeBinding typeBinding = binding.leafComponentType(); if ((typeBinding.tagBits & TagBits.ContainsNestedTypeReferences) != 0) { Util.recordNestedType(this.classFile, typeBinding); } return literalIndex(binding.signature()); } /**
public int literalIndexForType(final TypeBinding binding) { TypeBinding typeBinding = binding.leafComponentType(); if ((typeBinding.tagBits & TagBits.ContainsNestedTypeReferences) != 0) { Util.recordNestedType(this.classFile, typeBinding); } return this.literalIndexForType(binding.constantPoolName()); } public int literalIndexForMethod(char[] declaringClass, char[] selector, char[] signature, boolean isInterface) {
public int literalIndexForType(final TypeBinding binding) { TypeBinding typeBinding = binding.leafComponentType(); if ((typeBinding.tagBits & TagBits.ContainsNestedTypeReferences) != 0) { Util.recordNestedType(this.classFile, typeBinding); } return this.literalIndexForType(binding.constantPoolName()); } public int literalIndexForMethod(char[] declaringClass, char[] selector, char[] signature, boolean isInterface) {
public int literalIndex(TypeBinding binding) { TypeBinding typeBinding = binding.leafComponentType(); if ((typeBinding.tagBits & TagBits.ContainsNestedTypeReferences) != 0) { Util.recordNestedType(this.classFile, typeBinding); } return literalIndex(binding.signature()); } /**
public int literalIndexForType(final TypeBinding binding) { TypeBinding typeBinding = binding.leafComponentType(); if ((typeBinding.tagBits & TagBits.ContainsNestedTypeReferences) != 0) { Util.recordNestedType(this.classFile, typeBinding); } return this.literalIndexForType(binding.constantPoolName()); } public int literalIndexForMethod(char[] declaringClass, char[] selector, char[] signature, boolean isInterface) {
public void rawTypeReference(ASTNode location, TypeBinding type) { if (this.options.sourceLevel < ClassFileConstants.JDK1_5) return; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=305259 type = type.leafComponentType(); this.handle( IProblem.RawTypeReference, new String[] {new String(type.readableName()), new String(type.erasure().readableName()), }, new String[] {new String(type.shortReadableName()),new String(type.erasure().shortReadableName()),}, location.sourceStart, nodeSourceEnd(null, location, Integer.MAX_VALUE)); } public void recursiveConstructorInvocation(ExplicitConstructorCall constructorCall) {
protected void checkIllegalNullAnnotation(Scope scope) { if (this.resolvedType.leafComponentType().isBaseType() && hasNullTypeAnnotation(AnnotationPosition.LEAF_TYPE)) scope.problemReporter().illegalAnnotationForBaseType(this, this.annotations[0], this.resolvedType.tagBits & TagBits.AnnotationNullMASK); } /** Retrieve the null annotation that has been translated to the given nullTagBits. */
protected void checkIllegalNullAnnotation(Scope scope) { if (this.resolvedType.leafComponentType().isBaseType() && hasNullTypeAnnotation(AnnotationPosition.LEAF_TYPE)) scope.problemReporter().illegalAnnotationForBaseType(this, this.annotations[0], this.resolvedType.tagBits & TagBits.AnnotationNullMASK); } /** Retrieve the null annotation that has been translated to the given nullTagBits. */
@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; }
public MethodBinding findMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite, boolean inStaticContext) { MethodBinding method = findMethod0(receiverType, selector, argumentTypes, invocationSite, inStaticContext); if (method != null && method.isValidBinding() && method.isVarargs()) { TypeBinding elementType = method.parameters[method.parameters.length - 1].leafComponentType(); if (elementType instanceof ReferenceBinding) { if (!((ReferenceBinding) elementType).canBeSeenBy(this)) { return new ProblemMethodBinding(method, method.selector, invocationSite.genericTypeArguments(), ProblemReasons.VarargsElementTypeNotVisible); } } } return method; }