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 246984 Details for
Bug 431357
[search] Search API got wrong result, when searching for method references, where the parameter is a member type of another type.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Proposed Patch
Fix-for-Bug-431357-search-Search-API-got-wrong-resul.patch (text/plain), 21.24 KB, created by
Manoj N Palat
on 2014-09-11 19:34:28 EDT
(
hide
)
Description:
Proposed Patch
Filename:
MIME Type:
Creator:
Manoj N Palat
Created:
2014-09-11 19:34:28 EDT
Size:
21.24 KB
patch
obsolete
>diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java >index e03059e..3e492c9 100644 >--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java >+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java >@@ -80,6 +80,7 @@ > import org.eclipse.jdt.internal.core.search.indexing.IndexRequest; > import org.eclipse.jdt.internal.core.search.matching.AndPattern; > import org.eclipse.jdt.internal.core.search.matching.MatchLocator; >+import org.eclipse.jdt.internal.core.search.matching.MethodPattern; > import org.eclipse.jdt.internal.core.search.matching.PatternLocator; > import org.eclipse.jdt.internal.core.search.matching.TypeDeclarationPattern; > >@@ -13426,5 +13427,447 @@ > "src/b400919/X.java b400919.X2 [Marker] EXACT_MATCH" > ); > } >+/** @bug 431357 >+ * [search] Search API got wrong result, when searching for method references, where the parameter is a member type of another type. >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=431357" >+ */ >+public void testBug431357_001() throws CoreException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java", >+ "interface I { \n" + >+ " public void query(Foo.InnerKey key);// Search result of method query(Foo.InnerKey) returns the method query(Bar.InnerKey) too \n" + >+ " public void query(Bar.InnerKey key);\n" + >+ "}\n" + >+ "\n" + >+ "class Foo { \n" + >+ " static class InnerKey {}\n" + >+ "}\n" + >+ "class Bar {\n" + >+ " static class InnerKey {}\n" + >+ "}\n" + >+ "\n" + >+ "class X {\n" + >+ " public static void foo(I i, Foo.InnerKey key) {\n" + >+ " i.query(key);\n" + >+ " }\n" + >+ " public static void bar(I i, Bar.InnerKey key) {\n" + >+ " i.query(key);\n" + >+ " }\n" + >+ " public static I getInstance() {\n" + >+ " return null;\n" + >+ " }\n" + >+ "}\n" >+ ); >+ >+ String str = this.workingCopies[0].getSource(); >+ String selection = "query"; >+ int start = str.indexOf(selection); >+ int length = selection.length(); >+ >+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length); >+ MethodPattern pattern = (MethodPattern) SearchPattern.createPattern(elements[0], REFERENCES, EXACT_RULE | ERASURE_RULE); >+ >+ new SearchEngine(this.workingCopies).search(pattern, >+ new SearchParticipant[] {SearchEngine.getDefaultSearchParticipant()}, >+ getJavaSearchWorkingCopiesScope(), >+ this.resultCollector, >+ null); >+ assertSearchResults( >+ "src/X.java void X.foo(I, Foo.InnerKey) [query(key)] EXACT_MATCH" >+ ); >+} >+/** @bug 431357 >+ * [search] Search API got wrong result, when searching for method references, where the parameter is a member type of another type. >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=431357" >+ */ >+public void testBug431357_002() throws CoreException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java", >+ "interface I { \n" + >+ " public void query(Foo.InnerKey key);// Search result of method query(Foo.InnerKey) returns the method query(Bar.InnerKey) too \n" + >+ " public void query(Bar.InnerKey key);\n" + >+ "}\n" + >+ "\n" + >+ "class Foo { \n" + >+ " static class InnerKey {}\n" + >+ "}\n" + >+ "class Bar {\n" + >+ " static class InnerKey {}\n" + >+ "}\n" + >+ "\n" + >+ "class X {\n" + >+ " public static void foo(I i, Foo.InnerKey key) {\n" + >+ " i.query(key);\n" + >+ " }\n" + >+ " public static void bar(I i, Bar.InnerKey key) {\n" + >+ " i.query(key);\n" + >+ " }\n" + >+ " public static I getInstance() {\n" + >+ " return null;\n" + >+ " }\n" + >+ "}\n" >+ ); >+ >+ String str = this.workingCopies[0].getSource(); >+ String selection = "query"; >+ int start = str.indexOf(selection); >+ int length = selection.length(); >+ >+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length); >+ MethodPattern pattern = (MethodPattern) SearchPattern.createPattern(elements[0], REFERENCES | IMPLEMENTORS, EXACT_RULE | ERASURE_RULE); >+ >+ new SearchEngine(this.workingCopies).search(pattern, >+ new SearchParticipant[] {SearchEngine.getDefaultSearchParticipant()}, >+ getJavaSearchWorkingCopiesScope(), >+ this.resultCollector, >+ null); >+ assertSearchResults( "src/X.java void I.query(Foo.InnerKey) [query] EXACT_MATCH\n" + >+ "src/X.java void X.foo(I, Foo.InnerKey) [query(key)] EXACT_MATCH" >+ ); >+} >+/** @bug 431357 >+ * [search] Search API got wrong result, when searching for method references, where the parameter is a member type of another type. >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=431357" >+ */ >+public void testBug431357_003() throws CoreException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java", >+ "interface I { \n" + >+ " public void query(Foo.InnerKey key);// Search result of method query(Foo.InnerKey) returns the method query(Bar.InnerKey) too \n" + >+ " public void query/*here*/(Bar.InnerKey key);\n" + >+ "}\n" + >+ "\n" + >+ "class Foo { \n" + >+ " static class InnerKey {}\n" + >+ "}\n" + >+ "class Bar {\n" + >+ " static class InnerKey {}\n" + >+ "}\n" + >+ "\n" + >+ "class X {\n" + >+ " public static void foo(I i, Foo.InnerKey key) {\n" + >+ " i.query(key);\n" + >+ " }\n" + >+ " public static void bar(I i, Bar.InnerKey key) {\n" + >+ " i.query(key);\n" + >+ " }\n" + >+ " public static I getInstance() {\n" + >+ " return null;\n" + >+ " }\n" + >+ "}\n" >+ ); >+ >+ String str = this.workingCopies[0].getSource(); >+ String selection = "query/*here*/"; >+ int start = str.indexOf(selection); >+ int length = "query".length(); >+ >+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length); >+ MethodPattern pattern = (MethodPattern) SearchPattern.createPattern(elements[0], REFERENCES | IMPLEMENTORS, EXACT_RULE | ERASURE_RULE); >+ >+ new SearchEngine(this.workingCopies).search(pattern, >+ new SearchParticipant[] {SearchEngine.getDefaultSearchParticipant()}, >+ getJavaSearchWorkingCopiesScope(), >+ this.resultCollector, >+ null); >+ assertSearchResults("src/X.java void I.query(Bar.InnerKey) [query] EXACT_MATCH\n" + >+ "src/X.java void X.bar(I, Bar.InnerKey) [query(key)] EXACT_MATCH" >+ ); >+} >+/** @bug 431357 >+ * [search] Search API got wrong result, when searching for method references, where the parameter is a member type of another type. >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=431357" >+ */ >+public void testBug431357_004() throws CoreException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java", >+ "// --\n" + >+ "interface I { \n" + >+ " public void query/*here*/(Foo.Key key);// Search result of method query(Foo.Key) returns the method query(Bar.Key) too \n" + >+ " public void query(Key key);\n" + >+ "}\n" + >+ "\n" + >+ "class Foo { \n" + >+ " static class Key { \n" + >+ " }\n" + >+ " public static void foo(I i, Key key) {\n" + >+ " i.query(key);\n" + >+ " }\n" + >+ " \n" + >+ "}\n" + >+ "\n" + >+ "class Key {\n" + >+ " \n" + >+ "}\n" + >+ "class Bar {\n" + >+ " \n" + >+ " public static void bar(I i, Key key) {\n" + >+ " i.query(key);\n" + >+ " }\n" + >+ "}\n" + >+ "\n" + >+ "public class X {\n" + >+ " public static I getInstance() {\n" + >+ " return null;\n" + >+ " }\n" + >+ "}\n" >+ ); >+ >+ String str = this.workingCopies[0].getSource(); >+ String selection = "query/*here*/"; >+ int start = str.indexOf(selection); >+ int length = "query".length(); >+ >+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length); >+ MethodPattern pattern = (MethodPattern) SearchPattern.createPattern(elements[0], REFERENCES | IMPLEMENTORS, EXACT_RULE | ERASURE_RULE); >+ >+ new SearchEngine(this.workingCopies).search(pattern, >+ new SearchParticipant[] {SearchEngine.getDefaultSearchParticipant()}, >+ getJavaSearchWorkingCopiesScope(), >+ this.resultCollector, >+ null); >+ assertSearchResults( >+ "src/X.java void I.query(Foo.Key) [query] EXACT_MATCH\n" + >+ "src/X.java void Foo.foo(I, Key) [query(key)] EXACT_MATCH" >+ ); >+} >+/** @bug 431357 >+ * [search] Search API got wrong result, when searching for method references, where the parameter is a member type of another type. >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=431357" >+ */ >+public void testBug431357_005() throws CoreException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java", >+ "// --\n" + >+ "interface I { \n" + >+ " public void query(Foo.Key key);// Search result of method query(Foo.Key) returns the method query(Bar.Key) too \n" + >+ " public void query/*here*/(Key key);\n" + >+ "}\n" + >+ "\n" + >+ "class Foo { \n" + >+ " static class Key { \n" + >+ " }\n" + >+ " public static void foo(I i, Key key) {\n" + >+ " i.query(key);\n" + >+ " }\n" + >+ " \n" + >+ "}\n" + >+ "\n" + >+ "class Key {\n" + >+ " \n" + >+ "}\n" + >+ "class Bar {\n" + >+ " \n" + >+ " public static void bar(I i, Key key) {\n" + >+ " i.query(key);\n" + >+ " }\n" + >+ "}\n" + >+ "\n" + >+ "public class X {\n" + >+ " public static I getInstance() {\n" + >+ " return null;\n" + >+ " }\n" + >+ "}\n" >+ ); >+ >+ String str = this.workingCopies[0].getSource(); >+ String selection = "query/*here*/"; >+ int start = str.indexOf(selection); >+ int length = "query".length(); >+ >+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length); >+ MethodPattern pattern = (MethodPattern) SearchPattern.createPattern(elements[0], REFERENCES | IMPLEMENTORS, EXACT_RULE | ERASURE_RULE); >+ >+ new SearchEngine(this.workingCopies).search(pattern, >+ new SearchParticipant[] {SearchEngine.getDefaultSearchParticipant()}, >+ getJavaSearchWorkingCopiesScope(), >+ this.resultCollector, >+ null); >+ assertSearchResults( >+ "src/X.java void I.query(Key) [query] EXACT_MATCH\n" + >+ "src/X.java void Bar.bar(I, Key) [query(key)] EXACT_MATCH" >+ ); >+} >+/** @bug 431357 >+ * [search] Search API got wrong result, when searching for method references, where the parameter is a member type of another type. >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=431357" >+ */ >+public void testBug431357_006() throws CoreException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java", >+ "// --\n" + >+ "interface I { \n" + >+ " public void query/*here*/(Foo.Key key);// Search result of method query(Foo.Key) returns the method query(Bar.Key) too \n" + >+ " public void query(Key key);\n" + >+ " public void query(Bar.Key key);\n" + >+ "}\n" + >+ "\n" + >+ "class Foo { \n" + >+ " static class Key { \n" + >+ " }\n" + >+ " public static void foo(I i, Key key) {\n" + >+ " i.query(key);\n" + >+ " }\n" + >+ " \n" + >+ "}\n" + >+ "\n" + >+ "class Key {\n" + >+ " \n" + >+ "}\n" + >+ "class Bar {\n" + >+ " static class Key {\n" + >+ " \n" + >+ " } \n" + >+ " public static void bar(I i, Key key) {\n" + >+ " i.query(key);\n" + >+ " }\n" + >+ "}\n" + >+ "\n" + >+ "public class X {\n" + >+ " public static I getInstance() {\n" + >+ " return null;\n" + >+ " }\n" + >+ " public static void bar(I i, Key key) {\n" + >+ " i.query(key);\n" + >+ " }\n" + >+ "}\n" >+ ); >+ >+ String str = this.workingCopies[0].getSource(); >+ String selection = "query/*here*/"; >+ int start = str.indexOf(selection); >+ int length = "query".length(); >+ >+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length); >+ MethodPattern pattern = (MethodPattern) SearchPattern.createPattern(elements[0], REFERENCES | IMPLEMENTORS, EXACT_RULE | ERASURE_RULE); >+ >+ new SearchEngine(this.workingCopies).search(pattern, >+ new SearchParticipant[] {SearchEngine.getDefaultSearchParticipant()}, >+ getJavaSearchWorkingCopiesScope(), >+ this.resultCollector, >+ null); >+ assertSearchResults( >+ "src/X.java void I.query(Foo.Key) [query] EXACT_MATCH\n" + >+ "src/X.java void Foo.foo(I, Key) [query(key)] EXACT_MATCH" >+ ); >+} >+public void testBug431357_007() throws CoreException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java", >+ "// --\n" + >+ "interface I { \n" + >+ " public void query(Foo.Key key);// Search result of method query(Foo.Key) returns the method query(Bar.Key) too \n" + >+ " public void query/*here*/(Key key);\n" + >+ " public void query(Bar.Key key);\n" + >+ "}\n" + >+ "\n" + >+ "class Foo { \n" + >+ " static class Key { \n" + >+ " }\n" + >+ " public static void foo(I i, Key key) {\n" + >+ " i.query(key);\n" + >+ " }\n" + >+ " \n" + >+ "}\n" + >+ "\n" + >+ "class Key {\n" + >+ " \n" + >+ "}\n" + >+ "class Bar {\n" + >+ " static class Key {\n" + >+ " \n" + >+ " } \n" + >+ " public static void bar(I i, Key key) {\n" + >+ " i.query(key);\n" + >+ " }\n" + >+ "}\n" + >+ "\n" + >+ "public class X {\n" + >+ " public static I getInstance() {\n" + >+ " return null;\n" + >+ " }\n" + >+ " public static void bar(I i, Key key) {\n" + >+ " i.query(key);\n" + >+ " }\n" + >+ "}\n" >+ ); >+ >+ String str = this.workingCopies[0].getSource(); >+ String selection = "query/*here*/"; >+ int start = str.indexOf(selection); >+ int length = "query".length(); >+ >+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length); >+ MethodPattern pattern = (MethodPattern) SearchPattern.createPattern(elements[0], REFERENCES | IMPLEMENTORS, EXACT_RULE | ERASURE_RULE); >+ >+ new SearchEngine(this.workingCopies).search(pattern, >+ new SearchParticipant[] {SearchEngine.getDefaultSearchParticipant()}, >+ getJavaSearchWorkingCopiesScope(), >+ this.resultCollector, >+ null); >+ assertSearchResults( >+ "src/X.java void I.query(Key) [query] EXACT_MATCH\n" + >+ "src/X.java void X.bar(I, Key) [query(key)] EXACT_MATCH" >+ ); >+} >+public void testBug431357_008() throws CoreException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java", >+ "// --\n" + >+ "interface I { \n" + >+ " public void query(Foo.Key key);// Search result of method query(Foo.Key) returns the method query(Bar.Key) too \n" + >+ " public void query(Key key);\n" + >+ " public void query/*here*/(Bar.Key key);\n" + >+ "}\n" + >+ "\n" + >+ "class Foo { \n" + >+ " static class Key { \n" + >+ " }\n" + >+ " public static void foo(I i, Key key) {\n" + >+ " i.query(key);\n" + >+ " }\n" + >+ " \n" + >+ "}\n" + >+ "\n" + >+ "class Key {\n" + >+ " \n" + >+ "}\n" + >+ "class Bar {\n" + >+ " static class Key {\n" + >+ " \n" + >+ " } \n" + >+ " public static void bar(I i, Key key) {\n" + >+ " i.query(key);\n" + >+ " }\n" + >+ "}\n" + >+ "\n" + >+ "public class X {\n" + >+ " public static I getInstance() {\n" + >+ " return null;\n" + >+ " }\n" + >+ " public static void bar(I i, Key key) {\n" + >+ " i.query(key);\n" + >+ " }\n" + >+ "}\n" >+ ); >+ >+ String str = this.workingCopies[0].getSource(); >+ String selection = "query/*here*/"; >+ int start = str.indexOf(selection); >+ int length = "query".length(); >+ >+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length); >+ MethodPattern pattern = (MethodPattern) SearchPattern.createPattern(elements[0], REFERENCES | IMPLEMENTORS, EXACT_RULE | ERASURE_RULE); >+ >+ new SearchEngine(this.workingCopies).search(pattern, >+ new SearchParticipant[] {SearchEngine.getDefaultSearchParticipant()}, >+ getJavaSearchWorkingCopiesScope(), >+ this.resultCollector, >+ null); >+ assertSearchResults( >+ "src/X.java void I.query(Bar.Key) [query] EXACT_MATCH\n" + >+ "src/X.java void Bar.bar(I, Key) [query(key)] EXACT_MATCH" >+ ); >+} > // Add new tests in JavaSearchBugsTests2 > } >\ No newline at end of file >diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java >index 9c80563..9ae1ea0 100644 >--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java >+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java >@@ -953,6 +953,25 @@ > } > return null; > } >+ >+private boolean isSameQualifier(char[] patternParameterQualification, char[] methodQualifiedSourceName, char[] sourceName) { >+ String methodParameterQualification = null; >+ if (methodQualifiedSourceName != null) { >+ String qualifier = String.valueOf(methodQualifiedSourceName); >+ int l = qualifier.lastIndexOf(String.valueOf(sourceName)) - 1; >+ if (l > 0) { >+ methodParameterQualification = qualifier.substring(0, l); >+ } >+ } >+ >+ String patternParameterQualifier = patternParameterQualification != null ? String.valueOf(patternParameterQualification) : null; >+ if (patternParameterQualifier == null && methodParameterQualification == null) >+ return true; >+ if (patternParameterQualifier != null && methodParameterQualification != null) >+ return patternParameterQualifier.equals(methodParameterQualification); >+ return false; >+} >+ > private MethodBinding getMethodBinding0(MethodPattern methodPattern) { > if (this.unitScope == null) return null; > // Try to get binding from cache >@@ -982,6 +1001,7 @@ > int methodsLength = methods.length; > TypeVariableBinding[] refTypeVariables = referenceBinding.typeVariables(); > int typeVarLength = refTypeVariables==null ? 0 : refTypeVariables.length; >+ int possibleIndex = -1; > for (int i=0; i<methodsLength; i++) { > TypeBinding[] methodParameters = methods[i].parameters; > int paramLength = methodParameters==null ? 0 : methodParameters.length; >@@ -990,9 +1010,10 @@ > boolean found = false; > if (methodParameters != null && paramLength == paramTypeslength) { > for (int p=0; p<paramLength; p++) { >- if (CharOperation.equals(methodParameters[p].sourceName(), parameterTypes[p])) { >- // param erasure match >- found = true; >+ char[] sourceName = methodParameters[p].sourceName(); >+ if (CharOperation.equals(sourceName, parameterTypes[p])) { >+ found = isSameQualifier(methodPattern.parameterQualifications[p], methodParameters[p].qualifiedSourceName(), sourceName); >+ possibleIndex = i; > } else { > // type variable > found = false; >@@ -1023,6 +1044,10 @@ > return methods[i]; > } > } >+ if (possibleIndex > -1 && possibleIndex < methodsLength) { >+ this.bindings.put(methodPattern, methods[possibleIndex]); >+ return methods[possibleIndex]; >+ } > } > } > this.bindings.put(methodPattern, new ProblemMethodBinding(methodPattern.selector, null, ProblemReasons.NotFound)); >diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java >index 61bc89c..bb05861 100644 >--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java >+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java >@@ -313,22 +313,36 @@ > for (int i = 0; i < parameterCount; i++) { > TypeBinding argType = method.parameters[i]; > int newLevel = IMPOSSIBLE_MATCH; >- if (argType.isMemberType()) { >- // only compare source name for member type (bug 41018) >- newLevel = CharOperation.match(this.pattern.parameterSimpleNames[i], argType.sourceName(), this.isCaseSensitive) >- ? ACCURATE_MATCH >- : IMPOSSIBLE_MATCH; >+ boolean foundLevel = false; >+ if (argType.isMemberType() || this.pattern.parameterQualifications[i] != null) { >+ MethodBinding focusMethodBinding = this.matchLocator.getMethodBinding(this.pattern); >+ if (focusMethodBinding != null) {// textual comparison insufficient >+ TypeBinding[] parameters = focusMethodBinding.parameters; >+ if (parameters.length >= parameterCount) { >+ newLevel = argType.isCompatibleWith((parameters[i])) ? ACCURATE_MATCH : IMPOSSIBLE_MATCH; >+ foundLevel = true; >+ } >+ } >+ if (!foundLevel) { // a safety net >+ // only compare source name for member type (bug 41018) >+ newLevel = CharOperation.match(this.pattern.parameterSimpleNames[i], argType.sourceName(), this.isCaseSensitive) >+ ? ACCURATE_MATCH >+ : IMPOSSIBLE_MATCH; >+ } > } else { >- // TODO (frederic) use this call to refine accuracy on parameter types >+ if (!foundLevel) >+ // TODO (frederic) use this call to refine accuracy on parameter types > // newLevel = resolveLevelForType(this.pattern.parameterSimpleNames[i], this.pattern.parameterQualifications[i], this.pattern.parametersTypeArguments[i], 0, argType); >- newLevel = resolveLevelForType(this.pattern.parameterSimpleNames[i], this.pattern.parameterQualifications[i], argType); >+ newLevel = resolveLevelForType(this.pattern.parameterSimpleNames[i], this.pattern.parameterQualifications[i], argType); > } > if (level > newLevel) { > if (newLevel == IMPOSSIBLE_MATCH) { > if (skipImpossibleArg) { > // Do not consider match as impossible while finding declarations and source level >= 1.5 > // (see bugs https://bugs.eclipse.org/bugs/show_bug.cgi?id=79990, 96761, 96763) >- newLevel = level; >+ if (!foundLevel) { >+ newLevel = level; >+ } > } else if (argType.isTypeVariable()) { > newLevel = level; > foundTypeVariable = true;
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 431357
:
245177
|
246151
|
246299
|
246984
|
247051
|
247094
|
248117