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 132460 Details for
Bug 266771
NameLookup.findPackageFragment returns very incorrect package fragments
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix and regression test
266771.txt (text/plain), 2.58 KB, created by
Jerome Lanneluc
on 2009-04-20 13:26:33 EDT
(
hide
)
Description:
Proposed fix and regression test
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2009-04-20 13:26:33 EDT
Size:
2.58 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/NameLookupTests2.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/NameLookupTests2.java,v >retrieving revision 1.26 >diff -u -r1.26 NameLookupTests2.java >--- src/org/eclipse/jdt/core/tests/model/NameLookupTests2.java 27 Jun 2008 16:02:40 -0000 1.26 >+++ src/org/eclipse/jdt/core/tests/model/NameLookupTests2.java 20 Apr 2009 17:16:15 -0000 >@@ -14,6 +14,7 @@ > > import org.eclipse.core.resources.IWorkspaceRunnable; > import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.Path; > import org.eclipse.jdt.core.*; >@@ -250,6 +251,25 @@ > } > } > /* >+ * Ensure that finding a package fragment with a path with a length equals to an external jar path length + 1 >+ * (regression test for bug 266771 NameLookup.findPackageFragment returns very incorrect package fragments) >+ */ >+public void testFindPackageFragment2() throws CoreException { >+ try { >+ JavaProject project = (JavaProject)createJavaProject("P", new String[0], new String[] {"JCL_LIB"}, "bin"); >+ NameLookup nameLookup =getNameLookup(project); >+ IPath pathToSearch = new Path(getExternalJCLPathString() + 'a'); >+ IPackageFragment pkg = nameLookup.findPackageFragment(pathToSearch); >+ assertElementEquals( >+ "Unexpected package", >+ "<null>", >+ pkg); >+ } finally { >+ deleteProject("P"); >+ } >+} >+ >+/* > * Ensure that a member type with a name ending with a dollar and a number is found > * (regression test for bug 103466 Stack Overflow: Requesting Java AST from selection) > */ >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/NameLookup.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/NameLookup.java,v >retrieving revision 1.125 >diff -u -r1.125 NameLookup.java >--- model/org/eclipse/jdt/internal/core/NameLookup.java 7 Mar 2009 00:58:57 -0000 1.125 >+++ model/org/eclipse/jdt/internal/core/NameLookup.java 20 Apr 2009 17:16:17 -0000 >@@ -414,8 +414,7 @@ > continue; > } > IPath rootPath = root.getPath(); >- int matchingCount = rootPath.matchingFirstSegments(path); >- if (matchingCount != 0) { >+ if (rootPath.isPrefixOf(path)) { > String name = path.toOSString(); > // + 1 is for the File.separatorChar > name = name.substring(rootPath.toOSString().length() + 1, name.length());
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 266771
:
132400
| 132460