diff options
Diffstat (limited to 'org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java')
-rw-r--r-- | org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java index 60e58c48f..e09e727b3 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java @@ -543,7 +543,7 @@ public boolean canBeSeenBy(ReferenceBinding receiverType, ReferenceBinding invoc do { if (currentType.isCapture()) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=285002 if (TypeBinding.equalsEquals(originalDeclaringClass, currentType.erasure().original())) return true; - } else { + } else { if (TypeBinding.equalsEquals(originalDeclaringClass, currentType.original())) return true; } PackageBinding currentPackage = currentType.fPackage; @@ -642,7 +642,7 @@ public char[] computeGenericTypeSignature(TypeVariableBinding[] typeVariables) { } public void computeId() { - // note that more (configurable) ids are assigned from PackageBinding#checkIfNullAnnotationType() + // note that more (configurable) ids are assigned from PackageBinding#checkIfNullAnnotationType() // try to avoid multiple checks against a package/type name switch (this.compoundName.length) { @@ -671,7 +671,7 @@ public void computeId() { case 3: // only one type in this group, yet: if (CharOperation.equals(TypeConstants.ORG_JUNIT_ASSERT, this.compoundName)) this.id = TypeIds.T_OrgJunitAssert; - return; + return; case 4: if (!CharOperation.equals(TypeConstants.JAVA, packageName)) return; @@ -691,7 +691,7 @@ public void computeId() { default: return; } // ... at this point we know it's java.*.* - + packageName = this.compoundName[1]; if (packageName.length == 0) return; // just to be safe char[] typeName = this.compoundName[2]; @@ -704,7 +704,7 @@ public void computeId() { switch (typeName[0]) { case 'C' : if (CharOperation.equals(typeName, TypeConstants.JAVA_IO_CLOSEABLE[2])) - this.typeBits |= TypeIds.BitCloseable; // don't assign id, only typeBit (for analysis of resource leaks) + this.typeBits |= TypeIds.BitCloseable; // don't assign id, only typeBit (for analysis of resource leaks) return; case 'E' : if (CharOperation.equals(typeName, TypeConstants.JAVA_IO_EXTERNALIZABLE[2])) @@ -736,7 +736,7 @@ public void computeId() { if (CharOperation.equals(typeName, TypeConstants.JAVA_UTIL_COLLECTION[2])) { this.id = TypeIds.T_JavaUtilCollection; this.typeBits |= TypeIds.BitCollection; - } + } return; case 'I' : if (CharOperation.equals(typeName, TypeConstants.JAVA_UTIL_ITERATOR[2])) @@ -746,7 +746,7 @@ public void computeId() { if (CharOperation.equals(typeName, TypeConstants.JAVA_UTIL_LIST[2])) { this.id = TypeIds.T_JavaUtilList; this.typeBits |= TypeIds.BitList; - } + } return; case 'M' : if (CharOperation.equals(typeName, TypeConstants.JAVA_UTIL_MAP[2])) { @@ -772,7 +772,7 @@ public void computeId() { case 13 : if (CharOperation.equals(typeName, TypeConstants.JAVA_LANG_AUTOCLOSEABLE[2])) { this.id = TypeIds.T_JavaLangAutoCloseable; - this.typeBits |= TypeIds.BitAutoCloseable; + this.typeBits |= TypeIds.BitAutoCloseable; } return; case 14: @@ -1026,13 +1026,13 @@ public void computeId() { return; packageName = this.compoundName[1]; if (packageName.length == 0) return; // just to be safe - + if (CharOperation.equals(TypeConstants.LANG, packageName)) { packageName = this.compoundName[2]; if (packageName.length == 0) return; // just to be safe switch (packageName[0]) { case 'i' : - if (CharOperation.equals(packageName, TypeConstants.INVOKE)) { + if (CharOperation.equals(packageName, TypeConstants.INVOKE)) { typeName = this.compoundName[3]; if (typeName.length == 0) return; // just to be safe switch (typeName[0]) { @@ -1063,7 +1063,7 @@ public void computeId() { if (packageName.length == 0) return; // just to be safe switch (packageName[0]) { case 'c' : - if (CharOperation.equals(packageName, TypeConstants.CORE)) { + if (CharOperation.equals(packageName, TypeConstants.CORE)) { typeName = this.compoundName[3]; if (typeName.length == 0) return; // just to be safe switch (typeName[0]) { @@ -1321,7 +1321,7 @@ public ReferenceBinding getMemberTypeRecurse(char[] typeName) { /** * Search the given sourceName in the list of sorted member types. - * + * * Neither the array of sortedMemberTypes nor the given sourceName may be null. */ static int binarySearch(char[] sourceName, ReferenceBinding[] sortedMemberTypes) { @@ -1742,7 +1742,7 @@ public ReferenceBinding getRealClass() { } return this; } -/** +/** * Return a version of other that has the same type arguments as this. */ public ReferenceBinding transferTypeArguments(ReferenceBinding other) { @@ -1798,8 +1798,8 @@ public boolean isCompatibleWith(TypeBinding otherType, boolean useObjectShortcut this.compatibleCache.put(otherType, Boolean.TRUE); return true; } - if (captureScope == null - && this instanceof TypeVariableBinding + if (captureScope == null + && this instanceof TypeVariableBinding && ((TypeVariableBinding)this).firstBound instanceof ParameterizedTypeBinding) { // see https://bugs.eclipse.org/395002#c9 // in this case a subsequent check with captureScope != null may actually get @@ -1876,7 +1876,7 @@ private boolean isCompatibleWith0(TypeBinding otherType, boolean useObjectShortc case Binding.GENERIC_TYPE : case Binding.PARAMETERIZED_TYPE : case Binding.RAW_TYPE : - if (TypeBinding.equalsEquals(erasure(), otherType.erasure())) + if (TypeBinding.equalsEquals(erasure(), otherType.erasure())) return false; // should have passed equivalence check // above if same erasure } @@ -1932,11 +1932,11 @@ public boolean isSubtypeOf(TypeBinding other, boolean simulatingBugJDK8026527) { return false; if (TypeBinding.equalsEquals(candidate, other)) return true; - + // T<Ai...> <: T#RAW: if (other.isRawType() && TypeBinding.equalsEquals(candidate.erasure(), other.erasure())) return true; - + TypeBinding[] sis = other.typeArguments(); TypeBinding[] tis = candidate.typeArguments(); if (tis == null || sis == null) @@ -2004,7 +2004,7 @@ public boolean isHierarchyBeingConnected() { return (this.tagBits & TagBits.EndHierarchyCheck) == 0 && (this.tagBits & TagBits.BeginHierarchyCheck) != 0; } /** - * Returns true if the type hierarchy is being connected "actively" i.e not paused momentatrily, + * Returns true if the type hierarchy is being connected "actively" i.e not paused momentatrily, * while resolving type arguments. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=294057 */ public boolean isHierarchyBeingActivelyConnected() { @@ -2392,7 +2392,7 @@ public char[] shortReadableName(boolean showGenerics) /*Object*/ { if ((typeVars = typeVariables()) != Binding.NO_TYPE_VARIABLES) { :giro */ if ((typeVars = typeVariables()) != Binding.NO_TYPE_VARIABLES || valueParams != Binding.NO_SYNTH_ARGUMENTS) { -// orig: +// orig: StringBuffer nameBuffer = new StringBuffer(10); nameBuffer.append(shortReadableName).append('<'); // :giro @@ -2457,7 +2457,7 @@ public char[] internalName() { * Perform an upwards type projection as per JLS 4.10.5 * @param scope Relevant scope for evaluating type projection * @param mentionedTypeVariables Filter for mentioned type variabled - * @returns Upwards type projection of 'this', or null if downwards projection is undefined + * @returns Upwards type projection of 'this', or null if downwards projection is undefined */ @Override public ReferenceBinding upwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) { @@ -2468,7 +2468,7 @@ public ReferenceBinding upwardsProjection(Scope scope, TypeBinding[] mentionedTy * Perform a downwards type projection as per JLS 4.10.5 * @param scope Relevant scope for evaluating type projection * @param mentionedTypeVariables Filter for mentioned type variabled - * @returns Downwards type projection of 'this', or null if downwards projection is undefined + * @returns Downwards type projection of 'this', or null if downwards projection is undefined */ @Override public ReferenceBinding downwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) { @@ -2618,7 +2618,7 @@ protected int applyCloseableInterfaceWhitelists() { return 0; } -//{ObjectTeams: support for checking substitution of a value parameter +//{ObjectTeams: support for checking substitution of a value parameter public VariableBinding valueParamSynthArgAt(int typeParamPosition) { SyntheticArgumentBinding[] args = valueParamSynthArgs(); if (args.length > typeParamPosition) @@ -2628,16 +2628,16 @@ public VariableBinding valueParamSynthArgAt(int typeParamPosition) { // SH} protected MethodBinding [] getInterfaceAbstractContracts(Scope scope, boolean replaceWildcards, boolean filterDefaultMethods) throws InvalidInputException { - + if (!isInterface() || !isValidBinding()) { throw new InvalidInputException("Not a functional interface"); //$NON-NLS-1$ } - + MethodBinding [] methods = methods(); MethodBinding [] contracts = new MethodBinding[0]; int contractsCount = 0; int contractsLength = 0; - + ReferenceBinding [] superInterfaces = superInterfaces(); for (int i = 0, length = superInterfaces.length; i < length; i++) { // filterDefaultMethods=false => keep default methods needed to filter out any abstract methods they may override: @@ -2654,9 +2654,9 @@ protected MethodBinding [] getInterfaceAbstractContracts(Scope scope, boolean re LookupEnvironment environment = scope.environment(); for (int i = 0, length = methods == null ? 0 : methods.length; i < length; i++) { final MethodBinding method = methods[i]; - if (method == null || method.isStatic() || method.redeclaresPublicObjectMethod(scope) || method.isPrivate()) + if (method == null || method.isStatic() || method.redeclaresPublicObjectMethod(scope) || method.isPrivate()) continue; - if (!method.isValidBinding()) + if (!method.isValidBinding()) throw new InvalidInputException("Not a functional interface"); //$NON-NLS-1$ for (int j = 0; j < contractsCount;) { if ( contracts[j] != null && MethodVerifier.doesMethodOverride(method, contracts[j], environment)) { @@ -2693,7 +2693,7 @@ protected MethodBinding [] getInterfaceAbstractContracts(Scope scope, boolean re // abstract method from one super type overridden by other super interface ==> contracts[j] = null; if (j < contractsCount) { System.arraycopy(contracts, j+1, contracts, j, contractsCount - j); - } + } j--; if (j < i) i--; @@ -2705,8 +2705,8 @@ protected MethodBinding [] getInterfaceAbstractContracts(Scope scope, boolean re // remove default method after it has eliminated any matching abstract methods from contracts if (i < contractsCount) { System.arraycopy(contracts, i+1, contracts, i, contractsCount - i); - } - i--; + } + i--; } } if (contractsCount < contractsLength) { @@ -2716,7 +2716,7 @@ protected MethodBinding [] getInterfaceAbstractContracts(Scope scope, boolean re } @Override public MethodBinding getSingleAbstractMethod(Scope scope, boolean replaceWildcards) { - + int index = replaceWildcards ? 0 : 1; if (this.singleAbstractMethod != null) { if (this.singleAbstractMethod[index] != null) @@ -2751,12 +2751,12 @@ public MethodBinding getSingleAbstractMethod(Scope scope, boolean replaceWildcar } if (methods.length == 1) return this.singleAbstractMethod[index] = methods[0]; - + final LookupEnvironment environment = scope.environment(); boolean genericMethodSeen = false; int length = methods.length; boolean analyseNullAnnotations = environment.globalOptions.isAnnotationBasedNullAnalysisEnabled; - + next:for (int i = length - 1; i >= 0; --i) { MethodBinding method = methods[i], otherMethod = null; if (method.typeVariables != Binding.NO_TYPE_VARIABLES) @@ -2768,13 +2768,13 @@ public MethodBinding getSingleAbstractMethod(Scope scope, boolean replaceWildcar otherMethod = methods[j]; if (otherMethod.typeVariables != Binding.NO_TYPE_VARIABLES) genericMethodSeen = true; - + if (genericMethodSeen) { // adapt type parameters. otherMethod = MethodVerifier.computeSubstituteMethod(otherMethod, method, environment); if (otherMethod == null) continue next; } - if (!MethodVerifier.isSubstituteParameterSubsignature(method, otherMethod, environment) || !MethodVerifier.areReturnTypesCompatible(method, otherMethod, environment)) + if (!MethodVerifier.isSubstituteParameterSubsignature(method, otherMethod, environment) || !MethodVerifier.areReturnTypesCompatible(method, otherMethod, environment)) continue next; if (analyseNullAnnotations) { returnType = NullAnnotationMatching.strongerType(returnType, otherMethod.returnType, environment); @@ -2788,7 +2788,7 @@ public MethodBinding getSingleAbstractMethod(Scope scope, boolean replaceWildcar boolean shouldEraseThrows = theAbstractMethod.typeVariables == Binding.NO_TYPE_VARIABLES && genericMethodSeen; boolean shouldAdaptThrows = theAbstractMethod.typeVariables != Binding.NO_TYPE_VARIABLES; final int typeVariableLength = theAbstractMethod.typeVariables.length; - + none:for (i = 0; i < length; i++) { method = methods[i]; ReferenceBinding[] methodThrownExceptions = method.thrownExceptions; @@ -2813,10 +2813,10 @@ public MethodBinding getSingleAbstractMethod(Scope scope, boolean replaceWildcar int otherMethodExceptionsLength = otherMethodThrownExceptions == null ? 0 : otherMethodThrownExceptions.length; if (otherMethodExceptionsLength == 0) break none; if (shouldAdaptThrows && otherMethod != theAbstractMethod) { - System.arraycopy(otherMethodThrownExceptions, - 0, - otherMethodThrownExceptions = new ReferenceBinding[otherMethodExceptionsLength], - 0, + System.arraycopy(otherMethodThrownExceptions, + 0, + otherMethodThrownExceptions = new ReferenceBinding[otherMethodExceptionsLength], + 0, otherMethodExceptionsLength); for (int tv = 0; tv < typeVariableLength; tv++) { if (otherMethodThrownExceptions[tv] instanceof TypeVariableBinding) { @@ -2843,11 +2843,11 @@ public MethodBinding getSingleAbstractMethod(Scope scope, boolean replaceWildcar if (exceptionsCount != exceptionsLength) { System.arraycopy(exceptions, 0, exceptions = new ReferenceBinding[exceptionsCount], 0, exceptionsCount); } - this.singleAbstractMethod[index] = new MethodBinding(theAbstractMethod.modifiers | ClassFileConstants.AccSynthetic, - theAbstractMethod.selector, - returnType, - parameters, - exceptions, + this.singleAbstractMethod[index] = new MethodBinding(theAbstractMethod.modifiers | ClassFileConstants.AccSynthetic, + theAbstractMethod.selector, + returnType, + parameters, + exceptions, theAbstractMethod.declaringClass); this.singleAbstractMethod[index].typeVariables = theAbstractMethod.typeVariables; return this.singleAbstractMethod[index]; |