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; }
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; }
/** * Returns true if the type is parameterized using its own type variables as arguments */ public boolean isParameterizedWithOwnVariables() { if (kind() != Binding.PARAMETERIZED_TYPE) return false; ParameterizedTypeBinding paramType = (ParameterizedTypeBinding) this; if (paramType.arguments == null) return false; TypeVariableBinding[] variables = erasure().typeVariables(); for (int i = 0, length = variables.length; i < length; i++) { if (variables[i] != paramType.arguments[i]) return false; } ReferenceBinding enclosing = paramType.enclosingType(); if (enclosing != null && enclosing.erasure().isGenericType() && !enclosing.isParameterizedWithOwnVariables()) { return false; } return true; }
/** * Returns true if the type is parameterized using its own type variables as arguments */ public boolean isParameterizedWithOwnVariables() { if (kind() != Binding.PARAMETERIZED_TYPE) return false; ParameterizedTypeBinding paramType = (ParameterizedTypeBinding) this; if (paramType.arguments == null) return false; TypeVariableBinding[] variables = erasure().typeVariables(); for (int i = 0, length = variables.length; i < length; i++) { if (variables[i] != paramType.arguments[i]) return false; } ReferenceBinding enclosing = paramType.enclosingType(); if (enclosing != null && enclosing.erasure().isGenericType() && !enclosing.isParameterizedWithOwnVariables()) { return false; } return true; }
/** * Returns true if the type is parameterized using its own type variables as arguments */ public boolean isParameterizedWithOwnVariables() { if (kind() != Binding.PARAMETERIZED_TYPE) return false; ParameterizedTypeBinding paramType = (ParameterizedTypeBinding) this; if (paramType.arguments == null) return false; TypeVariableBinding[] variables = erasure().typeVariables(); for (int i = 0, length = variables.length; i < length; i++) { if (variables[i] != paramType.arguments[i]) return false; } ReferenceBinding enclosing = paramType.enclosingType(); if (enclosing != null && enclosing.erasure().isGenericType() && !enclosing.isParameterizedWithOwnVariables()) { return false; } return true; }
/** * Returns true if the type is parameterized using its own type variables as arguments */ public boolean isParameterizedWithOwnVariables() { if (kind() != Binding.PARAMETERIZED_TYPE) return false; ParameterizedTypeBinding paramType = (ParameterizedTypeBinding) this; if (paramType.arguments == null) return false; TypeVariableBinding[] variables = erasure().typeVariables(); for (int i = 0, length = variables.length; i < length; i++) { if (TypeBinding.notEquals(variables[i], paramType.arguments[i])) return false; } ReferenceBinding enclosing = paramType.enclosingType(); if (enclosing != null && enclosing.erasure().isGenericType() && !enclosing.isParameterizedWithOwnVariables()) { return false; } return true; }
/** * Returns true if the type is parameterized using its own type variables as arguments */ public boolean isParameterizedWithOwnVariables() { if (kind() != Binding.PARAMETERIZED_TYPE) return false; ParameterizedTypeBinding paramType = (ParameterizedTypeBinding) this; if (paramType.arguments == null) return false; TypeVariableBinding[] variables = erasure().typeVariables(); for (int i = 0, length = variables.length; i < length; i++) { if (TypeBinding.notEquals(variables[i], paramType.arguments[i])) return false; } ReferenceBinding enclosing = paramType.enclosingType(); if (enclosing != null && enclosing.erasure().isGenericType() && !enclosing.isParameterizedWithOwnVariables()) { return false; } return true; }
/** * Returns true if the type is parameterized using its own type variables as arguments */ public boolean isParameterizedWithOwnVariables() { if (kind() != Binding.PARAMETERIZED_TYPE) return false; ParameterizedTypeBinding paramType = (ParameterizedTypeBinding) this; if (paramType.arguments == null) return false; TypeVariableBinding[] variables = erasure().typeVariables(); for (int i = 0, length = variables.length; i < length; i++) { if (TypeBinding.notEquals(variables[i], paramType.arguments[i])) return false; } ReferenceBinding enclosing = paramType.enclosingType(); if (enclosing != null && enclosing.erasure().isGenericType() && !enclosing.isParameterizedWithOwnVariables()) { return false; } return true; }
/** * Returns true if the type is parameterized using its own type variables as arguments */ public boolean isParameterizedWithOwnVariables() { if (kind() != Binding.PARAMETERIZED_TYPE) return false; ParameterizedTypeBinding paramType = (ParameterizedTypeBinding) this; if (paramType.arguments == null) return false; TypeVariableBinding[] variables = erasure().typeVariables(); for (int i = 0, length = variables.length; i < length; i++) { if (TypeBinding.notEquals(variables[i], paramType.arguments[i])) return false; } ReferenceBinding enclosing = paramType.enclosingType(); if (enclosing != null && enclosing.erasure().isGenericType() && !enclosing.isParameterizedWithOwnVariables()) { return false; } return true; }
@Override public TypeMirror erasure(TypeMirror t) { TypeMirrorImpl typeMirrorImpl = (TypeMirrorImpl) t; Binding binding = typeMirrorImpl._binding; if (binding instanceof ReferenceBinding) { TypeBinding type = ((ReferenceBinding) binding).erasure(); if (type.isGenericType()) { type = _env.getLookupEnvironment().convertToRawType(type, false); } return _env.getFactory().newTypeMirror(type); } if (binding instanceof ArrayBinding) { TypeBinding typeBinding = (TypeBinding) binding; TypeBinding leafType = typeBinding.leafComponentType().erasure(); if (leafType.isGenericType()) { leafType = _env.getLookupEnvironment().convertToRawType(leafType, false); } return _env.getFactory().newTypeMirror( this._env.getLookupEnvironment().createArrayType(leafType, typeBinding.dimensions())); } return t; }
/** * Returns true if the type is parameterized using its own type variables as arguments */ public boolean isParameterizedWithOwnVariables() { if (kind() != Binding.PARAMETERIZED_TYPE) return false; ParameterizedTypeBinding paramType = (ParameterizedTypeBinding) this; if (paramType.arguments == null) return false; TypeVariableBinding[] variables = erasure().typeVariables(); for (int i = 0, length = variables.length; i < length; i++) { if (TypeBinding.notEquals(variables[i], paramType.arguments[i])) return false; } ReferenceBinding enclosing = paramType.enclosingType(); if (enclosing != null && enclosing.erasure().isGenericType() && !enclosing.isParameterizedWithOwnVariables()) { return false; } return true; }
@Override public TypeMirror erasure(TypeMirror t) { TypeMirrorImpl typeMirrorImpl = (TypeMirrorImpl) t; Binding binding = typeMirrorImpl._binding; if (binding instanceof ReferenceBinding) { TypeBinding type = ((ReferenceBinding) binding).erasure(); if (type.isGenericType()) { type = _env.getLookupEnvironment().convertToRawType(type, false); } return _env.getFactory().newTypeMirror(type); } if (binding instanceof ArrayBinding) { TypeBinding typeBinding = (TypeBinding) binding; TypeBinding leafType = typeBinding.leafComponentType().erasure(); if (leafType.isGenericType()) { leafType = _env.getLookupEnvironment().convertToRawType(leafType, false); } return _env.getFactory().newTypeMirror( this._env.getLookupEnvironment().createArrayType(leafType, typeBinding.dimensions())); } return t; }
/** * Returns true if the type is parameterized using its own type variables as arguments */ public boolean isParameterizedWithOwnVariables() { if (kind() != Binding.PARAMETERIZED_TYPE) return false; ParameterizedTypeBinding paramType = (ParameterizedTypeBinding) this; if (paramType.arguments == null) return false; TypeVariableBinding[] variables = erasure().typeVariables(); for (int i = 0, length = variables.length; i < length; i++) { if (TypeBinding.notEquals(variables[i], paramType.arguments[i])) return false; } ReferenceBinding enclosing = paramType.enclosingType(); if (enclosing != null && enclosing.erasure().isGenericType() && !enclosing.isParameterizedWithOwnVariables()) { return false; } return true; }
/** * Returns true if the type is parameterized using its own type variables as arguments */ public boolean isParameterizedWithOwnVariables() { if (kind() != Binding.PARAMETERIZED_TYPE) return false; ParameterizedTypeBinding paramType = (ParameterizedTypeBinding) this; if (paramType.arguments == null) return false; TypeVariableBinding[] variables = erasure().typeVariables(); for (int i = 0, length = variables.length; i < length; i++) { if (TypeBinding.notEquals(variables[i], paramType.arguments[i])) return false; } ReferenceBinding enclosing = paramType.enclosingType(); if (enclosing != null && enclosing.erasure().isGenericType() && !enclosing.isParameterizedWithOwnVariables()) { return false; } return true; }
/** * Returns true if the type is parameterized using its own type variables as arguments */ public boolean isParameterizedWithOwnVariables() { if (kind() != Binding.PARAMETERIZED_TYPE) return false; ParameterizedTypeBinding paramType = (ParameterizedTypeBinding) this; if (paramType.arguments == null) return false; TypeVariableBinding[] variables = erasure().typeVariables(); for (int i = 0, length = variables.length; i < length; i++) { if (TypeBinding.notEquals(variables[i], paramType.arguments[i])) return false; } ReferenceBinding enclosing = paramType.enclosingType(); if (enclosing != null && enclosing.erasure().isGenericType() && !enclosing.isParameterizedWithOwnVariables()) { return false; } return true; }
@Override public TypeMirror erasure(TypeMirror t) { validateRealType(t); TypeMirrorImpl typeMirrorImpl = (TypeMirrorImpl) t; Binding binding = typeMirrorImpl._binding; if (binding instanceof ReferenceBinding) { TypeBinding type = ((ReferenceBinding) binding).erasure(); if (type.isGenericType()) { type = _env.getLookupEnvironment().convertToRawType(type, false); } return _env.getFactory().newTypeMirror(type); } if (binding instanceof ArrayBinding) { TypeBinding typeBinding = (TypeBinding) binding; TypeBinding leafType = typeBinding.leafComponentType().erasure(); if (leafType.isGenericType()) { leafType = _env.getLookupEnvironment().convertToRawType(leafType, false); } return _env.getFactory().newTypeMirror( this._env.getLookupEnvironment().createArrayType(leafType, typeBinding.dimensions())); } return t; }
private TypeBinding internalResolveType(Scope scope, boolean checkBounds) { // handle the error here this.constant = Constant.NotAConstant; if (this.resolvedType != null) // is a shared type reference which was already resolved return this.resolvedType.isValidBinding() ? this.resolvedType : this.resolvedType.closestMatch(); // already reported error TypeBinding type = this.resolvedType = getTypeBinding(scope); // End resolution when getTypeBinding(scope) returns null. This may happen in // certain circumstances, typically when an illegal access is done on a type // variable (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=204749) if (type == null) return null; if (!type.isValidBinding()) { Binding binding = scope.getTypeOrPackage(this.tokens); if (binding instanceof PackageBinding) { this.packageBinding = (PackageBinding) binding; // Valid package references are allowed in Javadoc (https://bugs.eclipse.org/bugs/show_bug.cgi?id=281609) } else { reportInvalidType(scope); } return null; } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=209936 // raw convert all enclosing types when dealing with Javadoc references if (type.isGenericType() || type.isParameterizedType()) { this.resolvedType = scope.environment().convertToRawType(type, true /*force the conversion of enclosing types*/); } return this.resolvedType; } protected void reportDeprecatedType(TypeBinding type, Scope scope) {
private TypeBinding internalResolveType(Scope scope, boolean checkBounds) { // handle the error here this.constant = Constant.NotAConstant; if (this.resolvedType != null) // is a shared type reference which was already resolved return this.resolvedType.isValidBinding() ? this.resolvedType : this.resolvedType.closestMatch(); // already reported error TypeBinding type = this.resolvedType = getTypeBinding(scope); // End resolution when getTypeBinding(scope) returns null. This may happen in // certain circumstances, typically when an illegal access is done on a type // variable (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=204749) if (type == null) return null; if (!type.isValidBinding()) { Binding binding = scope.getTypeOrPackage(this.tokens); if (binding instanceof PackageBinding) { this.packageBinding = (PackageBinding) binding; // Valid package references are allowed in Javadoc (https://bugs.eclipse.org/bugs/show_bug.cgi?id=281609) } else { reportInvalidType(scope); } return null; } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=209936 // raw convert all enclosing types when dealing with Javadoc references if (type.isGenericType() || type.isParameterizedType()) { this.resolvedType = scope.environment().convertToRawType(type, true /*force the conversion of enclosing types*/); } return this.resolvedType; } protected void reportDeprecatedType(TypeBinding type, Scope scope) {
private TypeBinding internalResolveType(Scope scope, boolean checkBounds) { // handle the error here this.constant = Constant.NotAConstant; if (this.resolvedType != null) // is a shared type reference which was already resolved return this.resolvedType.isValidBinding() ? this.resolvedType : this.resolvedType.closestMatch(); // already reported error TypeBinding type = this.resolvedType = getTypeBinding(scope); // End resolution when getTypeBinding(scope) returns null. This may happen in // certain circumstances, typically when an illegal access is done on a type // variable (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=204749) if (type == null) return null; if (!type.isValidBinding()) { Binding binding = scope.getTypeOrPackage(this.tokens); if (binding instanceof PackageBinding) { this.packageBinding = (PackageBinding) binding; // Valid package references are allowed in Javadoc (https://bugs.eclipse.org/bugs/show_bug.cgi?id=281609) } else { reportInvalidType(scope); } return null; } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=209936 // raw convert all enclosing types when dealing with Javadoc references if (type.isGenericType() || type.isParameterizedType()) { this.resolvedType = scope.environment().convertToRawType(type, true /*force the conversion of enclosing types*/); } return this.resolvedType; } @Override
private TypeBinding internalResolveType(Scope scope, boolean checkBounds) { // handle the error here this.constant = Constant.NotAConstant; if (this.resolvedType != null) // is a shared type reference which was already resolved return this.resolvedType.isValidBinding() ? this.resolvedType : this.resolvedType.closestMatch(); // already reported error TypeBinding type = this.resolvedType = getTypeBinding(scope); // End resolution when getTypeBinding(scope) returns null. This may happen in // certain circumstances, typically when an illegal access is done on a type // variable (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=204749) if (type == null) return null; if (!type.isValidBinding()) { Binding binding = scope.getTypeOrPackage(this.tokens); if (binding instanceof PackageBinding) { this.packageBinding = (PackageBinding) binding; // Valid package references are allowed in Javadoc (https://bugs.eclipse.org/bugs/show_bug.cgi?id=281609) } else { reportInvalidType(scope); } return null; } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=209936 // raw convert all enclosing types when dealing with Javadoc references if (type.isGenericType() || type.isParameterizedType()) { this.resolvedType = scope.environment().convertToRawType(type, true /*force the conversion of enclosing types*/); } return this.resolvedType; } protected void reportDeprecatedType(TypeBinding type, Scope scope) {