### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: dom/org/eclipse/jdt/core/dom/TypeBinding.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeBinding.java,v retrieving revision 1.115 diff -u -r1.115 TypeBinding.java --- dom/org/eclipse/jdt/core/dom/TypeBinding.java 24 Apr 2006 17:41:54 -0000 1.115 +++ dom/org/eclipse/jdt/core/dom/TypeBinding.java 20 Jun 2006 13:31:10 -0000 @@ -47,6 +47,7 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; import org.eclipse.jdt.internal.compiler.lookup.WildcardBinding; +import org.eclipse.jdt.internal.compiler.problem.AbortCompilation; import org.eclipse.jdt.internal.compiler.util.SuffixConstants; import org.eclipse.jdt.internal.compiler.util.Util; import org.eclipse.jdt.internal.core.ClassFile; @@ -952,11 +953,17 @@ * @see ITypeBinding#isAssignmentCompatible(ITypeBinding) */ public boolean isAssignmentCompatible(ITypeBinding type) { - if (this == type) return true; - TypeBinding other = (TypeBinding) type; - Scope scope = this.resolver.scope(); - if (scope == null) return false; - return this.binding.isCompatibleWith(other.binding) || scope.isBoxingCompatibleWith(this.binding, other.binding); + try { + if (this == type) return true; + TypeBinding other = (TypeBinding) type; + Scope scope = this.resolver.scope(); + if (scope == null) return false; + return this.binding.isCompatibleWith(other.binding) || scope.isBoxingCompatibleWith(this.binding, other.binding); + } catch (AbortCompilation e) { + // don't surface internal exception to clients + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=143013 + return false; + } } /* (non-Javadoc) @@ -970,17 +977,23 @@ * @see ITypeBinding#isCastCompatible(ITypeBinding) */ public boolean isCastCompatible(ITypeBinding type) { - Expression expression = new Expression() { - public StringBuffer printExpression(int indent,StringBuffer output) { - return null; - } - }; - Scope scope = this.resolver.scope(); - if (scope == null) return false; - org.eclipse.jdt.internal.compiler.lookup.TypeBinding expressionType = ((TypeBinding) type).binding; - // simulate capture in case checked binding did not properly get extracted from a reference - expressionType = expressionType.capture(scope, 0); - return expression.checkCastTypesCompatibility(scope, this.binding, expressionType, null); + try { + Expression expression = new Expression() { + public StringBuffer printExpression(int indent,StringBuffer output) { + return null; + } + }; + Scope scope = this.resolver.scope(); + if (scope == null) return false; + org.eclipse.jdt.internal.compiler.lookup.TypeBinding expressionType = ((TypeBinding) type).binding; + // simulate capture in case checked binding did not properly get extracted from a reference + expressionType = expressionType.capture(scope, 0); + return expression.checkCastTypesCompatibility(scope, this.binding, expressionType, null); + } catch (AbortCompilation e) { + // don't surface internal exception to clients + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=143013 + return false; + } } /* @@ -1145,11 +1158,17 @@ * @see ITypeBinding#isSubTypeCompatible(ITypeBinding) */ public boolean isSubTypeCompatible(ITypeBinding type) { - if (this == type) return true; - if (this.binding.isBaseType()) return false; - TypeBinding other = (TypeBinding) type; - if (other.binding.isBaseType()) return false; - return this.binding.isCompatibleWith(other.binding); + try { + if (this == type) return true; + if (this.binding.isBaseType()) return false; + TypeBinding other = (TypeBinding) type; + if (other.binding.isBaseType()) return false; + return this.binding.isCompatibleWith(other.binding); + } catch (AbortCompilation e) { + // don't surface internal exception to clients + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=143013 + return false; + } } /** Index: dom/org/eclipse/jdt/core/dom/MethodBinding.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodBinding.java,v retrieving revision 1.75 diff -u -r1.75 MethodBinding.java --- dom/org/eclipse/jdt/core/dom/MethodBinding.java 6 Apr 2006 15:13:53 -0000 1.75 +++ dom/org/eclipse/jdt/core/dom/MethodBinding.java 20 Jun 2006 13:31:09 -0000 @@ -28,6 +28,7 @@ import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; +import org.eclipse.jdt.internal.compiler.problem.AbortCompilation; import org.eclipse.jdt.internal.core.JavaElement; import org.eclipse.jdt.internal.core.Member; import org.eclipse.jdt.internal.core.util.Util; @@ -411,10 +412,16 @@ } public boolean isSubsignature(IMethodBinding otherMethod) { - org.eclipse.jdt.internal.compiler.lookup.MethodBinding other = ((MethodBinding) otherMethod).binding; - if (!CharOperation.equals(this.binding.selector, other.selector)) + try { + org.eclipse.jdt.internal.compiler.lookup.MethodBinding other = ((MethodBinding) otherMethod).binding; + if (!CharOperation.equals(this.binding.selector, other.selector)) + return false; + return this.binding.areParameterErasuresEqual(other) && this.binding.areTypeVariableErasuresEqual(other); + } catch (AbortCompilation e) { + // don't surface internal exception to clients + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=143013 return false; - return this.binding.areParameterErasuresEqual(other) && this.binding.areTypeVariableErasuresEqual(other); + } } /** @@ -428,28 +435,34 @@ * @see IMethodBinding#overrides(IMethodBinding) */ public boolean overrides(IMethodBinding overridenMethod) { - org.eclipse.jdt.internal.compiler.lookup.MethodBinding overridenCompilerBinding = ((MethodBinding) overridenMethod).binding; - if (this.binding == overridenCompilerBinding) + try { + org.eclipse.jdt.internal.compiler.lookup.MethodBinding overridenCompilerBinding = ((MethodBinding) overridenMethod).binding; + if (this.binding == overridenCompilerBinding) + return false; + char[] selector = this.binding.selector; + if (!CharOperation.equals(selector, overridenCompilerBinding.selector)) + return false; + TypeBinding match = this.binding.declaringClass.findSuperTypeWithSameErasure(overridenCompilerBinding.declaringClass); + if (!(match instanceof ReferenceBinding)) return false; + + org.eclipse.jdt.internal.compiler.lookup.MethodBinding[] superMethods = ((ReferenceBinding)match).getMethods(selector); + for (int i = 0, length = superMethods.length; i < length; i++) { + if (superMethods[i].original() == overridenCompilerBinding) { + LookupEnvironment lookupEnvironment = this.resolver.lookupEnvironment(); + if (lookupEnvironment == null) return false; + MethodVerifier methodVerifier = lookupEnvironment.methodVerifier(); + org.eclipse.jdt.internal.compiler.lookup.MethodBinding superMethod = superMethods[i]; + return !superMethod.isPrivate() + && !(superMethod.isDefault() && (superMethod.declaringClass.getPackage()) != this.binding.declaringClass.getPackage()) + && methodVerifier.doesMethodOverride(this.binding, superMethod); + } + } return false; - char[] selector = this.binding.selector; - if (!CharOperation.equals(selector, overridenCompilerBinding.selector)) + } catch (AbortCompilation e) { + // don't surface internal exception to clients + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=143013 return false; - TypeBinding match = this.binding.declaringClass.findSuperTypeWithSameErasure(overridenCompilerBinding.declaringClass); - if (!(match instanceof ReferenceBinding)) return false; - - org.eclipse.jdt.internal.compiler.lookup.MethodBinding[] superMethods = ((ReferenceBinding)match).getMethods(selector); - for (int i = 0, length = superMethods.length; i < length; i++) { - if (superMethods[i].original() == overridenCompilerBinding) { - LookupEnvironment lookupEnvironment = this.resolver.lookupEnvironment(); - if (lookupEnvironment == null) return false; - MethodVerifier methodVerifier = lookupEnvironment.methodVerifier(); - org.eclipse.jdt.internal.compiler.lookup.MethodBinding superMethod = superMethods[i]; - return !superMethod.isPrivate() - && !(superMethod.isDefault() && (superMethod.declaringClass.getPackage()) != this.binding.declaringClass.getPackage()) - && methodVerifier.doesMethodOverride(this.binding, superMethod); - } } - return false; } /**