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 172890 Details for
Bug 316937
JavaElement.getElementInfo(..) throws JavaModelException when trying to get info for an inner class in an external jar
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Updated patch
bug_316937.txt (text/plain), 4.32 KB, created by
Jay Arthanareeswaran
on 2010-06-28 07:13:46 EDT
(
hide
)
Description:
Updated patch
Filename:
MIME Type:
Creator:
Jay Arthanareeswaran
Created:
2010-06-28 07:13:46 EDT
Size:
4.32 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionProposal.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionProposal.java,v >retrieving revision 1.14 >diff -u -r1.14 InternalCompletionProposal.java >--- codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionProposal.java 22 Jan 2009 09:46:59 -0000 1.14 >+++ codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionProposal.java 28 Jun 2010 11:10:33 -0000 >@@ -210,11 +210,10 @@ > } > > if(type != null) { >- String[] args = new String[length]; >- for(int i = 0; i< length ; i++){ >- args[i] = new String(paramTypeNames[i]); >- } >- IMethod method = type.getMethod(new String(selector),args); >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=316937 >+ // BinaryType#getMethod() creates a new instance of BinaryMethod, which is a dummy. >+ // Instead we have to use IType#findMethods() to get a handle to the method of our interest. >+ IMethod method = findMethod(type, selector, paramTypeNames); > > if (this.hasNoParameterNamesFromIndex) { > IPackageFragmentRoot packageFragmentRoot = (IPackageFragmentRoot)type.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); >@@ -307,11 +306,10 @@ > } > > if(type != null) { >- String[] args = new String[length]; >- for(int i = 0; i< length ; i++){ >- args[i] = new String(paramTypeNames[i]); >- } >- IMethod method = type.getMethod(new String(selector),args); >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=316937 >+ // BinaryType#getMethod() creates a new instance of BinaryMethod, which is a dummy. >+ // Instead we have to use IType#findMethods() to get a handle to the method of our interest. >+ IMethod method = findMethod(type, selector, paramTypeNames); > try{ > parameters = new char[length][]; > String[] params = method.getParameterNames(); >@@ -331,6 +329,34 @@ > return parameters; > } > >+ private IMethod findMethod(IType type, char[] selector, char[][] paramTypeNames) { >+ IMethod method = null; >+ int startingIndex = 0; >+ String[] args; >+ IType enclosingType = type.getDeclaringType(); >+ // If the method is a constructor of an inner type, add the enclosing type as an >+ // additional parameter to the constructor. >+ if (enclosingType != null && CharOperation.equals(type.getElementName().toCharArray(), selector)) { >+ args = new String[paramTypeNames.length+1]; >+ startingIndex = 1; >+ args[0] = Signature.createTypeSignature(enclosingType.getFullyQualifiedName(), true); >+ } >+ else { >+ args = new String[paramTypeNames.length]; >+ } >+ int length = args.length; >+ for(int i = startingIndex; i< length ; i++){ >+ args[i] = new String(paramTypeNames[i-startingIndex]); >+ } >+ method = type.getMethod(new String(selector), args); >+ >+ IMethod[] methods = type.findMethods(method); >+ if (methods != null && methods.length > 0) { >+ method = methods[0]; >+ } >+ return method; >+ } >+ > protected char[] getDeclarationPackageName() { > return this.declarationPackageName; > } >Index: model/org/eclipse/jdt/internal/core/BinaryMethod.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java,v >retrieving revision 1.105 >diff -u -r1.105 BinaryMethod.java >--- model/org/eclipse/jdt/internal/core/BinaryMethod.java 7 Mar 2009 00:58:57 -0000 1.105 >+++ model/org/eclipse/jdt/internal/core/BinaryMethod.java 28 Jun 2010 11:10:34 -0000 >@@ -181,7 +181,10 @@ > > // try to see if we can retrieve the names from the attached javadoc > IBinaryMethod info = (IBinaryMethod) getElementInfo(); >- final int paramCount = Signature.getParameterCount(new String(info.getMethodDescriptor())); >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=316937 >+ // Use Signature#getParameterCount() only if the argument names are not already available. >+ final int paramCount = info.getArgumentNames() == null ? info.getArgumentNames().length : >+ Signature.getParameterCount(new String(info.getMethodDescriptor())); > if (paramCount != 0) { > // don't try to look for javadoc for synthetic methods > int modifiers = getFlags();
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 316937
:
171960
|
172479
|
172729
|
172890
|
175894
|
177811