Bug 522395 - [9][JUnit] Cannot run JUnit tests with JDK 9
Change-Id: Ie9357c6d535a1b3346f6e6b2100d1d70ba34bf97
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/AbstractJavaLaunchConfigurationDelegate.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/AbstractJavaLaunchConfigurationDelegate.java
index 9738ffb..eab8aeb 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/AbstractJavaLaunchConfigurationDelegate.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/AbstractJavaLaunchConfigurationDelegate.java
@@ -41,9 +41,7 @@
import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
import org.eclipse.jdt.core.IJavaModelMarker;
import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.debug.core.IJavaDebugTarget;
import org.eclipse.jdt.debug.core.IJavaMethodBreakpoint;
import org.eclipse.jdt.debug.core.JDIDebugModel;
@@ -415,22 +413,13 @@
List<String> userEntries = new ArrayList<>(entries.length);
Set<String> set = new HashSet<>(entries.length);
- IJavaProject proj = JavaRuntime.getJavaProject(configuration);
for (int i = 0; i < entries.length; i++) {
if (entries[i].getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) {
String location = entries[i].getLocation();
if (location != null) {
if (!set.contains(location)) {
- if (proj != null && proj.getModuleDescription() != null) {
- if (isModuleEntry(proj, entries[i])) {
- continue;
- }
- userEntries.add(location);
- set.add(location);
- } else {
- userEntries.add(location);
- set.add(location);
- }
+ userEntries.add(location);
+ set.add(location);
}
}
}
@@ -485,31 +474,6 @@
return path;
}
- private boolean isModuleEntry(IJavaProject proj, IRuntimeClasspathEntry entry) throws JavaModelException {
- switch (entry.getType()) {
- case IRuntimeClasspathEntry.PROJECT:
- IResource resource = entry.getResource();
- if (resource != null && resource.getType() == IResource.PROJECT) {
- IJavaProject javaProject = JavaCore.create((IProject) resource);
- if (proj.getElementName().equals(javaProject.getElementName()) || javaProject.getModuleDescription() != null) {
- return true;
- }
- }
- break;
- default:
- if (entry.isAutomodule()) {
- return true;
- }
- // This is based on the assumption that the entries don't contain any container or variable entries.
- IPackageFragmentRoot root = proj.findPackageFragmentRoot(entry.getPath());
- if (root != null && root.getModuleDescription() != null) {
- return true;
- }
- break;
- }
- return false;
- }
-
/**
* Returns the Java project specified by the given launch configuration, or
* <code>null</code> if none.