/** Detect when we are equating an inference variable against a free type variable. */ boolean checkIVFreeTVmatch(TypeBinding one, TypeBinding two) { if (one instanceof InferenceVariable && two.isTypeVariable() && (two.tagBits & TagBits.AnnotationNullMASK) == 0) { // found match => avoid inferring any null annotation (by marking as contradiction): ((InferenceVariable)one).nullHints = TagBits.AnnotationNullMASK; return true; } return false; }
/** Detect when we are equating an inference variable against a free type variable. */ boolean checkIVFreeTVmatch(TypeBinding one, TypeBinding two) { if (one instanceof InferenceVariable && two.isTypeVariable() && (two.tagBits & TagBits.AnnotationNullMASK) == 0) { // found match => avoid inferring any null annotation (by marking as contradiction): ((InferenceVariable)one).nullHints = TagBits.AnnotationNullMASK; return true; } return false; }
/** Detect when we are equating an inference variable against a free type variable. */ boolean checkIVFreeTVmatch(TypeBinding one, TypeBinding two) { if (one instanceof InferenceVariable && two.isTypeVariable() && (two.tagBits & TagBits.AnnotationNullMASK) == 0) { // found match => avoid inferring any null annotation (by marking as contradiction): ((InferenceVariable)one).nullHints = TagBits.AnnotationNullMASK; return true; } return false; }
public void lambdaParameterTypeMismatched(Argument argument, TypeReference type, TypeBinding expectedParameterType) { String name = new String(argument.name); String expectedTypeFullName = new String(expectedParameterType.readableName()); String expectedTypeShortName = new String(expectedParameterType.shortReadableName()); this.handle( expectedParameterType.isTypeVariable() ? IProblem.IncompatibleLambdaParameterType : IProblem.lambdaParameterTypeMismatched, new String[] { name, expectedTypeFullName }, new String[] { name, expectedTypeShortName }, type.sourceStart, type.sourceEnd); } public void lambdaExpressionCannotImplementGenericMethod(LambdaExpression lambda, MethodBinding sam) {
public void lambdaParameterTypeMismatched(Argument argument, TypeReference type, TypeBinding expectedParameterType) { String name = new String(argument.name); String expectedTypeFullName = new String(expectedParameterType.readableName()); String expectedTypeShortName = new String(expectedParameterType.shortReadableName()); this.handle( expectedParameterType.isTypeVariable() ? IProblem.IncompatibleLambdaParameterType : IProblem.lambdaParameterTypeMismatched, new String[] { name, expectedTypeFullName }, new String[] { name, expectedTypeShortName }, type.sourceStart, type.sourceEnd); } public void lambdaExpressionCannotImplementGenericMethod(LambdaExpression lambda, MethodBinding sam) {
public void lambdaParameterTypeMismatched(Argument argument, TypeReference type, TypeBinding expectedParameterType) { String name = new String(argument.name); String expectedTypeFullName = new String(expectedParameterType.readableName()); String expectedTypeShortName = new String(expectedParameterType.shortReadableName()); this.handle( expectedParameterType.isTypeVariable() ? IProblem.IncompatibleLambdaParameterType : IProblem.lambdaParameterTypeMismatched, new String[] { name, expectedTypeFullName }, new String[] { name, expectedTypeShortName }, type.sourceStart, type.sourceEnd); } public void lambdaExpressionCannotImplementGenericMethod(LambdaExpression lambda, MethodBinding sam) {
public void lambdaParameterTypeMismatched(Argument argument, TypeReference type, TypeBinding expectedParameterType) { String name = new String(argument.name); String expectedTypeFullName = new String(expectedParameterType.readableName()); String expectedTypeShortName = new String(expectedParameterType.shortReadableName()); this.handle( expectedParameterType.isTypeVariable() ? IProblem.IncompatibleLambdaParameterType : IProblem.lambdaParameterTypeMismatched, new String[] { name, expectedTypeFullName }, new String[] { name, expectedTypeShortName }, type.sourceStart, type.sourceEnd); } public void lambdaExpressionCannotImplementGenericMethod(LambdaExpression lambda, MethodBinding sam) {
public void lambdaParameterTypeMismatched(Argument argument, TypeReference type, TypeBinding expectedParameterType) { String name = new String(argument.name); String expectedTypeFullName = new String(expectedParameterType.readableName()); String expectedTypeShortName = new String(expectedParameterType.shortReadableName()); this.handle( expectedParameterType.isTypeVariable() ? IProblem.IncompatibleLambdaParameterType : IProblem.lambdaParameterTypeMismatched, new String[] { name, expectedTypeFullName }, new String[] { name, expectedTypeShortName }, type.sourceStart, type.sourceEnd); } public void lambdaExpressionCannotImplementGenericMethod(LambdaExpression lambda, MethodBinding sam) {
public void lambdaParameterTypeMismatched(Argument argument, TypeReference type, TypeBinding expectedParameterType) { String name = new String(argument.name); String expectedTypeFullName = new String(expectedParameterType.readableName()); String expectedTypeShortName = new String(expectedParameterType.shortReadableName()); this.handle( expectedParameterType.isTypeVariable() ? IProblem.IncompatibleLambdaParameterType : IProblem.lambdaParameterTypeMismatched, new String[] { name, expectedTypeFullName }, new String[] { name, expectedTypeShortName }, type.sourceStart, type.sourceEnd); } public void lambdaExpressionCannotImplementGenericMethod(LambdaExpression lambda, MethodBinding sam) {
public void lambdaParameterTypeMismatched(Argument argument, TypeReference type, TypeBinding expectedParameterType) { String name = new String(argument.name); String expectedTypeFullName = new String(expectedParameterType.readableName()); String expectedTypeShortName = new String(expectedParameterType.shortReadableName()); this.handle( expectedParameterType.isTypeVariable() ? IProblem.IncompatibleLambdaParameterType : IProblem.lambdaParameterTypeMismatched, new String[] { name, expectedTypeFullName }, new String[] { name, expectedTypeShortName }, type.sourceStart, type.sourceEnd); } public void lambdaExpressionCannotImplementGenericMethod(LambdaExpression lambda, MethodBinding sam) {
@Override public IModuleBinding getModule() { if (this.binding instanceof ReferenceBinding && !this.binding.isTypeVariable()) { IPackageBinding packageBinding = this.resolver.getPackageBinding(((ReferenceBinding) this.binding).getPackage()); return packageBinding != null ? packageBinding.getModule() : null; } return null; } @Override
@Override public IModuleBinding getModule() { if (this.binding instanceof ReferenceBinding && !this.binding.isTypeVariable()) { IPackageBinding packageBinding = this.resolver.getPackageBinding(((ReferenceBinding) this.binding).getPackage()); return packageBinding != null ? packageBinding.getModule() : null; } return null; } @Override
boolean denotesRelevantSuperClass(TypeBinding type) { if (!type.isTypeVariable() && !type.isInterface() && type.id != TypeIds.T_JavaLangObject) return true; ReferenceBinding aSuperClass = type.superclass(); return aSuperClass != null && aSuperClass.id != TypeIds.T_JavaLangObject && !aSuperClass.isTypeVariable(); }
boolean denotesRelevantSuperClass(TypeBinding type) { if (!type.isTypeVariable() && !type.isInterface() && type.id != TypeIds.T_JavaLangObject) return true; ReferenceBinding aSuperClass = type.superclass(); return aSuperClass != null && aSuperClass.id != TypeIds.T_JavaLangObject && !aSuperClass.isTypeVariable(); }
boolean denotesRelevantSuperClass(TypeBinding type) { if (!type.isTypeVariable() && !type.isInterface() && type.id != TypeIds.T_JavaLangObject) return true; ReferenceBinding aSuperClass = type.superclass(); return aSuperClass != null && aSuperClass.id != TypeIds.T_JavaLangObject && !aSuperClass.isTypeVariable(); }
boolean denotesRelevantSuperClass(TypeBinding type) { if (!type.isTypeVariable() && !type.isInterface() && type.id != TypeIds.T_JavaLangObject) return true; ReferenceBinding aSuperClass = type.superclass(); return aSuperClass != null && aSuperClass.id != TypeIds.T_JavaLangObject && !aSuperClass.isTypeVariable(); }
public TypeBinding resolveSuperType(ClassScope scope) { // assumes the implementation of resolveType(ClassScope) will call back to detect cycles TypeBinding superType = resolveType(scope); if (superType == null) return null; if (superType.isTypeVariable()) { if (this.resolvedType.isValidBinding()) { this.resolvedType = new ProblemReferenceBinding(getTypeName(), (ReferenceBinding)this.resolvedType, ProblemReasons.IllegalSuperTypeVariable); reportInvalidType(scope); } return null; } return superType; }
public boolean isBoxingCompatible(TypeBinding expressionType, TypeBinding targetType, Expression expression, Scope scope) { if (scope.isBoxingCompatibleWith(expressionType, targetType)) return true; return expressionType.isBaseType() // narrowing then boxing ? Only allowed for some target types see 362279 && !targetType.isBaseType() && !targetType.isTypeVariable() && scope.compilerOptions().sourceLevel >= org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants.JDK1_5 // autoboxing && (targetType.id == TypeIds.T_JavaLangByte || targetType.id == TypeIds.T_JavaLangShort || targetType.id == TypeIds.T_JavaLangCharacter) && expression.isConstantValueOfTypeAssignableToType(expressionType, scope.environment().computeBoxingType(targetType)); }
public boolean isBoxingCompatible(TypeBinding expressionType, TypeBinding targetType, Expression expression, Scope scope) { if (scope.isBoxingCompatibleWith(expressionType, targetType)) return true; return expressionType.isBaseType() // narrowing then boxing ? Only allowed for some target types see 362279 && !targetType.isBaseType() && !targetType.isTypeVariable() && scope.compilerOptions().sourceLevel >= org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants.JDK1_5 // autoboxing && (targetType.id == TypeIds.T_JavaLangByte || targetType.id == TypeIds.T_JavaLangShort || targetType.id == TypeIds.T_JavaLangCharacter) && expression.isConstantValueOfTypeAssignableToType(expressionType, scope.environment().computeBoxingType(targetType)); }
public boolean isBoxingCompatible(TypeBinding expressionType, TypeBinding targetType, Expression expression, Scope scope) { if (scope.isBoxingCompatibleWith(expressionType, targetType)) return true; return expressionType.isBaseType() // narrowing then boxing ? Only allowed for some target types see 362279 && !targetType.isBaseType() && !targetType.isTypeVariable() && scope.compilerOptions().sourceLevel >= org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants.JDK1_5 // autoboxing && (targetType.id == TypeIds.T_JavaLangByte || targetType.id == TypeIds.T_JavaLangShort || targetType.id == TypeIds.T_JavaLangCharacter) && expression.isConstantValueOfTypeAssignableToType(expressionType, scope.environment().computeBoxingType(targetType)); }