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 154126 Details for
Bug 108784
SourceMapper doesn't find name range of inner class constructors
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix + regression test
patch_108784.txt (text/plain), 4.16 KB, created by
Olivier Thomann
on 2009-12-09 11:35:34 EST
(
hide
)
Description:
Proposed fix + regression test
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2009-12-09 11:35:34 EST
Size:
4.16 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/SourceMapper.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java,v >retrieving revision 1.148 >diff -u -r1.148 SourceMapper.java >--- model/org/eclipse/jdt/internal/core/SourceMapper.java 30 Sep 2009 18:57:18 -0000 1.148 >+++ model/org/eclipse/jdt/internal/core/SourceMapper.java 9 Dec 2009 16:38:04 -0000 >@@ -702,23 +702,27 @@ > IType currentType = this.types[this.typeDepth]; > int currenTypeModifiers = this.typeModifiers[this.typeDepth]; > char[][] parameterTypes = methodInfo.parameterTypes; >- if (parameterTypes != null && methodInfo.isConstructor && currentType.getDeclaringType() != null && !Flags.isStatic(currenTypeModifiers)) { >+ if (methodInfo.isConstructor && currentType.getDeclaringType() != null && !Flags.isStatic(currenTypeModifiers)) { > IType declaringType = currentType.getDeclaringType(); > String declaringTypeName = declaringType.getElementName(); > if (declaringTypeName.length() == 0) { > IClassFile classFile = declaringType.getClassFile(); >- int length = parameterTypes.length; >+ int length = parameterTypes != null ? parameterTypes.length : 0; > char[][] newParameterTypes = new char[length+1][]; > declaringTypeName = classFile.getElementName(); > declaringTypeName = declaringTypeName.substring(0, declaringTypeName.indexOf('.')); > newParameterTypes[0] = declaringTypeName.toCharArray(); >- System.arraycopy(parameterTypes, 0, newParameterTypes, 1, length); >+ if (length != 0) { >+ System.arraycopy(parameterTypes, 0, newParameterTypes, 1, length); >+ } > this.methodParameterTypes[this.typeDepth] = newParameterTypes; > } else { >- int length = parameterTypes.length; >+ int length = parameterTypes != null ? parameterTypes.length : 0; > char[][] newParameterTypes = new char[length+1][]; > newParameterTypes[0] = declaringTypeName.toCharArray(); >- System.arraycopy(parameterTypes, 0, newParameterTypes, 1, length); >+ if (length != 0) { >+ System.arraycopy(parameterTypes, 0, newParameterTypes, 1, length); >+ } > this.methodParameterTypes[this.typeDepth] = newParameterTypes; > } > } else { >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/AttachSourceTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AttachSourceTests.java,v >retrieving revision 1.64 >diff -u -r1.64 AttachSourceTests.java >--- src/org/eclipse/jdt/core/tests/model/AttachSourceTests.java 27 Aug 2009 15:26:53 -0000 1.64 >+++ src/org/eclipse/jdt/core/tests/model/AttachSourceTests.java 9 Dec 2009 16:38:05 -0000 >@@ -160,6 +160,10 @@ > " V(String s) {\n" + > " }\n" + > " }\n" + >+ " class Inner {\n" + >+ " Inner() {\n" + >+ " }\n" + >+ " }\n" + > "}" > }; > addLibrary("innerClasses.jar", "innerClassessrc.zip", pathAndContents, JavaCore.VERSION_1_4); >@@ -672,6 +676,17 @@ > IMethod constructor = classFile.getType().getMethod("V", new String[] {"Linner.X;", "Ljava.lang.String;"}); > assertSourceEquals("Unexpected name source", "V", getNameSource(classFile.getSource(), constructor)); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=108784 >+public void testGetNameRange04() throws JavaModelException { >+ IClassFile classFile = this.innerClasses.getClassFile("X$Inner.class"); >+ IMethod[] methods = classFile.getType().getMethods(); >+ for (int i = 0; i < methods.length; i++) { >+ IMethod iMethod = methods[i]; >+ ISourceRange nameRange = iMethod.getNameRange(); >+ assertTrue("Unexpected name range", nameRange.getOffset() != -1); >+ assertTrue("Unexpected name range", nameRange.getLength() != 0); >+ } >+} > /** > * Retrieves the source attachment paths for jar root. > */ >@@ -732,6 +747,10 @@ > " V(String s) {\n" + > " }\n" + > " }\n" + >+ " class Inner {\n" + >+ " Inner() {\n" + >+ " }\n" + >+ " }\n" + > "}", > type.getSource()); > }
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 108784
: 154126