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 31319 Details for
Bug 119545
[search] Binary java method model elements returned by SearchEngine have unresolved parameter types
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch to fix this issue
v00.txt (text/plain), 6.33 KB, created by
Frederic Fusier
on 2005-12-07 12:40:17 EST
(
hide
)
Description:
Patch to fix this issue
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2005-12-07 12:40:17 EST
Size:
6.33 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java,v >retrieving revision 1.261 >diff -u -r1.261 MatchLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java 7 Dec 2005 11:27:15 -0000 1.261 >+++ search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java 7 Dec 2005 17:33:03 -0000 >@@ -519,7 +519,36 @@ > > return createMethodHandle(type, new String(method.selector), parameterTypeSignatures); > } >- >+/* >+ * Create binary method handle >+ */ >+IMethod createBinaryMethodHandle(IType type, char[] methodSelector, char[][] argumentTypeNames, MatchLocator locator) { >+ ClassFileReader reader = MatchLocator.classFileReader(type); >+ if (reader != null) { >+ IBinaryMethod[] methods = reader.getMethods(); >+ if (methods != null) { >+ int argCount = argumentTypeNames == null ? 0 : argumentTypeNames.length; >+ nextMethod : for (int i = 0, methodsLength = methods.length; i < methodsLength; i++) { >+ IBinaryMethod binaryMethod = methods[i]; >+ char[] selector = binaryMethod.getSelector(); >+ if (CharOperation.equals(selector, methodSelector)) { >+ char[] signature = binaryMethod.getGenericSignature(); >+ if (signature == null) signature = binaryMethod.getMethodDescriptor(); >+ char[][] parameterTypes = Signature.getParameterTypes(signature); >+ if (argCount != parameterTypes.length) continue nextMethod; >+ for (int j = 0; j < argCount; j++) { >+ char[] parameterTypeName = ClassFileMatchLocator.convertClassFileFormat(parameterTypes[j]); >+ if (!CharOperation.endsWith(Signature.toCharArray(Signature.getTypeErasure(parameterTypeName)), argumentTypeNames[j])) >+ continue nextMethod; >+ parameterTypes[j] = parameterTypeName; >+ } >+ return (IMethod) locator.createMethodHandle(type, new String(selector), CharOperation.toStrings(parameterTypes)); >+ } >+ } >+ } >+ } >+ return null; >+} > /* > * Create method handle. > * Store occurences for create handle to retrieve possible duplicate ones. >Index: search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java,v >retrieving revision 1.61 >diff -u -r1.61 MethodLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java 5 Dec 2005 20:38:39 -0000 1.61 >+++ search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java 7 Dec 2005 17:33:04 -0000 >@@ -483,22 +483,35 @@ > if (type == null) return; // case of a secondary type > > char[] bindingSelector = methodBinding.selector; >+ boolean isBinary = type.isBinary(); >+ IMethod method = null; > TypeBinding[] parameters = methodBinding.original().parameters; > int parameterLength = parameters.length; >- String[] parameterTypes = new String[parameterLength]; >- for (int i = 0; i < parameterLength; i++) { >- char[] typeName = parameters[i].shortReadableName(); >- if (parameters[i].isMemberType()) { >- typeName = CharOperation.subarray(typeName, CharOperation.indexOf('.', typeName)+1, typeName.length); >+ if (isBinary) { >+ char[][] parameterTypes = new char[parameterLength][]; >+ for (int i = 0; i<parameterLength; i++) { >+ char[] typeName = parameters[i].qualifiedSourceName(); >+ for (int j=0, dim=parameters[i].dimensions(); j<dim; j++) { >+ typeName = CharOperation.concat(typeName, new char[] {'[', ']'}); >+ } >+ parameterTypes[i] = typeName; > } >- parameterTypes[i] = Signature.createTypeSignature(typeName, false); >+ method = locator.createBinaryMethodHandle(type, methodBinding.selector, parameterTypes, locator); >+ } else { >+ String[] parameterTypes = new String[parameterLength]; >+ for (int i = 0; i < parameterLength; i++) { >+ char[] typeName = parameters[i].shortReadableName(); >+ if (parameters[i].isMemberType()) { >+ typeName = CharOperation.subarray(typeName, CharOperation.indexOf('.', typeName)+1, typeName.length); >+ } >+ parameterTypes[i] = Signature.createTypeSignature(typeName, false); >+ } >+ method = type.getMethod(new String(bindingSelector), parameterTypes); > } >- IMethod method = type.getMethod(new String(bindingSelector), parameterTypes); > if (knownMethods.includes(method)) return; > > knownMethods.add(method); > IResource resource = type.getResource(); >- boolean isBinary = type.isBinary(); > IBinaryType info = null; > if (isBinary) { > if (resource == null) >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java,v >retrieving revision 1.55 >diff -u -r1.55 JavaSearchBugsTests.java >--- src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 25 Nov 2005 16:45:12 -0000 1.55 >+++ src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 7 Dec 2005 17:33:09 -0000 >@@ -46,7 +46,7 @@ > // org.eclipse.jdt.internal.codeassist.SelectionEngine.DEBUG = true; > // TESTS_PREFIX = "testBug110336"; > // TESTS_NAMES = new String[] { "testBug110336e" }; >-// TESTS_NUMBERS = new int[] { 79267 }; >+ TESTS_NUMBERS = new int[] { 119545 }; > // TESTS_RANGE = new int[] { 83304, -1 }; > } > >@@ -5549,4 +5549,26 @@ > collector > ); > } >+ >+/** >+ * @test Bug 119545: [search] Binary java method model elements returned by SearchEngine have unresolved parameter types >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=119545" >+ */ >+public void testBug119545() throws CoreException { >+ workingCopies = new ICompilationUnit[1]; >+ workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b119545/Test.java", >+ "package b119545;\n" + >+ "class Test {\n" + >+ " void foo(Object o1, Object o2){\n" + >+ " if (o1.equals(o2)) {}\n" + >+ " }\n" + >+ "}\n" >+ ); >+ IType type = workingCopies[0].getType("Test"); >+ IMethod method = type.getMethods()[0]; >+ searchDeclarationsOfSentMessages(method, this.resultCollector); >+ assertSearchResults( >+ "???" >+ ); >+} > }
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 119545
:
31266
| 31319