Bug 552196 - Project with --patch-module in .classpath cannot be run due
to "SUT specified more than once to --patch-module"
- fix support for old attribute format (module only)
Change-Id: I9f13790011e00e699c49ab87de59ab459a84f1a2
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 bdb2880..e511152 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
@@ -1179,8 +1179,14 @@
addPatchModuleLocations(moduleToLocations, moduleName, locations);
}
} else {
- // old format not specifying a location: (TODO: multiple locations?)
- addPatchModuleLocations(moduleToLocations, patchModule, entry.getLocation());
+ // old (discouraged) format without explicit paths: list all output locations of the current project
+ IJavaProject javaProject = JavaRuntime.getJavaProject(configuration);
+ addPatchModuleLocations(moduleToLocations, patchModule, toAbsolutePathsString(javaProject.getOutputLocation().toString()));
+ for (IClasspathEntry cpEntry : javaProject.getRawClasspath()) {
+ if (cpEntry.getOutputLocation() != null) {
+ addPatchModuleLocations(moduleToLocations, patchModule, toAbsolutePathsString(cpEntry.getOutputLocation().toString()));
+ }
+ }
}
}