Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 54768 Details for
Bug 165900
[select] Incoherent behavior when there is ambiguous methods
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
bug165900_001.txt (text/plain), 32.64 KB, created by
David Audel
on 2006-11-30 06:10:32 EST
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
David Audel
Created:
2006-11-30 06:10:32 EST
Size:
32.64 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/SourceType.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceType.java,v >retrieving revision 1.139 >diff -u -r1.139 SourceType.java >--- model/org/eclipse/jdt/internal/core/SourceType.java 28 Jun 2006 08:52:07 -0000 1.139 >+++ model/org/eclipse/jdt/internal/core/SourceType.java 30 Nov 2006 11:05:53 -0000 >@@ -823,7 +823,7 @@ > public void acceptField(char[] declaringTypePackageName, char[] declaringTypeName, char[] fieldName, boolean isDeclaration, char[] uniqueKey, int start, int end) { > // ignore > } >- public void acceptMethod(char[] declaringTypePackageName, char[] declaringTypeName, String enclosingDeclaringTypeSignature, char[] selector, char[][] parameterPackageNames, char[][] parameterTypeNames, String[] parameterSignatures, boolean isConstructor, boolean isDeclaration, char[] uniqueKey, int start, int end) { >+ public void acceptMethod(char[] declaringTypePackageName, char[] declaringTypeName, String enclosingDeclaringTypeSignature, char[] selector, char[][] parameterPackageNames, char[][] parameterTypeNames, String[] parameterSignatures, char[][] typeParameterNames, char[][][] typeParameterBoundNames, boolean isConstructor, boolean isDeclaration, char[] uniqueKey, int start, int end) { > // ignore > } > public void acceptPackage(char[] packageName){ >Index: model/org/eclipse/jdt/internal/core/SelectionRequestor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java,v >retrieving revision 1.67 >diff -u -r1.67 SelectionRequestor.java >--- model/org/eclipse/jdt/internal/core/SelectionRequestor.java 4 Apr 2006 13:33:40 -0000 1.67 >+++ model/org/eclipse/jdt/internal/core/SelectionRequestor.java 30 Nov 2006 11:05:53 -0000 >@@ -74,22 +74,41 @@ > this.nameLookup = nameLookup; > this.openable = openable; > } >-/** >- * Resolve the binary method >- * >- * fix for 1FWFT6Q >- */ >-protected void acceptBinaryMethod(IType type, char[] selector, char[][] parameterPackageNames, char[][] parameterTypeNames, String[] parameterSignatures, char[] uniqueKey, boolean isConstructor) { >- IMethod method= type.getMethod(new String(selector), parameterSignatures); >- if (method.exists()) { >- try { >- if(!isConstructor || ((JavaElement)method).getSourceMapper() == null) { >- if (uniqueKey != null) >- method = new ResolvedBinaryMethod( >+private void acceptBinaryMethod( >+ IType type, >+ IMethod method, >+ char[] uniqueKey, >+ boolean isConstructor) { >+ try { >+ if(!isConstructor || ((JavaElement)method).getSourceMapper() == null) { >+ if (uniqueKey != null) { >+ ResolvedBinaryMethod resolvedMethod = new ResolvedBinaryMethod( >+ (JavaElement)method.getParent(), >+ method.getElementName(), >+ method.getParameterTypes(), >+ new String(uniqueKey)); >+ resolvedMethod.occurrenceCount = method.getOccurrenceCount(); >+ method = resolvedMethod; >+ } >+ >+ addElement(method); >+ if(SelectionEngine.DEBUG){ >+ System.out.print("SELECTION - accept method("); //$NON-NLS-1$ >+ System.out.print(method.toString()); >+ System.out.println(")"); //$NON-NLS-1$ >+ } >+ } else { >+ ISourceRange range = method.getSourceRange(); >+ if (range.getOffset() != -1 && range.getLength() != 0 ) { >+ if (uniqueKey != null) { >+ ResolvedBinaryMethod resolvedMethod = new ResolvedBinaryMethod( > (JavaElement)method.getParent(), > method.getElementName(), > method.getParameterTypes(), > new String(uniqueKey)); >+ resolvedMethod.occurrenceCount = method.getOccurrenceCount(); >+ method = resolvedMethod; >+ } > addElement(method); > if(SelectionEngine.DEBUG){ > System.out.print("SELECTION - accept method("); //$NON-NLS-1$ >@@ -97,33 +116,49 @@ > System.out.println(")"); //$NON-NLS-1$ > } > } else { >- ISourceRange range = method.getSourceRange(); >- if (range.getOffset() != -1 && range.getLength() != 0 ) { >- if (uniqueKey != null) >- method = new ResolvedBinaryMethod( >- (JavaElement)method.getParent(), >- method.getElementName(), >- method.getParameterTypes(), >- new String(uniqueKey)); >- addElement(method); >- if(SelectionEngine.DEBUG){ >- System.out.print("SELECTION - accept method("); //$NON-NLS-1$ >- System.out.print(method.toString()); >- System.out.println(")"); //$NON-NLS-1$ >- } >- } else { >- // no range was actually found, but a method was originally given -> default constructor >- addElement(type); >- if(SelectionEngine.DEBUG){ >- System.out.print("SELECTION - accept type("); //$NON-NLS-1$ >- System.out.print(type.toString()); >- System.out.println(")"); //$NON-NLS-1$ >+ // no range was actually found, but a method was originally given -> default constructor >+ addElement(type); >+ if(SelectionEngine.DEBUG){ >+ System.out.print("SELECTION - accept type("); //$NON-NLS-1$ >+ System.out.print(type.toString()); >+ System.out.println(")"); //$NON-NLS-1$ >+ } >+ } >+ } >+ } catch (JavaModelException e) { >+ // an exception occurs, return nothing >+ } >+} >+/** >+ * Resolve the binary method >+ * >+ * fix for 1FWFT6Q >+ */ >+protected void acceptBinaryMethod( >+ IType type, >+ char[] selector, >+ char[][] parameterPackageNames, >+ char[][] parameterTypeNames, >+ String[] parameterSignatures, >+ char[][] typeParameterNames, >+ char[][][] typeParameterBoundNames, >+ char[] uniqueKey, >+ boolean isConstructor) { >+ IMethod method= type.getMethod(new String(selector), parameterSignatures); >+ >+ if (method.exists()) { >+ if (typeParameterNames != null && typeParameterNames.length != 0) { >+ IMethod[] methods = type.findMethods(method); >+ if (methods.length > 1) { >+ for (int i = 0; i < methods.length; i++) { >+ if (areTypeParametersCompatible(methods[i], typeParameterNames, typeParameterBoundNames)) { >+ acceptBinaryMethod(type, method, uniqueKey, isConstructor); > } > } >+ return; > } >- } catch (JavaModelException e) { >- // an exception occurs, return nothing > } >+ acceptBinaryMethod(type, method, uniqueKey, isConstructor); > } > } > /** >@@ -155,9 +190,13 @@ > if(type != null ) { > String key = uniqueKey == null ? type.getKey() : new String(uniqueKey); > if(type.isBinary()) { >- type = new ResolvedBinaryType((JavaElement)type.getParent(), type.getElementName(), key); >+ ResolvedBinaryType resolvedType = new ResolvedBinaryType((JavaElement)type.getParent(), type.getElementName(), key); >+ resolvedType.occurrenceCount = type.getOccurrenceCount(); >+ type = resolvedType; > } else { >- type = new ResolvedSourceType((JavaElement)type.getParent(), type.getElementName(), key); >+ ResolvedSourceType resolvedType = new ResolvedSourceType((JavaElement)type.getParent(), type.getElementName(), key); >+ resolvedType.occurrenceCount = type.getOccurrenceCount(); >+ type = resolvedType; > } > } > } >@@ -214,15 +253,19 @@ > if (field.exists()) { > if (uniqueKey != null) { > if(field.isBinary()) { >- field = new ResolvedBinaryField( >+ ResolvedBinaryField resolvedField = new ResolvedBinaryField( > (JavaElement)field.getParent(), > field.getElementName(), > new String(uniqueKey)); >+ resolvedField.occurrenceCount = field.getOccurrenceCount(); >+ field = resolvedField; > } else { >- field = new ResolvedSourceField( >+ ResolvedSourceField resolvedField = new ResolvedSourceField( > (JavaElement)field.getParent(), > field.getElementName(), > new String(uniqueKey)); >+ resolvedField.occurrenceCount = field.getOccurrenceCount(); >+ field = resolvedField; > } > } > addElement(field); >@@ -250,15 +293,19 @@ > if (field.exists()) { > char[] uniqueKey = fieldBinding.computeUniqueKey(); > if(field.isBinary()) { >- field = new ResolvedBinaryField( >+ ResolvedBinaryField resolvedField = new ResolvedBinaryField( > (JavaElement)field.getParent(), > field.getElementName(), > new String(uniqueKey)); >+ resolvedField.occurrenceCount = field.getOccurrenceCount(); >+ field = resolvedField; > } else { >- field = new ResolvedSourceField( >+ ResolvedSourceField resolvedField = new ResolvedSourceField( > (JavaElement)field.getParent(), > field.getElementName(), > new String(uniqueKey)); >+ resolvedField.occurrenceCount = field.getOccurrenceCount(); >+ field = resolvedField; > } > addElement(field); > if(SelectionEngine.DEBUG){ >@@ -277,17 +324,21 @@ > > char[] uniqueKey = methodBinding.computeUniqueKey(); > if(method.isBinary()) { >- res = new ResolvedBinaryMethod( >+ ResolvedBinaryMethod resolvedRes = new ResolvedBinaryMethod( > (JavaElement)res.getParent(), > method.getElementName(), > method.getParameterTypes(), > new String(uniqueKey)); >+ resolvedRes.occurrenceCount = method.getOccurrenceCount(); >+ res = resolvedRes; > } else { >- res = new ResolvedSourceMethod( >+ ResolvedSourceMethod resolvedRes = new ResolvedSourceMethod( > (JavaElement)res.getParent(), > method.getElementName(), > method.getParameterTypes(), > new String(uniqueKey)); >+ resolvedRes.occurrenceCount = method.getOccurrenceCount(); >+ res = resolvedRes; > } > addElement(res); > if(SelectionEngine.DEBUG){ >@@ -390,7 +441,21 @@ > /** > * Resolve the method > */ >-public void acceptMethod(char[] declaringTypePackageName, char[] declaringTypeName, String enclosingDeclaringTypeSignature, char[] selector, char[][] parameterPackageNames, char[][] parameterTypeNames, String[] parameterSignatures, boolean isConstructor, boolean isDeclaration, char[] uniqueKey, int start, int end) { >+public void acceptMethod( >+ char[] declaringTypePackageName, >+ char[] declaringTypeName, >+ String enclosingDeclaringTypeSignature, >+ char[] selector, >+ char[][] parameterPackageNames, >+ char[][] parameterTypeNames, >+ String[] parameterSignatures, >+ char[][] typeParameterNames, >+ char[][][] typeParameterBoundNames, >+ boolean isConstructor, >+ boolean isDeclaration, >+ char[] uniqueKey, >+ int start, >+ int end) { > IJavaElement[] previousElement = this.elements; > int previousElementIndex = this.elementIndex; > this.elements = JavaElement.NO_ELEMENTS; >@@ -432,9 +497,9 @@ > parameterSignatures[0] = Signature.getTypeErasure(enclosingDeclaringTypeSignature); > } > >- acceptBinaryMethod(type, selector, parameterPackageNames, parameterTypeNames, parameterSignatures, uniqueKey, isConstructor); >+ acceptBinaryMethod(type, selector, parameterPackageNames, parameterTypeNames, parameterSignatures, typeParameterNames, typeParameterBoundNames, uniqueKey, isConstructor); > } else { >- acceptSourceMethod(type, selector, parameterPackageNames, parameterTypeNames, uniqueKey); >+ acceptSourceMethod(type, selector, parameterPackageNames, parameterTypeNames, parameterSignatures, typeParameterNames, typeParameterBoundNames, uniqueKey); > } > } > } >@@ -469,7 +534,16 @@ > * > * fix for 1FWFT6Q > */ >-protected void acceptSourceMethod(IType type, char[] selector, char[][] parameterPackageNames, char[][] parameterTypeNames, char[] uniqueKey) { >+protected void acceptSourceMethod( >+ IType type, >+ char[] selector, >+ char[][] parameterPackageNames, >+ char[][] parameterTypeNames, >+ String[] parameterSignatures, >+ char[][] typeParameterNames, >+ char[][][] typeParameterBoundNames, >+ char[] uniqueKey) { >+ > String name = new String(selector); > IMethod[] methods = null; > try { >@@ -478,12 +552,15 @@ > if (methods[i].getElementName().equals(name) > && methods[i].getParameterTypes().length == parameterTypeNames.length) { > IMethod method = methods[i]; >- if (uniqueKey != null) >- method = new ResolvedSourceMethod( >+ if (uniqueKey != null) { >+ ResolvedSourceMethod resolvedMethod = new ResolvedSourceMethod( > (JavaElement)method.getParent(), > method.getElementName(), > method.getParameterTypes(), > new String(uniqueKey)); >+ resolvedMethod.occurrenceCount = method.getOccurrenceCount(); >+ method = resolvedMethod; >+ } > addElement(method); > } > } >@@ -530,6 +607,11 @@ > break; > } > } >+ >+ if (match && !areTypeParametersCompatible(method, typeParameterNames, typeParameterBoundNames)) { >+ match = false; >+ } >+ > if (match) { > addElement(method); > if(SelectionEngine.DEBUG){ >@@ -666,7 +748,45 @@ > } > this.elements[++this.elementIndex] = element; > } >- >+private boolean areTypeParametersCompatible(IMethod method, char[][] typeParameterNames, char[][][] typeParameterBoundNames) { >+ try { >+ ITypeParameter[] typeParameters = method.getTypeParameters(); >+ int length1 = typeParameters == null ? 0 : typeParameters.length; >+ int length2 = typeParameterNames == null ? 0 : typeParameterNames.length; >+ if (length1 != length2) { >+ return false; >+ } else { >+ for (int j = 0; j < length1; j++) { >+ ITypeParameter typeParameter = typeParameters[j]; >+ String typeParameterName = typeParameter.getElementName(); >+ if (!typeParameterName.equals(new String(typeParameterNames[j]))) { >+ return false; >+ } >+ >+ String[] bounds = typeParameter.getBounds(); >+ int boundCount = typeParameterBoundNames[j] == null ? 0 : typeParameterBoundNames[j].length; >+ >+ if (bounds.length != boundCount) { >+ return false; >+ } else { >+ for (int k = 0; k < boundCount; k++) { >+ String simpleName = Signature.getSimpleName(bounds[k]); >+ int index = simpleName.indexOf('<'); >+ if (index != -1) { >+ simpleName = simpleName.substring(0, index); >+ } >+ if (!simpleName.equals(new String(typeParameterBoundNames[j][k]))) { >+ return false; >+ } >+ } >+ } >+ } >+ } >+ } catch (JavaModelException e) { >+ return false; >+ } >+ return true; >+} > /* > * findLocalElement() cannot find local variable > */ >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java,v >retrieving revision 1.293 >diff -u -r1.293 Scope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 28 Nov 2006 16:47:46 -0000 1.293 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 30 Nov 2006 11:05:52 -0000 >@@ -1230,7 +1230,7 @@ > if (current instanceof ParameterizedMethodBinding) > for (int j = i + 1; j < visiblesCount; j++) > if (current.declaringClass == candidates[j].declaringClass && current.areParametersEqual(candidates[j])) >- return new ProblemMethodBinding(candidates[i].selector, candidates[i].parameters, ProblemReasons.Ambiguous); >+ return new ProblemMethodBinding(candidates[i], candidates[i].selector, candidates[i].parameters, ProblemReasons.Ambiguous); > } > } > >@@ -3138,7 +3138,7 @@ > return method; > } > if (problemMethod == null) >- return new ProblemMethodBinding(visible[0].selector, visible[0].parameters, ProblemReasons.Ambiguous); >+ return new ProblemMethodBinding(visible[0], visible[0].selector, visible[0].parameters, ProblemReasons.Ambiguous); > return problemMethod; > } > >@@ -3184,7 +3184,7 @@ > return method; > } > if (problemMethod == null) >- return new ProblemMethodBinding(visible[0].selector, visible[0].parameters, ProblemReasons.Ambiguous); >+ return new ProblemMethodBinding(visible[0], visible[0].selector, visible[0].parameters, ProblemReasons.Ambiguous); > return problemMethod; > } > >@@ -3251,7 +3251,7 @@ > } > } > } else if (count == 0) { >- return new ProblemMethodBinding(visible[0].selector, visible[0].parameters, ProblemReasons.Ambiguous); >+ return new ProblemMethodBinding(visible[0], visible[0].selector, visible[0].parameters, ProblemReasons.Ambiguous); > } > > // found several methods that are mutually acceptable -> must be equal >@@ -3389,7 +3389,7 @@ > } > > // if all moreSpecific methods are equal then see if duplicates exist because of substitution >- return new ProblemMethodBinding(visible[0].selector, visible[0].parameters, ProblemReasons.Ambiguous); >+ return new ProblemMethodBinding(visible[0], visible[0].selector, visible[0].parameters, ProblemReasons.Ambiguous); > } > > public final ClassScope outerMostClassScope() { >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemMethodBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemMethodBinding.java,v >retrieving revision 1.13 >diff -u -r1.13 ProblemMethodBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemMethodBinding.java 27 Nov 2006 17:23:19 -0000 1.13 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemMethodBinding.java 30 Nov 2006 11:05:51 -0000 >@@ -31,7 +31,7 @@ > public ProblemMethodBinding(MethodBinding closestMatch, char[] selector, TypeBinding[] args, int problemReason) { > this(selector, args, problemReason); > this.closestMatch = closestMatch; >- if (closestMatch != null) this.declaringClass = closestMatch.declaringClass; >+ if (closestMatch != null && problemReason != ProblemReasons.Ambiguous) this.declaringClass = closestMatch.declaringClass; > } > /* API > * Answer the problem id associated with the receiver. >Index: codeassist/org/eclipse/jdt/internal/codeassist/ISelectionRequestor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/ISelectionRequestor.java,v >retrieving revision 1.27 >diff -u -r1.27 ISelectionRequestor.java >--- codeassist/org/eclipse/jdt/internal/codeassist/ISelectionRequestor.java 28 Mar 2006 20:30:02 -0000 1.27 >+++ codeassist/org/eclipse/jdt/internal/codeassist/ISelectionRequestor.java 30 Nov 2006 11:05:50 -0000 >@@ -160,6 +160,8 @@ > char[][] parameterPackageNames, > char[][] parameterTypeNames, > String[] parameterSignatures, >+ char[][] typeParameterNames, >+ char[][][] typeParameterBoundNames, > boolean isConstructor, > boolean isDeclaration, > char[] uniqueKey, >Index: codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java,v >retrieving revision 1.133 >diff -u -r1.133 SelectionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java 24 Nov 2006 01:32:03 -0000 1.133 >+++ codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java 30 Nov 2006 11:05:51 -0000 >@@ -873,6 +873,31 @@ > parameterSignatures[i] = new String(getSignature(parameterTypes[i])).replace('/', '.'); > } > >+ TypeVariableBinding[] typeVariables = methodBinding.original().typeVariables; >+ length = typeVariables == null ? 0 : typeVariables.length; >+ char[][] typeParameterNames = new char[length][]; >+ char[][][] typeParameterBoundNames = new char[length][][]; >+ for (int i = 0; i < length; i++) { >+ TypeVariableBinding typeVariable = typeVariables[i]; >+ typeParameterNames[i] = typeVariable.sourceName; >+ if (typeVariable.firstBound == null) { >+ typeParameterBoundNames[i] = new char[0][]; >+ } else if (typeVariable.firstBound == typeVariable.superclass) { >+ int boundCount = 1 + (typeVariable.superInterfaces == null ? 0 : typeVariable.superInterfaces.length); >+ typeParameterBoundNames[i] = new char[boundCount][]; >+ typeParameterBoundNames[i][0] = typeVariable.superclass.sourceName; >+ for (int j = 1; j < boundCount; j++) { >+ typeParameterBoundNames[i][j] = typeVariables[i].superInterfaces[j - 1].sourceName; >+ } >+ } else { >+ int boundCount = typeVariable.superInterfaces == null ? 0 : typeVariable.superInterfaces.length; >+ typeParameterBoundNames[i] = new char[boundCount][]; >+ for (int j = 0; j < boundCount; j++) { >+ typeParameterBoundNames[i][j] = typeVariables[i].superInterfaces[j].sourceName; >+ } >+ } >+ } >+ > ReferenceBinding declaringClass = methodBinding.declaringClass; > if (isLocal(declaringClass) && this.requestor instanceof SelectionRequestor) { > ((SelectionRequestor)this.requestor).acceptLocalMethod(methodBinding); >@@ -887,6 +912,8 @@ > parameterPackageNames, > parameterTypeNames, > parameterSignatures, >+ typeParameterNames, >+ typeParameterBoundNames, > methodBinding.isConstructor(), > isDeclaration, > methodBinding.computeUniqueKey(), >@@ -1239,6 +1266,8 @@ > null, // SelectionRequestor does not need of parameters type for method declaration > null, // SelectionRequestor does not need of parameters type for method declaration > null, // SelectionRequestor does not need of parameters type for method declaration >+ null, // SelectionRequestor does not need of type parameters name for method declaration >+ null, // SelectionRequestor does not need of type parameters bounds for method declaration > method.isConstructor(), > true, > method.binding != null ? method.binding.computeUniqueKey() : null, >Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetToCuMapper.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetToCuMapper.java,v >retrieving revision 1.59 >diff -u -r1.59 CodeSnippetToCuMapper.java >--- eval/org/eclipse/jdt/internal/eval/CodeSnippetToCuMapper.java 16 Oct 2006 17:21:09 -0000 1.59 >+++ eval/org/eclipse/jdt/internal/eval/CodeSnippetToCuMapper.java 30 Nov 2006 11:05:53 -0000 >@@ -285,8 +285,8 @@ > public void acceptField(char[] declaringTypePackageName, char[] declaringTypeName, char[] name, boolean isDeclaration, char[] uniqueKey, int start, int end) { > originalRequestor.acceptField(declaringTypePackageName, declaringTypeName, name, isDeclaration, uniqueKey, start, end); > } >- public void acceptMethod(char[] declaringTypePackageName, char[] declaringTypeName, String enclosingDeclaringTypeSignature, char[] selector, char[][] parameterPackageNames, char[][] parameterTypeNames, String[] parameterSignatures, boolean isConstructor, boolean isDeclaration, char[] uniqueKey, int start, int end) { >- originalRequestor.acceptMethod(declaringTypePackageName, declaringTypeName, enclosingDeclaringTypeSignature, selector, parameterPackageNames, parameterTypeNames, parameterSignatures, isConstructor, isDeclaration, uniqueKey, start, end); >+ public void acceptMethod(char[] declaringTypePackageName, char[] declaringTypeName, String enclosingDeclaringTypeSignature, char[] selector, char[][] parameterPackageNames, char[][] parameterTypeNames, String[] parameterSignatures, char[][] typeParameterNames, char[][][] typeParameterBoundNames, boolean isConstructor, boolean isDeclaration, char[] uniqueKey, int start, int end) { >+ originalRequestor.acceptMethod(declaringTypePackageName, declaringTypeName, enclosingDeclaringTypeSignature, selector, parameterPackageNames, parameterTypeNames, parameterSignatures, typeParameterNames, typeParameterBoundNames, isConstructor, isDeclaration, uniqueKey, start, end); > } > public void acceptPackage(char[] packageName) { > originalRequestor.acceptPackage(packageName); >Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetScope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetScope.java,v >retrieving revision 1.44 >diff -u -r1.44 CodeSnippetScope.java >--- eval/org/eclipse/jdt/internal/eval/CodeSnippetScope.java 20 Oct 2006 11:02:03 -0000 1.44 >+++ eval/org/eclipse/jdt/internal/eval/CodeSnippetScope.java 30 Nov 2006 11:05:52 -0000 >@@ -312,7 +312,7 @@ > if (visibleField == null) > visibleField = field; > else >- return new ProblemFieldBinding(visibleField.declaringClass, fieldName, ProblemReasons.Ambiguous); >+ return new ProblemFieldBinding(visibleField, visibleField.declaringClass, fieldName, ProblemReasons.Ambiguous); > } else { > notVisible = true; > } >@@ -334,7 +334,7 @@ > if (visibleField == null) { > visibleField = field; > } else { >- ambiguous = new ProblemFieldBinding(visibleField.declaringClass, fieldName, ProblemReasons.Ambiguous); >+ ambiguous = new ProblemFieldBinding(visibleField, visibleField.declaringClass, fieldName, ProblemReasons.Ambiguous); > break done; > } > } else { >Index: compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java,v >retrieving revision 1.117 >diff -u -r1.117 MessageSend.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java 28 Oct 2006 04:11:27 -0000 1.117 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java 30 Nov 2006 11:05:51 -0000 >@@ -403,6 +403,7 @@ > MethodBinding closestMatch = ((ProblemMethodBinding)binding).closestMatch; > switch (this.binding.problemId()) { > case ProblemReasons.Ambiguous : >+ break; // no resilience on ambiguous > case ProblemReasons.NotVisible : > case ProblemReasons.NonStaticReferenceInConstructorInvocation : > case ProblemReasons.NonStaticReferenceInStaticContext : >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/ResolveTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests.java,v >retrieving revision 1.70 >diff -u -r1.70 ResolveTests.java >--- src/org/eclipse/jdt/core/tests/model/ResolveTests.java 24 Nov 2006 11:31:14 -0000 1.70 >+++ src/org/eclipse/jdt/core/tests/model/ResolveTests.java 30 Nov 2006 11:06:02 -0000 >@@ -76,6 +76,35 @@ > elements > ); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=165900 >+public void testAmbiguousMethod1() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Resolve/src/test/Test.java", >+ "package test;\n"+ >+ "public class Test {\n" + >+ " void foo(Test1 t) {}\n" + >+ " void foo(Test2 t) {}\n" + >+ " void bar(Object o) {\n" + >+ " foo(o);\n" + >+ " }\n" + >+ "}\n" + >+ "class Test1 {\n" + >+ "}\n" + >+ "class Test2 {\n" + >+ "}"); >+ >+ String str = this.workingCopies[0].getSource(); >+ int start = str.lastIndexOf("foo(o)"); >+ int length = "foo".length(); >+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length, this.wcOwner); >+ >+ assertElementsEqual( >+ "Unexpected elements", >+ "foo(Test1) [in Test [in [Working copy] Test.java [in test [in src [in Resolve]]]]]", >+ elements >+ ); >+} > /** > * Resolve an argument name > */ >Index: src/org/eclipse/jdt/core/tests/model/ResolveTests_1_5.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests_1_5.java,v >retrieving revision 1.52 >diff -u -r1.52 ResolveTests_1_5.java >--- src/org/eclipse/jdt/core/tests/model/ResolveTests_1_5.java 11 Apr 2006 10:10:45 -0000 1.52 >+++ src/org/eclipse/jdt/core/tests/model/ResolveTests_1_5.java 30 Nov 2006 11:06:02 -0000 >@@ -2285,4 +2285,126 @@ > deleteProject("P"); > } > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=165900 >+public void test103() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Resolve/src/test/Test.java", >+ "package test;\n"+ >+ "public class Test {\n" + >+ " <T extends Test1> void foo(T t) {}\n" + >+ " <T extends Test2> void foo(T t) {}\n" + >+ " void bar(Object o) {\n" + >+ " foo(o);\n" + >+ " }\n" + >+ "}\n" + >+ "class Test1 {\n" + >+ "}\n" + >+ "class Test2 {\n" + >+ "}"); >+ >+ String str = this.workingCopies[0].getSource(); >+ int start = str.lastIndexOf("foo(o)"); >+ int length = "foo".length(); >+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length, this.wcOwner); >+ >+ assertElementsEqual( >+ "Unexpected elements", >+ "foo(T) [in Test [in [Working copy] Test.java [in test [in src [in Resolve]]]]]", >+ elements >+ ); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=165900 >+public void test104() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Resolve/src/test/Test.java", >+ "package test;\n"+ >+ "public class Test {\n" + >+ " <T extends Test1> T foo(Test3<T> t) {return null;}\n" + >+ " <T extends Test2> T foo(Test3<T> t) {return null;}\n" + >+ " void bar(Object o) {\n" + >+ " foo(o);\n" + >+ " }\n" + >+ "}\n" + >+ "class Test1 {\n" + >+ "}\n" + >+ "class Test2 {\n" + >+ "}\n" + >+ "class Test3 <U> {\n" + >+ "}"); >+ >+ String str = this.workingCopies[0].getSource(); >+ int start = str.lastIndexOf("foo(o)"); >+ int length = "foo".length(); >+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length, this.wcOwner); >+ >+ assertElementsEqual( >+ "Unexpected elements", >+ "foo(Test3<T>) [in Test [in [Working copy] Test.java [in test [in src [in Resolve]]]]]", >+ elements >+ ); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=165900 >+public void test105() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Resolve/src/test/Test.java", >+ "package test;\n"+ >+ "public class Test {\n" + >+ " <T extends Test1> T foo(Test3<T> t) {return null;}\n" + >+ " <T extends Test2> T foo(Test3<T> t) {return null;}\n" + >+ " void bar(Test3 o) {\n" + >+ " foo(o);\n" + >+ " }\n" + >+ "}\n" + >+ "class Test1 {\n" + >+ "}\n" + >+ "class Test2 {\n" + >+ "}\n" + >+ "class Test3 <U> {\n" + >+ "}"); >+ >+ String str = this.workingCopies[0].getSource(); >+ int start = str.lastIndexOf("foo(o)"); >+ int length = "foo".length(); >+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length, this.wcOwner); >+ >+ assertElementsEqual( >+ "Unexpected elements", >+ "foo(Test3<T>) [in Test [in [Working copy] Test.java [in test [in src [in Resolve]]]]]", >+ elements >+ ); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=165900 >+public void test106() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Resolve/src/test/Test.java", >+ "package test;\n"+ >+ "public class Test {\n" + >+ " <T extends Test1> T foo(Test3<T> t) {return null;}\n" + >+ " <T extends Test2> T foo(Test3<T> t) {return null;}\n" + >+ " void bar(Test3<Object> o) {\n" + >+ " foo(o);\n" + >+ " }\n" + >+ "}\n" + >+ "class Test1 {\n" + >+ "}\n" + >+ "class Test2 {\n" + >+ "}\n" + >+ "class Test3 <U> {\n" + >+ "}"); >+ >+ String str = this.workingCopies[0].getSource(); >+ int start = str.lastIndexOf("foo(o)"); >+ int length = "foo".length(); >+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length, this.wcOwner); >+ >+ assertElementsEqual( >+ "Unexpected elements", >+ "foo(Test3<T>) [in Test [in [Working copy] Test.java [in test [in src [in Resolve]]]]]", >+ elements >+ ); >+} > } >Index: src/org/eclipse/jdt/core/tests/model/SelectionJavadocModelTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SelectionJavadocModelTests.java,v >retrieving revision 1.9 >diff -u -r1.9 SelectionJavadocModelTests.java >--- src/org/eclipse/jdt/core/tests/model/SelectionJavadocModelTests.java 25 Nov 2006 19:50:11 -0000 1.9 >+++ src/org/eclipse/jdt/core/tests/model/SelectionJavadocModelTests.java 30 Nov 2006 11:06:03 -0000 >@@ -980,7 +980,6 @@ > int[] selectionPositions = selectionInfo(workingCopies[0], "getMax", 1); > IJavaElement[] elements = workingCopies[0].codeSelect(selectionPositions[0], 0); > assertElementsEqual("Invalid selection(s)", >- "getMax(A<T>) [in X [in [Working copy] Test.java [in b165794 [in <project root> [in Tests]]]]]\n" + > "getMax(A<T>) [in X [in [Working copy] Test.java [in b165794 [in <project root> [in Tests]]]]]", > elements > );
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 165900
:
54768
|
55230