Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJerome lanneluc2004-09-21 11:51:18 -0400
committerJerome lanneluc2004-09-21 11:51:18 -0400
commitb43c3c90323b24a060bc84126348dcf5d375f78d (patch)
tree83e1c42525a32a9659aa0fcc96f7975e9678de8b
parentc3f79cd9d543e5866196df576186e0ab74965eb0 (diff)
downloadeclipse.jdt.core-b43c3c90323b24a060bc84126348dcf5d375f78d.tar.gz
eclipse.jdt.core-b43c3c90323b24a060bc84126348dcf5d375f78d.tar.xz
eclipse.jdt.core-b43c3c90323b24a060bc84126348dcf5d375f78d.zip
74014
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AttachSourceTests.java20
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/.classpath1
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/test5.jarbin0 -> 1513 bytes
-rw-r--r--org.eclipse.jdt.core/buildnotes_jdt-core.html4
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java7
5 files changed, 28 insertions, 4 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AttachSourceTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AttachSourceTests.java
index e9079f085c..d49d65de89 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AttachSourceTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AttachSourceTests.java
@@ -670,4 +670,24 @@ public void testRootPath11() throws JavaModelException {
root.close();
}
+/**
+ * Attach a jar with a source attachement that is itself. The jar contains 2 root paths for the same class file.
+ * (regression test for bug 74014 prefix path for source attachements - automatic detection does not seem to work)
+ */
+public void testRootPath12() throws JavaModelException {
+ IJavaProject project = this.getJavaProject("/AttachSourceTests");
+ IPackageFragmentRoot root = project.getPackageFragmentRoot(this.getFile("/AttachSourceTests/test5.jar"));
+ attachSource(root, "/AttachSourceTests/test5.jar", null);
+
+ IClassFile cf = root.getPackageFragment("p1.p2").getClassFile("X.class");
+ assertSourceEquals(
+ "Unexpected source for class file",
+ "package p1.p2;\n" +
+ "public class X {\n" +
+ "}\n",
+ cf.getSource());
+ attachSource(root, null, null); // detach source
+ root.close();
+}
+
}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/.classpath b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/.classpath
index 9990816db7..643bef8a9c 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/.classpath
+++ b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/.classpath
@@ -7,6 +7,7 @@
<classpathentry kind="lib" path="full.jar"/>
<classpathentry kind="lib" path="test2.jar"/>
<classpathentry kind="lib" path="test4.jar"/>
+ <classpathentry kind="lib" path="test5.jar"/>
<classpathentry kind="lib" path="lib"/>
<classpathentry kind="src" path="src" output="src"/>
<classpathentry kind="var" path="JCL_LIB"/>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/test5.jar b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/test5.jar
new file mode 100644
index 0000000000..62fc165e30
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/test5.jar
Binary files differ
diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html
index 2721acecf7..1ae3083e03 100644
--- a/org.eclipse.jdt.core/buildnotes_jdt-core.html
+++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html
@@ -48,7 +48,9 @@ What's new in this drop</h2>
</ul>
<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=73330">73330</a>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=74014">74014</a>
+prefix path for source attachements - automatic detection does not seem to work
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=73330">73330</a>
NullPointerException in search
<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=73995">73995</a>
[Javadoc] Wrong warning for missing return type description for @return {@inheritDoc}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java
index d969ade44d..8e4b2c7372 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java
@@ -387,14 +387,15 @@ public class SourceMapper
zip = manager.getZipFile(this.sourcePath);
for (Enumeration entries = zip.entries(); entries.hasMoreElements(); ) {
ZipEntry entry = (ZipEntry) entries.nextElement();
- if (!entry.isDirectory()) {
- IPath path = new Path(entry.getName());
+ String entryName;
+ if (!entry.isDirectory() && Util.isJavaFileName(entryName = entry.getName())) {
+ IPath path = new Path(entryName);
int segmentCount = path.segmentCount();
if (segmentCount > 1) {
loop: for (int i = 0, max = path.segmentCount() - 1; i < max; i++) {
if (firstLevelPackageNames.contains(path.segment(i))) {
this.rootPaths.add(path.uptoSegment(i).toString());
- break loop;
+ // don't break here as this path could contain other first level package names (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=74014)
}
if (i == max - 1 && containsADefaultPackage) {
this.rootPaths.add(path.uptoSegment(max).toString());

Back to the top