Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTill Brychcy2018-01-11 07:27:36 +0000
committerTill Brychcy2018-01-18 07:14:45 +0000
commit7fdbf0a21cf4c7c181878a6f359281f4416283f2 (patch)
tree344bc303fdb28a423d2e714f61972e725916c61b
parentadbbe57376c48d6eba0aec37773ee51c702da795 (diff)
downloadeclipse.jdt.debug-7fdbf0a21cf4c7c181878a6f359281f4416283f2.tar.gz
eclipse.jdt.debug-7fdbf0a21cf4c7c181878a6f359281f4416283f2.tar.xz
eclipse.jdt.debug-7fdbf0a21cf4c7c181878a6f359281f4416283f2.zip
Bug 529334 - [9][testsources][launching] Add --add-reads m=ALL-UNNAMED
if launching with test code and non-empty build classpath Change-Id: I425a4cbc240925e870ae8905eb61c0e8736d83ee
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/AbstractJavaLaunchConfigurationDelegate.java18
1 files changed, 18 insertions, 0 deletions
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 f2c5655ad..583cc5538 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
@@ -51,6 +51,7 @@ import org.eclipse.jdt.core.IJavaModelMarker;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IModuleDescription;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.provisional.JavaModelAccess;
import org.eclipse.jdt.debug.core.IJavaDebugTarget;
import org.eclipse.jdt.debug.core.IJavaMethodBreakpoint;
import org.eclipse.jdt.debug.core.JDIDebugModel;
@@ -1182,6 +1183,23 @@ public abstract class AbstractJavaLaunchConfigurationDelegate extends LaunchConf
sb.append(entry.getValue());
}
+ boolean excludeTestCode = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_EXCLUDE_TEST_CODE, false);
+ if (!excludeTestCode) {
+ // TODO: revisit to examine other possible solutions
+ IJavaProject project = getJavaProject(configuration);
+ if (project != null) {
+ for (String moduleName : JavaModelAccess.determineModulesOfProjectsWithNonEmptyClasspath(project)) {
+ if (sb.length() > 0) {
+ sb.append(' ');
+ }
+ sb.append("--add-reads"); //$NON-NLS-1$
+ sb.append(' ');
+ sb.append(moduleName);
+ sb.append('=');
+ sb.append("ALL-UNNAMED"); //$NON-NLS-1$
+ }
+ }
+ }
return sb.toString();
}
}

Back to the top