Bug 529435 - [launch] Deprecation of of getClasspath and instead
getClasspathAndModulepath to be used in LaunchDelegate
Change-Id: I92a05708dc906af372cc5b2376fb5c13b7d5f73b
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaLaunchDelegate.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaLaunchDelegate.java
index 0865ea6..aff1441 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaLaunchDelegate.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaLaunchDelegate.java
@@ -14,7 +14,6 @@
package org.eclipse.jdt.launching;
import java.io.File;
-import java.lang.reflect.Method;
import java.util.Map;
import org.eclipse.core.runtime.CoreException;
@@ -62,7 +61,6 @@
}
}
- @SuppressWarnings({ "deprecation", "rawtypes" })
private VMRunnerConfiguration getVMRunnerConfiguration(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
monitor.beginTask(NLS.bind("{0}...", new String[]{configuration.getName()}), 3); //$NON-NLS-1$
@@ -91,40 +89,9 @@
// VM-specific attributes
Map<String, Object> vmAttributesMap = getVMSpecificAttributesMap(configuration);
- String[][] paths = null;
- String classpath[] = null;
- Method method = null;
- Class[] types = { ILaunchConfiguration.class };
-
- try {
- method = this.getClass().getMethod("getClasspathAndModulepath", types); //$NON-NLS-1$
- } catch (NoSuchMethodException | SecurityException e) {
- // Your exception handling goes here
- }
- if (method != null) {
- // getClasspathAndModulepath found.
- paths = getClasspathAndModulepath(configuration);
- if (paths != null && paths.length > 0 ) {
- classpath = paths[0];
- }
- } else {
- // getClasspathAndModulepath not found.
- try {
- method = this.getClass().getMethod("getClasspath", types); //$NON-NLS-1$
- } catch (NoSuchMethodException | SecurityException e) {
- }
-
- if (method != null) {
- // getClasspath found
- classpath = getClasspath(configuration);
- }
- }
- if (classpath == null) {
- return null;
- }
-
// Create VM config
- VMRunnerConfiguration runConfig = new VMRunnerConfiguration(mainTypeName, classpath);
+ // Bug 529435 :to move to getClasspathAndModulepath after java 8 is sunset
+ VMRunnerConfiguration runConfig = new VMRunnerConfiguration(mainTypeName, getClasspath(configuration));
runConfig.setProgramArguments(execArgs.getProgramArgumentsArray());
runConfig.setEnvironment(envp);
runConfig.setVMArguments(execArgs.getVMArgumentsArray());
@@ -152,6 +119,7 @@
runConfig.setBootClassPath(getBootpath(configuration));
} else if (supportsModule()) {
// module path
+ String[][] paths = getClasspathAndModulepath(configuration);
if (paths != null && paths.length > 1) {
runConfig.setModulepath(paths[1]);
}