Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJerome lanneluc2004-07-01 16:01:38 +0000
committerJerome lanneluc2004-07-01 16:01:38 +0000
commiteaa3f0b0526d26d5b7e49a3903be1f6d991ee84f (patch)
tree2527f00264016cd7cbe8125dcaa3666797c10e74
parent02c90f57645e4025eb5dbb6f49625bc13384fc0e (diff)
downloadeclipse.jdt.core-eaa3f0b0526d26d5b7e49a3903be1f6d991ee84f.tar.gz
eclipse.jdt.core-eaa3f0b0526d26d5b7e49a3903be1f6d991ee84f.tar.xz
eclipse.jdt.core-eaa3f0b0526d26d5b7e49a3903be1f6d991ee84f.zip
66512
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java18
-rw-r--r--org.eclipse.jdt.core/buildnotes_jdt-core.html4
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java10
3 files changed, 29 insertions, 3 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java
index eb7d753c34..25b436c839 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java
@@ -2058,6 +2058,23 @@ public void testInvalidExternalClassFolder() throws CoreException {
deleteProject("P");
}
}
+/*
+ * Ensures that a non existing source folder cannot be put on the classpath.
+ * (regression test for bug 66512 Invalid classpath entry not rejected)
+ */
+public void testInvalidSourceFolder() throws CoreException {
+ try {
+ createJavaProject("P1");
+ IJavaProject proj = createJavaProject("P2", new String[] {}, new String[] {}, new String[] {"/P1/src1/src2"}, "bin");
+ assertMarkers(
+ "Unexpected markers",
+ "Project P2 is missing required source folder: \'P1/src1/src2\'",
+ proj);
+ } finally {
+ deleteProject("P1");
+ deleteProject("P2");
+ }
+}
/**
* Ensures that only one marker is created if building a project that is
* missing its .classpath file multiple times.
@@ -2069,6 +2086,7 @@ public void testMissingClasspath() throws CoreException {
IProject project = javaProject.getProject();
project.close(null);
deleteFile(new File(project.getLocation().toOSString(), ".classpath"));
+ waitForAutoBuild();
project.open(null);
project.build(IncrementalProjectBuilder.FULL_BUILD, null);
diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html
index 8b1a768f1d..e2561da2f1 100644
--- a/org.eclipse.jdt.core/buildnotes_jdt-core.html
+++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html
@@ -50,7 +50,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=67789">67789</a>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66512">66512</a>
+Invalid classpath entry not rejected
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=67789">67789</a>
Java element delta from refresh contains excluded package
<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=68772">68772</a>
IDOMMember.getComments() sometimes returns wrong results.
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java
index 41ef429613..85fe235ac3 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java
@@ -345,8 +345,14 @@ public class ClasspathEntry implements IClasspathEntry {
String projSegment = path.segment(0);
if (projSegment != null && projSegment.equals(project.getElementName())) { // this project
return JavaCore.newSourceEntry(path, inclusionPatterns, exclusionPatterns, outputLocation);
- } else { // another project
- return JavaCore.newProjectEntry(path, isExported);
+ } else {
+ if (path.segmentCount() == 1) {
+ // another project
+ return JavaCore.newProjectEntry(path, isExported);
+ } else {
+ // an invalid source folder
+ return JavaCore.newSourceEntry(path, inclusionPatterns, exclusionPatterns, outputLocation);
+ }
}
case IClasspathEntry.CPE_VARIABLE :

Back to the top