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 177811 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]
Patch with testcase
bug_316937a.txt (text/plain), 4.73 KB, created by
Jay Arthanareeswaran
on 2010-08-31 03:13:33 EDT
(
hide
)
Description:
Patch with testcase
Filename:
MIME Type:
Creator:
Jay Arthanareeswaran
Created:
2010-08-31 03:13:33 EDT
Size:
4.73 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >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.106 >diff -u -r1.106 BinaryMethod.java >--- model/org/eclipse/jdt/internal/core/BinaryMethod.java 28 Jun 2010 13:07:11 -0000 1.106 >+++ model/org/eclipse/jdt/internal/core/BinaryMethod.java 31 Aug 2010 07:11:00 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -183,8 +183,15 @@ > IBinaryMethod info = (IBinaryMethod) getElementInfo(); > // 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())); >+ int paramCount = Signature.getParameterCount(new String(info.getMethodDescriptor())); >+ if (this.isConstructor()) { >+ final IType declaringType = this.getDeclaringType(); >+ if (declaringType.isMember() >+ && !Flags.isStatic(declaringType.getFlags())) { >+ paramCount--; // remove synthetic argument from constructor param count >+ } >+ } >+ > if (paramCount != 0) { > // don't try to look for javadoc for synthetic methods > int modifiers = getFlags(); >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/ClassFileTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClassFileTests.java,v >retrieving revision 1.49 >diff -u -r1.49 ClassFileTests.java >--- src/org/eclipse/jdt/core/tests/model/ClassFileTests.java 24 Feb 2010 10:44:34 -0000 1.49 >+++ src/org/eclipse/jdt/core/tests/model/ClassFileTests.java 31 Aug 2010 07:11:07 -0000 >@@ -21,6 +21,7 @@ > import org.eclipse.jdt.core.search.IJavaSearchConstants; > import org.eclipse.jdt.core.search.IJavaSearchScope; > import org.eclipse.jdt.core.search.SearchEngine; >+import org.eclipse.jdt.internal.core.ClasspathEntry; > > import junit.framework.Test; > >@@ -1543,5 +1544,55 @@ > assertStringsEqual("Type parameter bounds signatures", > "TT;\n", typeParam.getBoundsSignatures()); > } >- >+ //https://bugs.eclipse.org/bugs/show_bug.cgi?id=316937 >+ public void testBug316937() throws Exception { >+ try { >+ IJavaProject project = getJavaProject("P"); >+ String[] pathAndContents = new String[] { >+ "bug316937/Foo.java", >+ "package bug316937;\n" + "public class Foo {\n" >+ + " class Bar {\n" >+ + " public Bar(int a, int b) {}\n" + " }\n" >+ + "}\n" }; >+ addLibrary(project, "lib316937.jar", "src316937.zip", >+ pathAndContents, JavaCore.VERSION_1_5); >+ IPackageFragmentRoot packageFragRoot = project >+ .getPackageFragmentRoot(getFile("/P/lib316937.jar")); >+ >+ IType type = packageFragRoot.getPackageFragment("bug316937") >+ .getClassFile("Foo.class").getType(); >+ IType subType = type.getType("Bar"); >+ IMethod[] methods = subType.getMethods(); >+ assertEquals("Constructros", 1, methods.length); >+ IMethod method = methods[0]; >+ String[] paramNames = method.getParameterNames(); >+ assertStringsEqual("Type parameter names", "a\n" + "b\n", >+ paramNames); >+ >+ // Remove the source attachment >+ IClasspathEntry[] rawClasspath = project.getRawClasspath(); >+ for (int index = 0; index < rawClasspath.length; index++) { >+ IClasspathEntry entry = rawClasspath[index]; >+ if (entry.getPath().toString().endsWith("lib316937.jar")) { >+ ((ClasspathEntry) entry).sourceAttachmentPath = null; >+ } >+ } >+ project.setRawClasspath(rawClasspath, null); >+ >+ packageFragRoot = project >+ .getPackageFragmentRoot(getFile("/P/lib316937.jar")); >+ type = packageFragRoot.getPackageFragment("bug316937") >+ .getClassFile("Foo.class").getType(); >+ subType = type.getType("Bar"); >+ methods = subType.getMethods(); >+ assertEquals("Constructros", 1, methods.length); >+ method = methods[0]; >+ paramNames = method.getParameterNames(); >+ assertStringsEqual("Type parameter names", "a\n" + "b\n", >+ paramNames); >+ } finally { >+ removeLibrary(getJavaProject("P"), "lib316937.jar", "src316937.zip"); >+ } >+ } >+ > }
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