Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jdt.debug.jdi.tests/JDI Debug Tests.launch2
-rw-r--r--org.eclipse.jdt.debug.tests/java8/EvalTest18.java4
-rw-r--r--org.eclipse.jdt.debug.tests/pom.xml2
-rw-r--r--org.eclipse.jdt.debug.tests/test plugin/org/eclipse/jdt/debug/testplugin/JavaProjectHelper.java22
-rw-r--r--org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java4
-rw-r--r--org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java4
-rw-r--r--org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/EvalTestSuite.java4
-rwxr-xr-xorg.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ConditionalBreakpointsTests.java4
-rw-r--r--org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ClasspathContainerTests.java8
-rw-r--r--org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/Java8Tests.java4
-rw-r--r--org.eclipse.jdt.debug.ui/.settings/.api_filters23
-rw-r--r--org.eclipse.jdt.debug.ui/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.jdt.debug.ui/pom.xml2
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaConnectTab.java11
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaDependenciesTab.java513
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaJRETab.java62
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/core/refactoring/BreakpointChange.java8
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/IJavaDebugHelpContextIds.java3
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/TypeNameResolver.java8
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java8
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathContentProvider.java12
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathEntry.java7
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathMessages.java5
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathMessages.properties2
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathModel.java7
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/DependenciesContentProvider.java58
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/DependencyModel.java140
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaExceptionHyperLink.java8
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaStackTraceHyperlink.java7
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/AppletLaunchConfigurationUtils.java12
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/LauncherMessages.java9
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/LauncherMessages.properties9
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/LocalJavaApplicationTabGroup.java27
-rw-r--r--org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTEvaluationEngine.java88
-rw-r--r--org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/BinaryBasedSourceGenerator.java17
-rw-r--r--org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationSourceGenerator.java3
-rw-r--r--org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/SourceBasedSourceGenerator.java19
-rw-r--r--org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/connect/ConnectMessages.properties10
-rw-r--r--org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaDebugUtils.java8
-rw-r--r--org.eclipse.jdt.launching/.settings/.api_filters204
-rw-r--r--org.eclipse.jdt.launching/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/AbstractRuntimeClasspathEntry.java7
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/DefaultEntryResolver.java5
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/DefaultProjectClasspathEntry.java4
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/JavaFxLibraryResolver.java2
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/JavaLaunchableTester.java7
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/LaunchingMessages.java6
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/LaunchingMessages.properties4
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/RuntimeClasspathEntry.java25
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMDebugger.java22
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMRunner.java46
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMType.java80
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironment.java17
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironmentAnalyzer.java10
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/AbstractJavaLaunchConfigurationDelegate.java62
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/AbstractVMRunner.java36
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/IJavaLaunchConfigurationConstants.java11
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/IRuntimeClasspathEntry.java24
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaLaunchDelegate.java29
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaRuntime.java353
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/StandardClasspathProvider.java20
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/VMRunnerConfiguration.java46
-rw-r--r--org.eclipse.jdt.launching/plugin.properties3
-rw-r--r--org.eclipse.jdt.launching/plugin.xml7
-rw-r--r--org.eclipse.jdt.launching/pom.xml4
65 files changed, 1955 insertions, 227 deletions
diff --git a/org.eclipse.jdt.debug.jdi.tests/JDI Debug Tests.launch b/org.eclipse.jdt.debug.jdi.tests/JDI Debug Tests.launch
index e626027b6..dfae7fbe2 100644
--- a/org.eclipse.jdt.debug.jdi.tests/JDI Debug Tests.launch
+++ b/org.eclipse.jdt.debug.jdi.tests/JDI Debug Tests.launch
@@ -6,7 +6,7 @@
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
-<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.debug.jdi.tests.TestAll"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.jdt.debug.jdi.tests"/>
</launchConfiguration>
diff --git a/org.eclipse.jdt.debug.tests/java8/EvalTest18.java b/org.eclipse.jdt.debug.tests/java8/EvalTest18.java
index e7f148e5c..3eeedd5d1 100644
--- a/org.eclipse.jdt.debug.tests/java8/EvalTest18.java
+++ b/org.eclipse.jdt.debug.tests/java8/EvalTest18.java
@@ -5,10 +5,6 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* Jesper Steen Møller - initial API and implementation
*******************************************************************************/
diff --git a/org.eclipse.jdt.debug.tests/pom.xml b/org.eclipse.jdt.debug.tests/pom.xml
index ce626c721..7ad17c838 100644
--- a/org.eclipse.jdt.debug.tests/pom.xml
+++ b/org.eclipse.jdt.debug.tests/pom.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2012, 2016 Eclipse Foundation and others.
+ Copyright (c) 2012, 2017 Eclipse Foundation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
diff --git a/org.eclipse.jdt.debug.tests/test plugin/org/eclipse/jdt/debug/testplugin/JavaProjectHelper.java b/org.eclipse.jdt.debug.tests/test plugin/org/eclipse/jdt/debug/testplugin/JavaProjectHelper.java
index 6ca7e4210..5ce5facb5 100644
--- a/org.eclipse.jdt.debug.tests/test plugin/org/eclipse/jdt/debug/testplugin/JavaProjectHelper.java
+++ b/org.eclipse.jdt.debug.tests/test plugin/org/eclipse/jdt/debug/testplugin/JavaProjectHelper.java
@@ -5,10 +5,6 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Jesper S. Møller - bug 422029: [1.8] Enable debug evaluation support for default methods
@@ -98,6 +94,15 @@ public class JavaProjectHelper {
public static boolean isJava8Compatible() {
return isCompatible(8);
}
+
+ /**
+ * Returns if the currently running VM is version compatible with Java 9
+ *
+ * @return <code>true</code> if a Java 9 (or greater) VM is running <code>false</code> otherwise
+ */
+ public static boolean isJava9Compatible() {
+ return isCompatible(9);
+ }
/**
* Returns if the currently running VM is version compatible with Java 7
*
@@ -146,6 +151,15 @@ public class JavaProjectHelper {
}
} catch (NumberFormatException e) {
}
+ } else if (nums.length == 1) {
+ try {
+ int major = Integer.parseInt(nums[0]);
+ if (major >= ver) {
+ return true;
+ }
+ }
+ catch (NumberFormatException e) {
+ }
}
}
return false;
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
index 395fb8fd2..168352476 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
@@ -5,10 +5,6 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Jesper Steen Møller - bug 422029: [1.8] Enable debug evaluation support for default methods
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java
index 0a53ae7a4..01b981621 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java
@@ -250,7 +250,9 @@ public class AutomatedSuite extends DebugSuite {
addTest(new TestSuite(ClasspathContainerTests.class));
addTest(new TestSuite(RuntimeClasspathEntryTests.class));
addTest(new TestSuite(ClasspathProviderTests.class));
- addTest(new TestSuite(BootpathTests.class));
+ if (!JavaProjectHelper.isJava9Compatible()) {
+ addTest(new TestSuite(BootpathTests.class));
+ }
addTest(new TestSuite(EEDefinitionTests.class));
//VM Install/Environment tests
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/EvalTestSuite.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/EvalTestSuite.java
index 7cd7ae87c..1e4d378c2 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/EvalTestSuite.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/EvalTestSuite.java
@@ -5,10 +5,6 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Jesper S. Møller - bug 422029: [1.8] Enable debug evaluation support for default methods
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ConditionalBreakpointsTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ConditionalBreakpointsTests.java
index 6648dc56c..e204929cb 100755
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ConditionalBreakpointsTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ConditionalBreakpointsTests.java
@@ -195,7 +195,7 @@ public class ConditionalBreakpointsTests extends AbstractDebugTest {
public void testSuspendLongRunningCondition() throws Exception {
String typeName = "MethodLoop";
IJavaLineBreakpoint first = createLineBreakpoint(19, typeName);
- createConditionalLineBreakpoint(29, typeName, "for (int x = 0; x < 1000; x++) { System.out.println(x); Thread.sleep(30); } return true;", true);
+ createConditionalLineBreakpoint(29, typeName, "for (int x = 0; x < 1000; x++) { System.out.println(x);} Thread.sleep(200); return true;", true);
IJavaThread thread= null;
try {
@@ -203,7 +203,7 @@ public class ConditionalBreakpointsTests extends AbstractDebugTest {
IStackFrame top = thread.getTopStackFrame();
assertNotNull("Missing top frame", top);
thread.resume();
- Thread.sleep(3000);
+ Thread.sleep(100);
thread.suspend();
assertTrue("Thread should be suspended", thread.isSuspended());
IJavaStackFrame frame = (IJavaStackFrame) thread.getTopStackFrame();
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ClasspathContainerTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ClasspathContainerTests.java
index 250f578f6..8aa727a1c 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ClasspathContainerTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ClasspathContainerTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -183,6 +183,9 @@ public class ClasspathContainerTests extends AbstractDebugTest {
public void testJREContainerIndex() throws Exception {
// get the current VM
IVMInstall def = JavaRuntime.getDefaultVMInstall();
+ if (JavaRuntime.isModularJava(def)) {
+ return;
+ }
LibraryLocation[] libs = JavaRuntime.getLibraryLocations(def);
// generate an index for the first library location only (to save time - do not need an index for all libraries)
URL indexURL = this.getIndexForLibrary(libs[0]);
@@ -225,6 +228,9 @@ public class ClasspathContainerTests extends AbstractDebugTest {
public void testJREContainerIndex2() throws Exception {
// get the current VM
IVMInstall def = JavaRuntime.getDefaultVMInstall();
+ if (JavaRuntime.isModularJava(def)) {
+ return;
+ }
LibraryLocation[] libs = JavaRuntime.getLibraryLocations(def);
// generate an index for the first library location only (to save time - do not need an index for all libraries)
URL indexURL = this.getIndexForLibrary(libs[0]);
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/Java8Tests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/Java8Tests.java
index 9603f9680..c4a06d6d0 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/Java8Tests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/Java8Tests.java
@@ -5,10 +5,6 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* Jesper S. Møller - initial API and implementation
* Jesper Steen Møller - bug 426903: [1.8] Cannot evaluate super call to default method
diff --git a/org.eclipse.jdt.debug.ui/.settings/.api_filters b/org.eclipse.jdt.debug.ui/.settings/.api_filters
index 2a6baacac..58b8e3a24 100644
--- a/org.eclipse.jdt.debug.ui/.settings/.api_filters
+++ b/org.eclipse.jdt.debug.ui/.settings/.api_filters
@@ -1,5 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.jdt.debug.ui" version="2">
+ <resource path="META-INF/MANIFEST.MF">
+ <filter id="924844039">
+ <message_arguments>
+ <message_argument value="3.8.0"/>
+ <message_argument value="3.8.0"/>
+ </message_arguments>
+ </filter>
+ <filter id="924844039">
+ <message_arguments>
+ <message_argument value="3.8.50"/>
+ <message_argument value="3.8.1"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaClasspathTab.java" type="org.eclipse.jdt.debug.ui.launchConfigurations.JavaClasspathTab">
<filter comment="Known illegal extension" id="576720909">
<message_arguments>
@@ -8,6 +22,15 @@
</message_arguments>
</filter>
</resource>
+ <resource path="ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaDependenciesTab.java" type="org.eclipse.jdt.debug.ui.launchConfigurations.JavaDependenciesTab">
+ <filter id="1108344834">
+ <message_arguments>
+ <message_argument value="3.9"/>
+ <message_argument value="3.8"/>
+ <message_argument value="org.eclipse.jdt.debug.ui.launchConfigurations.JavaDependenciesTab"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathEntry.java" type="org.eclipse.jdt.internal.debug.ui.classpath.ClasspathEntry">
<filter comment="Known illegal implementation" id="574619656">
<message_arguments>
diff --git a/org.eclipse.jdt.debug.ui/META-INF/MANIFEST.MF b/org.eclipse.jdt.debug.ui/META-INF/MANIFEST.MF
index 9bbda6258..c95f11dc0 100644
--- a/org.eclipse.jdt.debug.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.debug.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.debug.ui; singleton:=true
-Bundle-Version: 3.8.100.qualifier
+Bundle-Version: 3.9.0.qualifier
Bundle-Activator: org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/org.eclipse.jdt.debug.ui/pom.xml b/org.eclipse.jdt.debug.ui/pom.xml
index 822dab080..eedde7e04 100644
--- a/org.eclipse.jdt.debug.ui/pom.xml
+++ b/org.eclipse.jdt.debug.ui/pom.xml
@@ -18,7 +18,7 @@
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.debug.ui</artifactId>
- <version>3.8.100-SNAPSHOT</version>
+ <version>3.9.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
<code.ignoredWarnings>-warn:+resource,-deprecation,unavoidableGenericProblems</code.ignoredWarnings>
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaConnectTab.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaConnectTab.java
index ba53ed9b9..b34400546 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaConnectTab.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaConnectTab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -32,7 +32,6 @@ import org.eclipse.jdt.internal.debug.ui.launcher.LauncherMessages;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jdt.launching.IVMConnector;
import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.jface.action.LegacyActionTools;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.ComboFieldEditor;
import org.eclipse.jface.preference.FieldEditor;
@@ -363,13 +362,7 @@ public class JavaConnectTab extends AbstractJavaMainTab implements IPropertyChan
if (editor instanceof StringFieldEditor) {
String value = ((StringFieldEditor)editor).getStringValue();
if (!arg.isValid(value)) {
- // Remove mnemonics from the label
- String errorLabel = LegacyActionTools.removeMnemonics(arg.label());
- // Remove ":" from the end
- if (errorLabel.lastIndexOf(':') == errorLabel.length() - 1) {
- errorLabel = errorLabel.substring(0, errorLabel.length() - 1);
- }
- setErrorMessage(errorLabel + LauncherMessages.JavaConnectTab__is_invalid__5);
+ setErrorMessage(arg.label() + LauncherMessages.JavaConnectTab__is_invalid__5);
return false;
}
}
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaDependenciesTab.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaDependenciesTab.java
new file mode 100644
index 000000000..35629ff25
--- /dev/null
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaDependenciesTab.java
@@ -0,0 +1,513 @@
+/*******************************************************************************
+ * Copyright (c) 2017 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.debug.ui.launchConfigurations;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.jdt.internal.debug.ui.IJavaDebugHelpContextIds;
+import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
+import org.eclipse.jdt.internal.debug.ui.JavaDebugImages;
+import org.eclipse.jdt.internal.debug.ui.actions.AddAdvancedAction;
+import org.eclipse.jdt.internal.debug.ui.actions.AddExternalFolderAction;
+import org.eclipse.jdt.internal.debug.ui.actions.AddExternalJarAction;
+import org.eclipse.jdt.internal.debug.ui.actions.AddFolderAction;
+import org.eclipse.jdt.internal.debug.ui.actions.AddJarAction;
+import org.eclipse.jdt.internal.debug.ui.actions.AddLibraryAction;
+import org.eclipse.jdt.internal.debug.ui.actions.AddProjectAction;
+import org.eclipse.jdt.internal.debug.ui.actions.AddVariableAction;
+import org.eclipse.jdt.internal.debug.ui.actions.AttachSourceAction;
+import org.eclipse.jdt.internal.debug.ui.actions.EditClasspathEntryAction;
+import org.eclipse.jdt.internal.debug.ui.actions.MoveDownAction;
+import org.eclipse.jdt.internal.debug.ui.actions.MoveUpAction;
+import org.eclipse.jdt.internal.debug.ui.actions.RemoveAction;
+import org.eclipse.jdt.internal.debug.ui.actions.RestoreDefaultEntriesAction;
+import org.eclipse.jdt.internal.debug.ui.actions.RuntimeClasspathAction;
+import org.eclipse.jdt.internal.debug.ui.classpath.BootpathFilter;
+import org.eclipse.jdt.internal.debug.ui.classpath.ClasspathEntry;
+import org.eclipse.jdt.internal.debug.ui.classpath.ClasspathLabelProvider;
+import org.eclipse.jdt.internal.debug.ui.classpath.ClasspathModel;
+import org.eclipse.jdt.internal.debug.ui.classpath.DependenciesContentProvider;
+import org.eclipse.jdt.internal.debug.ui.classpath.DependencyModel;
+import org.eclipse.jdt.internal.debug.ui.classpath.IClasspathEntry;
+import org.eclipse.jdt.internal.debug.ui.classpath.RuntimeClasspathViewer;
+import org.eclipse.jdt.internal.debug.ui.launcher.LauncherMessages;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * A launch configuration tab that displays and edits the user and bootstrap classes comprising the classpath launch configuration attribute.
+ * <p>
+ * Clients may call {@link #setHelpContextId(String)} on this tab prior to control creation to alter the default context help associated with this
+ * tab.
+ * </p>
+ * <p>
+ * This class may be instantiated.
+ * </p>
+ *
+ * @since 3.9
+ * @noextend This class is not intended to be sub-classed by clients.
+ */
+public class JavaDependenciesTab extends JavaClasspathTab {
+
+ private DependencyModel fModel;
+
+ protected static final String DIALOG_SETTINGS_PREFIX = "JavaDependenciesTab"; //$NON-NLS-1$
+
+ /**
+ * The last launch config this tab was initialized from
+ */
+ protected ILaunchConfiguration fLaunchConfiguration;
+
+ /**
+ * Constructor
+ */
+ public JavaDependenciesTab() {
+ setHelpContextId(IJavaDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_DEPENDENCIES_TAB);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createControl(Composite parent) {
+ Font font = parent.getFont();
+
+ Composite comp = new Composite(parent, SWT.NONE);
+ setControl(comp);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), getHelpContextId());
+ GridLayout topLayout = new GridLayout();
+ topLayout.numColumns = 2;
+ comp.setLayout(topLayout);
+ GridData gd;
+
+ Label label = new Label(comp, SWT.NONE);
+ label.setText(LauncherMessages.JavaDependenciesTab_0);
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+ gd.horizontalSpan = 2;
+ label.setLayoutData(gd);
+
+ fClasspathViewer = new RuntimeClasspathViewer(comp);
+ fClasspathViewer.addEntriesChangedListener(this);
+ fClasspathViewer.getTreeViewer().getControl().setFont(font);
+ fClasspathViewer.getTreeViewer().setLabelProvider(new ClasspathLabelProvider());
+ fClasspathViewer.getTreeViewer().setContentProvider(new DependenciesContentProvider(this));
+ if (!isShowBootpath()) {
+ fClasspathViewer.getTreeViewer().addFilter(new BootpathFilter());
+ }
+
+ Composite pathButtonComp = new Composite(comp, SWT.NONE);
+ GridLayout pathButtonLayout = new GridLayout();
+ pathButtonLayout.marginHeight = 0;
+ pathButtonLayout.marginWidth = 0;
+ pathButtonComp.setLayout(pathButtonLayout);
+ gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
+ pathButtonComp.setLayoutData(gd);
+ pathButtonComp.setFont(font);
+
+ createPathButtons(pathButtonComp);
+ }
+
+ /**
+ * Creates the buttons to manipulate the classpath.
+ *
+ * @param pathButtonComp composite buttons are contained in
+ * @since 3.0
+ */
+ @Override
+ protected void createPathButtons(Composite pathButtonComp) {
+ List<RuntimeClasspathAction> advancedActions = new ArrayList<>(5);
+
+ createButton(pathButtonComp, new MoveUpAction(fClasspathViewer));
+ createButton(pathButtonComp, new MoveDownAction(fClasspathViewer));
+ createButton(pathButtonComp, new RemoveAction(fClasspathViewer));
+ createButton(pathButtonComp, new AddProjectAction(fClasspathViewer));
+ createButton(pathButtonComp, new AddJarAction(fClasspathViewer));
+ createButton(pathButtonComp, new AddExternalJarAction(fClasspathViewer, DIALOG_SETTINGS_PREFIX));
+
+ RuntimeClasspathAction action = new AddFolderAction(null);
+ advancedActions.add(action);
+
+ action = new AddExternalFolderAction(null, DIALOG_SETTINGS_PREFIX);
+ advancedActions.add(action);
+
+ action = new AddVariableAction(null);
+ advancedActions.add(action);
+
+ action = new AddLibraryAction(null);
+ advancedActions.add(action);
+
+ action = new AttachSourceAction(null, SWT.RADIO);
+ advancedActions.add(action);
+
+ IAction[] adv = advancedActions.toArray(new IAction[advancedActions.size()]);
+ createButton(pathButtonComp, new AddAdvancedAction(fClasspathViewer, adv));
+
+ action = new EditClasspathEntryAction(fClasspathViewer, getLaunchConfiguration());
+ createButton(pathButtonComp, action);
+
+ action= new RestoreDefaultEntriesAction(fClasspathViewer, this);
+ createButton(pathButtonComp, action);
+ action.setEnabled(true);
+ }
+
+ /**
+ * Creates a button for the given action.
+ *
+ * @param pathButtonComp parent composite for the button
+ * @param action the action triggered by the button
+ * @return the button that was created
+ */
+ @Override
+ protected Button createButton(Composite pathButtonComp, RuntimeClasspathAction action) {
+ Button button = createPushButton(pathButtonComp, action.getText(), null);
+ action.setButton(button);
+ return button;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ @Override
+ public void initializeFrom(ILaunchConfiguration configuration) {
+ refresh(configuration);
+ fClasspathViewer.getTreeViewer().expandToLevel(2);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ @Override
+ public void activated(ILaunchConfigurationWorkingCopy workingCopy) {
+ try {
+ boolean useDefault= workingCopy.getAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, true);
+ if (useDefault) {
+ if (!isDefaultClasspath(getCurrentClasspath(), workingCopy)) {
+ initializeFrom(workingCopy);
+ return;
+ }
+ }
+ fClasspathViewer.getTreeViewer().refresh();
+ } catch (CoreException e) {
+ }
+ }
+
+ /**
+ * Refreshes the classpath entries based on the current state of the given
+ * launch configuration.
+ * @param configuration the configuration
+ */
+ private void refresh(ILaunchConfiguration configuration) {
+ setErrorMessage(null);
+
+ setLaunchConfiguration(configuration);
+ try {
+ createDependencyModel(configuration);
+ } catch (CoreException e) {
+ setErrorMessage(e.getMessage());
+ }
+
+ fClasspathViewer.setLaunchConfiguration(configuration);
+ fClasspathViewer.getTreeViewer().setInput(fModel);
+ setDirty(false);
+ }
+
+ private void createDependencyModel(ILaunchConfiguration configuration) throws CoreException {
+ fModel = new DependencyModel();
+ IRuntimeClasspathEntry[] entries= JavaRuntime.computeUnresolvedRuntimeClasspath(configuration);
+ IRuntimeClasspathEntry entry;
+ for (int i = 0; i < entries.length; i++) {
+ entry= entries[i];
+ switch (entry.getClasspathProperty()) {
+ case IRuntimeClasspathEntry.MODULE_PATH:
+ fModel.addEntry(DependencyModel.MODULE_PATH, entry);
+ break;
+ default:
+ if (JavaRuntime.isModule(entry.getClasspathEntry(), JavaRuntime.getJavaProject(configuration))) {
+ fModel.addEntry(DependencyModel.MODULE_PATH, entry);
+ } else {
+ fModel.addEntry(DependencyModel.CLASS_PATH, entry);
+ }
+ break;
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ @Override
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ if (isDirty()) {
+ IRuntimeClasspathEntry[] classpath = getCurrentClasspath();
+ boolean def = isDefaultClasspath(classpath, configuration);
+ if (def) {
+ configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, (String)null);
+ configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, (String)null);
+ } else {
+ configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false);
+ try {
+ List<String> moduleMementos = new ArrayList<>(classpath.length);
+ List<String> classpathMementos = new ArrayList<>(classpath.length);
+ for (int i = 0; i < classpath.length; i++) {
+ IRuntimeClasspathEntry entry = classpath[i];
+ if (entry.getClasspathProperty() == IRuntimeClasspathEntry.MODULE_PATH) {
+ moduleMementos.add(entry.getMemento());
+ } else {
+ classpathMementos.add(entry.getMemento());
+ }
+ }
+ configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, classpathMementos);
+ configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MODULEPATH, moduleMementos);
+ } catch (CoreException e) {
+ JDIDebugUIPlugin.statusDialog(LauncherMessages.JavaClasspathTab_Unable_to_save_classpath_1, e.getStatus());
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns the classpath entries currently specified by this tab.
+ *
+ * @return the classpath entries currently specified by this tab
+ */
+ private IRuntimeClasspathEntry[] getCurrentClasspath() {
+ IClasspathEntry[] modulepath = fModel.getEntries(DependencyModel.MODULE_PATH);
+ IClasspathEntry[] classpath = fModel.getEntries(DependencyModel.CLASS_PATH);
+ List<IRuntimeClasspathEntry> entries = new ArrayList<>(modulepath.length + classpath.length);
+ IClasspathEntry modulepathEntry;
+ IRuntimeClasspathEntry entry;
+ for (int i = 0; i < modulepath.length; i++) {
+ modulepathEntry= modulepath[i];
+ entry = null;
+ if (modulepathEntry instanceof ClasspathEntry) {
+ entry = ((ClasspathEntry)modulepathEntry).getDelegate();
+ } else if (modulepathEntry instanceof IRuntimeClasspathEntry) {
+ entry= (IRuntimeClasspathEntry) modulepath[i];
+ }
+ if (entry != null) {
+ // if (entry.getClasspathProperty() == IRuntimeClasspathEntry.CLASS_PATH) {
+ entry.setClasspathProperty(IRuntimeClasspathEntry.MODULE_PATH);
+ // }
+ entries.add(entry);
+ }
+ }
+ IClasspathEntry classpathEntry;
+ for (int i = 0; i < classpath.length; i++) {
+ classpathEntry= classpath[i];
+ entry = null;
+ if (classpathEntry instanceof ClasspathEntry) {
+ entry = ((ClasspathEntry)classpathEntry).getDelegate();
+ } else if (classpathEntry instanceof IRuntimeClasspathEntry) {
+ entry= (IRuntimeClasspathEntry) classpath[i];
+ }
+ if (entry != null) {
+ entry.setClasspathProperty(IRuntimeClasspathEntry.CLASS_PATH);
+ entries.add(entry);
+ }
+ }
+ return entries.toArray(new IRuntimeClasspathEntry[entries.size()]);
+ }
+
+ /**
+ * Returns whether the specified classpath is equivalent to the
+ * default classpath for this configuration.
+ *
+ * @param classpath classpath to compare to default
+ * @param configuration original configuration
+ * @return whether the specified classpath is equivalent to the
+ * default classpath for this configuration
+ */
+ private boolean isDefaultClasspath(IRuntimeClasspathEntry[] classpath, ILaunchConfiguration configuration) {
+ try {
+ ILaunchConfigurationWorkingCopy wc = configuration.getWorkingCopy();
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, true);
+ IRuntimeClasspathEntry[] entries= JavaRuntime.computeUnresolvedRuntimeClasspath(wc);
+ if (classpath.length == entries.length) {
+ for (int i = 0; i < entries.length; i++) {
+ IRuntimeClasspathEntry entry = entries[i];
+ if (!entry.equals(classpath[i])) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+ } catch (CoreException e) {
+ return false;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
+ */
+ @Override
+ public String getName() {
+ return LauncherMessages.JavaDependenciesTab_Dependencies_3;
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#getId()
+ *
+ * @since 3.3
+ */
+ @Override
+ public String getId() {
+ return "org.eclipse.jdt.debug.ui.javaDependenciesTab"; //$NON-NLS-1$
+ }
+
+ /**
+ * Returns the image for this tab, or <code>null</code> if none
+ *
+ * @return the image for this tab, or <code>null</code> if none
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage()
+ */
+ public static Image getClasspathImage() {
+ return JavaDebugImages.get(JavaDebugImages.IMG_OBJS_CLASSPATH);
+ }
+
+ /**
+ * Sets the launch configuration for this classpath tab
+ * @param config the backing {@link ILaunchConfiguration}
+ */
+ private void setLaunchConfiguration(ILaunchConfiguration config) {
+ fLaunchConfiguration = config;
+ }
+
+ /**
+ * Returns the current launch configuration
+ * @return the backing {@link ILaunchConfiguration}
+ */
+ @Override
+ public ILaunchConfiguration getLaunchConfiguration() {
+ return fLaunchConfiguration;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose()
+ */
+ @Override
+ public void dispose() {
+ if (fClasspathViewer != null) {
+ fClasspathViewer.removeEntriesChangedListener(this);
+ }
+ super.dispose();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage()
+ */
+ @Override
+ public Image getImage() {
+ return getClasspathImage();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ @Override
+ public boolean isValid(ILaunchConfiguration launchConfig) {
+ setErrorMessage(null);
+ setMessage(null);
+ String projectName= null;
+ try {
+ projectName= launchConfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$
+ } catch (CoreException e) {
+ return false;
+ }
+ if (projectName.length() > 0) {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IStatus status = workspace.validateName(projectName, IResource.PROJECT);
+ if (status.isOK()) {
+ IProject project= ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ if (!project.exists()) {
+ setErrorMessage(NLS.bind(LauncherMessages.JavaMainTab_20, new String[] {projectName}));
+ return false;
+ }
+ if (!project.isOpen()) {
+ setErrorMessage(NLS.bind(LauncherMessages.JavaMainTab_21, new String[] {projectName}));
+ return false;
+ }
+ } else {
+ setErrorMessage(NLS.bind(LauncherMessages.JavaMainTab_19, new String[]{status.getMessage()}));
+ return false;
+ }
+ }
+
+ IRuntimeClasspathEntry [] entries = fModel.getAllEntries();
+ int type = -1;
+ for (int i=0; i<entries.length; i++) {
+ type = entries[i].getType();
+ if (type == IRuntimeClasspathEntry.ARCHIVE) {
+ if(!entries[i].getPath().isAbsolute()) {
+ setErrorMessage(NLS.bind(LauncherMessages.JavaClasspathTab_Invalid_runtime_classpath_1, new String[]{entries[i].getPath().toString()}));
+ return false;
+ }
+ }
+ if(type == IRuntimeClasspathEntry.PROJECT) {
+ IResource res = entries[i].getResource();
+ if(res != null && !res.isAccessible()) {
+ setErrorMessage(NLS.bind(LauncherMessages.JavaClasspathTab_1, new String[]{res.getName()}));
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns whether the bootpath should be displayed.
+ *
+ * @return whether the bootpath should be displayed
+ * @since 3.0
+ */
+ @Override
+ public boolean isShowBootpath() {
+ return true;
+ }
+
+ /**
+ * @return Returns the classpath model.
+ */
+ @Override
+ protected ClasspathModel getModel() {
+ return fModel;
+ }
+}
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaJRETab.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaJRETab.java
index 12e3da980..cbef81ee3 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaJRETab.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaJRETab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -24,6 +24,9 @@ import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.internal.ui.SWTFactory;
+import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer;
+import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
@@ -41,6 +44,7 @@ import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
import org.eclipse.jdt.ui.ISharedImages;
import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.osgi.util.NLS;
@@ -65,6 +69,7 @@ import org.eclipse.ui.PlatformUI;
* @noextend This class is not intended to be sub-classed by clients.
*/
+@SuppressWarnings("restriction")
public class JavaJRETab extends JavaLaunchTab {
// JRE Block
@@ -80,6 +85,8 @@ public class JavaJRETab extends JavaLaunchTab {
// State
protected boolean fIsInitializing = false;
+ private boolean fCurrentJREModular;
+
// Selection changed listener (checked JRE)
private IPropertyChangeListener fCheckListener = new IPropertyChangeListener() {
@@ -497,6 +504,7 @@ public class JavaJRETab extends JavaLaunchTab {
protected void setLaunchConfiguration(ILaunchConfiguration launchConfiguration) {
fLaunchConfiguration = launchConfiguration;
+ fCurrentJREModular = JavaRuntime.isModularConfiguration(getLaunchConfiguration());
}
/**
@@ -607,4 +615,56 @@ public class JavaJRETab extends JavaLaunchTab {
public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) {
// do nothing when deactivated
}
+
+ /**
+ * @since 3.9
+ */
+ @Override
+ public void postApply() {
+ boolean newJREModular = JavaRuntime.isModularConfiguration(getLaunchConfiguration());
+ if (fCurrentJREModular != newJREModular) {
+ ILaunchConfigurationDialog dialog = LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog();
+ if (dialog instanceof LaunchConfigurationsDialog) {
+ LaunchConfigurationTabGroupViewer tabViewer = ((LaunchConfigurationsDialog) dialog).getTabViewer();
+ tabViewer.refreshTabs(true);
+ }
+ }
+ }
+
+ /**
+ * @since 3.9
+ */
+ @Override
+ public boolean OkToLeaveTab() {
+ boolean newJREModular = JavaRuntime.isModularConfiguration(getLaunchConfiguration());
+ if (fCurrentJREModular != newJREModular) {
+ return handleClasspathDependenciesChange(newJREModular);
+ }
+
+ return true;
+ }
+
+ private void handleConfiguraionDialog() {
+ ILaunchConfigurationDialog dialog = LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog();
+ if (dialog instanceof LaunchConfigurationsDialog) {
+ LaunchConfigurationTabGroupViewer tabViewer = ((LaunchConfigurationsDialog) dialog).getTabViewer();
+ tabViewer.handleApplyPressed();
+ tabViewer.refreshTabs(false);
+ }
+ }
+
+ private boolean handleClasspathDependenciesChange(boolean newJREModular) {
+ String title = LauncherMessages.JavaJRETab_10;
+ String message = LauncherMessages.JavaJRETab_11;
+ String[] buttonLabels = new String[] { LauncherMessages.JavaJRETab_12, LauncherMessages.JavaJRETab_13 };
+
+ MessageDialog dialog = new MessageDialog(getShell(), title, null, message, MessageDialog.QUESTION, buttonLabels, 0);
+ int res = dialog.open();
+ if (res == 0) { // apply
+ fCurrentJREModular = newJREModular;
+ handleConfiguraionDialog();
+ return true;
+ }
+ return false;
+ }
}
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/core/refactoring/BreakpointChange.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/core/refactoring/BreakpointChange.java
index 896126fce..19f13f783 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/core/refactoring/BreakpointChange.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/core/refactoring/BreakpointChange.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2014 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,12 +18,12 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
-import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IImportContainer;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IOrdinaryClassFile;
import org.eclipse.jdt.core.ISourceRange;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
@@ -232,7 +232,9 @@ public abstract class BreakpointChange extends Change {
currentElement = ((ICompilationUnit)currentElement).getType(child.getElementName());
break;
case IJavaElement.CLASS_FILE:
- currentElement = ((IClassFile)currentElement).getType();
+ if (currentElement instanceof IOrdinaryClassFile) {
+ currentElement = ((IOrdinaryClassFile) currentElement).getType();
+ }
break;
case IJavaElement.TYPE:
currentElement = ((IType)currentElement).getType(child.getElementName());
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/IJavaDebugHelpContextIds.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/IJavaDebugHelpContextIds.java
index 5c0cb9201..d4ecef949 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/IJavaDebugHelpContextIds.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/IJavaDebugHelpContextIds.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -69,6 +69,7 @@ public interface IJavaDebugHelpContextIds {
// application launch configuration dialog tabs
public static final String LAUNCH_CONFIGURATION_DIALOG_ARGUMENTS_TAB= PREFIX + "launch_configuration_dialog_arguments_tab"; //$NON-NLS-1$
public static final String LAUNCH_CONFIGURATION_DIALOG_CLASSPATH_TAB= PREFIX + "launch_configuration_dialog_classpath_tab"; //$NON-NLS-1$
+ public static final String LAUNCH_CONFIGURATION_DIALOG_DEPENDENCIES_TAB = PREFIX + "launch_configuration_dialog_classpath_tab"; //$NON-NLS-1$
public static final String LAUNCH_CONFIGURATION_DIALOG_CONNECT_TAB= PREFIX + "launch_configuration_dialog_connect_tab"; //$NON-NLS-1$
public static final String LAUNCH_CONFIGURATION_DIALOG_JRE_TAB= PREFIX + "launch_configuration_dialog_jre_tab"; //$NON-NLS-1$
public static final String LAUNCH_CONFIGURATION_DIALOG_MAIN_TAB= PREFIX + "launch_configuration_dialog_main_tab"; //$NON-NLS-1$
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/TypeNameResolver.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/TypeNameResolver.java
index 8f7736a0a..1aa322f71 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/TypeNameResolver.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/TypeNameResolver.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,9 +14,9 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.variables.IDynamicVariable;
import org.eclipse.debug.internal.core.variables.ResourceResolver;
-import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IOrdinaryClassFile;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
@@ -54,7 +54,9 @@ public class TypeNameResolver extends ResourceResolver {
int elementType= element.getElementType();
switch (elementType) {
case IJavaElement.CLASS_FILE :
- type= ((IClassFile) element).getType();
+ if (element instanceof IOrdinaryClassFile) {
+ type = ((IOrdinaryClassFile) element).getType();
+ }
break;
case IJavaElement.COMPILATION_UNIT :
type= ((ICompilationUnit) element).findPrimaryType();
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java
index a1fa18658..5c5785eda 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java
@@ -44,6 +44,7 @@ import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IOrdinaryClassFile;
import org.eclipse.jdt.core.IPackageDeclaration;
import org.eclipse.jdt.core.ISourceRange;
import org.eclipse.jdt.core.IType;
@@ -847,7 +848,8 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTargetExtensio
if(member.getElementType() == IJavaElement.TYPE) {
return ((IType)member).isInterface();
}
- return member.getDeclaringType().isInterface();
+ IType type = member.getDeclaringType();
+ return type != null && type.isInterface();
}
else if(obj instanceof IJavaFieldVariable) {
IJavaFieldVariable var = (IJavaFieldVariable) obj;
@@ -1152,8 +1154,8 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTargetExtensio
break;
}
}
- } else if (element instanceof IClassFile) {
- type = ((IClassFile) element).getType();
+ } else if (element instanceof IOrdinaryClassFile) {
+ type = ((IOrdinaryClassFile) element).getType();
}
if (type != null) {
String[] sigs = Signature.getParameterTypes(signature);
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathContentProvider.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathContentProvider.java
index 8aff086c1..d29ab9306 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathContentProvider.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathContentProvider.java
@@ -27,11 +27,11 @@ import org.eclipse.jface.viewers.Viewer;
* viewer.
*/
public class ClasspathContentProvider implements ITreeContentProvider {
- private TreeViewer treeViewer;
- private ClasspathModel model= null;
- private boolean refreshEnabled= false;
- private boolean refreshRequested= false;
- private JavaClasspathTab fTab;
+ protected TreeViewer treeViewer;
+ protected ClasspathModel model = null;
+ private boolean refreshEnabled = false;
+ private boolean refreshRequested = false;
+ protected JavaClasspathTab fTab;
public ClasspathContentProvider(JavaClasspathTab tab) {
fTab = tab;
@@ -67,7 +67,7 @@ public class ClasspathContentProvider implements ITreeContentProvider {
refresh();
}
- private void refresh() {
+ protected void refresh() {
if (refreshEnabled) {
treeViewer.refresh();
refreshRequested= false;
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathEntry.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathEntry.java
index 33d24306b..cea07450b 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathEntry.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathEntry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -254,4 +254,9 @@ public class ClasspathEntry extends AbstractClasspathEntry implements IRuntimeCl
}
return null;
}
+
+ @Override
+ public boolean isAutomodule() {
+ return this.entry.isAutomodule();
+ }
}
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathMessages.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathMessages.java
index 3ce431800..3c494def2 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathMessages.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,6 +18,9 @@ public class ClasspathMessages extends NLS {
public static String ClasspathModel_0;
public static String ClasspathModel_1;
+ public static String DependencyModel_0;
+ public static String DependencyModel_1;
+
public static String DefaultClasspathEntryDialog_0;
public static String DefaultClasspathEntryDialog_1;
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathMessages.properties b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathMessages.properties
index 6222f931e..47faeea7d 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathMessages.properties
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathMessages.properties
@@ -11,6 +11,8 @@
ClasspathModel_0=Bootstrap Entries
ClasspathModel_1=User Entries
+DependencyModel_0=Modulepath Entries
+DependencyModel_1=Classpath Entries
DefaultClasspathEntryDialog_0=Edit Runtime Classpath
DefaultClasspathEntryDialog_1=Default runtime classpath for project: {0}
DefaultClasspathEntryDialog_2=OK
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathModel.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathModel.java
index 563beb1dc..46c0bb0c8 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathModel.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/ClasspathModel.java
@@ -167,7 +167,7 @@ public class ClasspathModel extends AbstractClasspathEntry {
}
}
- private ClasspathGroup createGroupEntry(IRuntimeClasspathEntry[] entries, ClasspathGroup entryParent, String name, boolean canBeRemoved, boolean addEntry) {
+ protected ClasspathGroup createGroupEntry(IRuntimeClasspathEntry[] entries, ClasspathGroup entryParent, String name, boolean canBeRemoved, boolean addEntry) {
ClasspathGroup group= new ClasspathGroup(name, entryParent, canBeRemoved);
@@ -212,6 +212,11 @@ public class ClasspathModel extends AbstractClasspathEntry {
*/
public ClasspathModel() {
super();
+ createEntries();
+
+ }
+
+ public void createEntries() {
getBootstrapEntry();
getUserEntry();
}
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/DependenciesContentProvider.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/DependenciesContentProvider.java
new file mode 100644
index 000000000..579f9b886
--- /dev/null
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/DependenciesContentProvider.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2017 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.debug.ui.classpath;
+
+
+import org.eclipse.jdt.debug.ui.launchConfigurations.JavaClasspathTab;
+import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
+
+/**
+ * Content provider that maintains a list of classpath entries which are shown in a tree
+ * viewer.
+ */
+public class DependenciesContentProvider extends ClasspathContentProvider {
+
+ public DependenciesContentProvider(JavaClasspathTab tab) {
+ super(tab);
+ }
+
+
+
+ @Override
+ public IClasspathEntry[] getUserClasspathEntries() {
+ return model.getEntries(DependencyModel.MODULE_PATH);
+ }
+
+ @Override
+ public IClasspathEntry[] getBootstrapClasspathEntries() {
+ return model.getEntries(DependencyModel.CLASS_PATH);
+ }
+
+
+
+ @Override
+ public void setEntries(IRuntimeClasspathEntry[] entries) {
+ model.removeAll();
+ IRuntimeClasspathEntry entry;
+ for (int i = 0; i < entries.length; i++) {
+ entry= entries[i];
+ switch (entry.getClasspathProperty()) {
+ case IRuntimeClasspathEntry.MODULE_PATH:
+ model.addEntry(DependencyModel.MODULE_PATH, entry);
+ break;
+ default:
+ model.addEntry(DependencyModel.CLASS_PATH, entry);
+ break;
+ }
+ }
+ refresh();
+ }
+}
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/DependencyModel.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/DependencyModel.java
new file mode 100644
index 000000000..0dd8d2e2a
--- /dev/null
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/DependencyModel.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2017 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jdt.internal.debug.ui.classpath;
+
+import java.util.Iterator;
+
+import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
+
+public class DependencyModel extends ClasspathModel {
+
+ public static final int MODULE_PATH= 0;
+ public static final int CLASS_PATH= 1;
+
+ private ClasspathGroup modulepathEntries;
+ private ClasspathGroup classpathEntries;
+
+
+ @Override
+ public Object addEntry(int entryType, IRuntimeClasspathEntry entry) {
+ IClasspathEntry entryParent= null;
+ switch (entryType) {
+ case MODULE_PATH :
+ entryParent= getModulepathEntry();
+ break;
+ case CLASS_PATH :
+ entryParent = getClasspathEntry();
+ break;
+ default :
+ break;
+ }
+
+ ClasspathEntry newEntry= createEntry(entry, entryParent);
+ Iterator<IClasspathEntry> entries= childEntries.iterator();
+ while (entries.hasNext()) {
+ Object element = entries.next();
+ if (element instanceof ClasspathGroup) {
+ if(((ClasspathGroup)element).contains(newEntry)) {
+ return null;
+ }
+ } else if (element.equals(newEntry)) {
+ return null;
+ }
+ }
+ if (entryParent != null) {
+ ((ClasspathGroup)entryParent).addEntry(newEntry, null);
+ } else {
+ childEntries.add(newEntry);
+ }
+ return newEntry;
+ }
+
+ /**
+ * Returns the entries of the given type, or an empty
+ * collection if none.
+ *
+ * @param entryType the kind of the entries to get
+ * @return the entries of the given type, or an empty
+ * collection if none
+ */
+ @Override
+ public IClasspathEntry[] getEntries(int entryType) {
+ switch (entryType) {
+ case MODULE_PATH :
+ if (modulepathEntries != null) {
+ return modulepathEntries.getEntries();
+ }
+ break;
+ case CLASS_PATH :
+ if (classpathEntries != null) {
+ return classpathEntries.getEntries();
+ }
+ break;
+ }
+ return new IClasspathEntry[0];
+ }
+
+ @Override
+ public IRuntimeClasspathEntry[] getAllEntries() {
+ IClasspathEntry[] boot = getEntries(MODULE_PATH);
+ IClasspathEntry[] user = getEntries(CLASS_PATH);
+ IRuntimeClasspathEntry[] all = new IRuntimeClasspathEntry[boot.length + user.length];
+ if (boot.length > 0) {
+ System.arraycopy(boot, 0, all, 0, boot.length);
+ }
+ if (user.length > 0) {
+ System.arraycopy(user, 0, all, boot.length, user.length);
+ }
+ return all;
+ }
+
+ @Override
+ public void removeAll() {
+ if (modulepathEntries != null) {
+ modulepathEntries.removeAll();
+ }
+ if (classpathEntries != null) {
+ classpathEntries.removeAll();
+ }
+ }
+
+ public IClasspathEntry getModulepathEntry() {
+ if (modulepathEntries == null) {
+ String name = ClasspathMessages.DependencyModel_0;
+ modulepathEntries = createGroupEntry(new IRuntimeClasspathEntry[0], null, name, false, true);
+ }
+ return modulepathEntries;
+ }
+
+ public IClasspathEntry getClasspathEntry() {
+ if (classpathEntries == null) {
+ String name = ClasspathMessages.DependencyModel_1;
+ classpathEntries = createGroupEntry(new IRuntimeClasspathEntry[0], null, name, false, true);
+ }
+ return classpathEntries;
+ }
+
+ /**
+ * Constructs a new classpath model with root entries
+ */
+ public DependencyModel() {
+ super();
+ }
+
+ @Override
+ public void createEntries() {
+ getModulepathEntry();
+ getClasspathEntry();
+ }
+
+
+}
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaExceptionHyperLink.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaExceptionHyperLink.java
index 272e91630..ef981468f 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaExceptionHyperLink.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaExceptionHyperLink.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,8 +18,8 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IOrdinaryClassFile;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.debug.core.IJavaExceptionBreakpoint;
import org.eclipse.jdt.debug.core.JDIDebugModel;
@@ -100,8 +100,8 @@ public class JavaExceptionHyperLink extends JavaStackTraceHyperlink {
IType type = null;
if (source instanceof ICompilationUnit) {
type = ((ICompilationUnit) source).findPrimaryType();
- } else if (source instanceof IClassFile) {
- type = ((IClassFile) source).getType();
+ } else if (source instanceof IOrdinaryClassFile) {
+ type = ((IOrdinaryClassFile) source).getType();
} else if (source instanceof IType) {
type = (IType) source;
}
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaStackTraceHyperlink.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaStackTraceHyperlink.java
index fa3f73ce7..4ef559bb5 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaStackTraceHyperlink.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaStackTraceHyperlink.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -244,6 +244,11 @@ public class JavaStackTraceHyperlink implements IHyperlink {
if (qualifier.length() > 0) {
typeName = qualifier + "." + typeName; //$NON-NLS-1$
}
+ // Remove the module name if exists
+ int index = typeName.lastIndexOf('/');
+ if (index != -1) {
+ typeName = typeName.substring(index + 1);
+ }
return typeName;
}
IStatus status = new Status(IStatus.ERROR, JDIDebugUIPlugin.getUniqueIdentifier(), 0, ConsoleMessages.JavaStackTraceHyperlink_Unable_to_parse_type_name_from_hyperlink__5, null);
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/AppletLaunchConfigurationUtils.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/AppletLaunchConfigurationUtils.java
index bd9c72701..8963980b6 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/AppletLaunchConfigurationUtils.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/AppletLaunchConfigurationUtils.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,11 +25,11 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IOrdinaryClassFile;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.ITypeHierarchy;
import org.eclipse.jdt.core.JavaCore;
@@ -97,8 +97,8 @@ public class AppletLaunchConfigurationUtils {
} else if (javaElement.getElementType() == IJavaElement.COMPILATION_UNIT) {
String simpleName= Signature.getSimpleName(mainTypeName);
return ((ICompilationUnit) javaElement).getType(simpleName);
- } else if (javaElement.getElementType() == IJavaElement.CLASS_FILE) {
- return ((IClassFile) javaElement).getType();
+ } else if (javaElement.getElementType() == IJavaElement.CLASS_FILE && javaElement instanceof IOrdinaryClassFile) {
+ return ((IOrdinaryClassFile) javaElement).getType();
}
return null;
}
@@ -148,8 +148,8 @@ public class AppletLaunchConfigurationUtils {
result.add(types[i]);
}
}
- } else if (element instanceof IClassFile) {
- IType type = ((IClassFile)element).getType();
+ } else if (element instanceof IOrdinaryClassFile) {
+ IType type = ((IOrdinaryClassFile) element).getType();
if (isSubclassOfApplet(monitor, type)) {
result.add(type);
}
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/LauncherMessages.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/LauncherMessages.java
index 8b27be581..fadc389be 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/LauncherMessages.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/LauncherMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -57,6 +57,10 @@ public class LauncherMessages extends NLS {
public static String JavaJRETab_7;
public static String JavaJRETab_8;
public static String JavaJRETab_9;
+ public static String JavaJRETab_10;
+ public static String JavaJRETab_11;
+ public static String JavaJRETab_12;
+ public static String JavaJRETab_13;
public static String JavaMainTab__Main_19;
public static String JavaMainTab_Choose_a_main__type_to_launch__12;
@@ -89,6 +93,9 @@ public class LauncherMessages extends NLS {
public static String JavaClasspathTab_Unable_to_save_classpath_1;
public static String JavaClasspathTab_Invalid_runtime_classpath_1;
+ public static String JavaDependenciesTab_0;
+ public static String JavaDependenciesTab_Dependencies_3;
+
public static String JavaSourceLookupTab_Source_1;
public static String SourceLookupBlock_Source_1;
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/LauncherMessages.properties b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/LauncherMessages.properties
index 889bbe9ff..8a92d36ab 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/LauncherMessages.properties
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/LauncherMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2012 IBM Corporation and others.
+# Copyright (c) 2000, 2017 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -37,6 +37,10 @@ JavaJRETab_4=workspace
JavaJRETab_3=project
JavaJRETab_2=JRE
JavaJRETab_1=Execution environment
+JavaJRETab_10=Applying JRE Changes
+JavaJRETab_11=Related tabs needs be updated due to the change, Go ahead with apply?
+JavaJRETab_12=&Apply Now
+JavaJRETab_13=Cancel
JavaJRETab_0={0} not compatible with {1} .class file compatibility: {2}
JavaJRETab_5=&Project execution environment ''{0}'' ({1})
JavaMainTab_Choose_a_main__type_to_launch__12=Select &type (? = any character, * = any String, TZ = TimeZone):
@@ -83,6 +87,9 @@ JavaClasspathTab_1=Referenced project [{0}] is not accessible.
JavaClasspathTab_Unable_to_save_classpath_1=Unable to save classpath
JavaClasspathTab_Invalid_runtime_classpath_1=Archive does not exist: {0}
+JavaDependenciesTab_0=De&pendencies
+JavaDependenciesTab_Dependencies_3=Dependencies
+
JavaSourceLookupTab_Source_1=Source
SourceLookupBlock_Source_1=Source
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/LocalJavaApplicationTabGroup.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/LocalJavaApplicationTabGroup.java
index 28ef7a6dc..7f13465c9 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/LocalJavaApplicationTabGroup.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/LocalJavaApplicationTabGroup.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,6 +11,9 @@
package org.eclipse.jdt.internal.debug.ui.launcher;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer;
+import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
import org.eclipse.debug.ui.CommonTab;
import org.eclipse.debug.ui.EnvironmentTab;
@@ -20,21 +23,41 @@ import org.eclipse.debug.ui.ILaunchConfigurationTabGroup;
import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab;
import org.eclipse.jdt.debug.ui.launchConfigurations.JavaClasspathTab;
+import org.eclipse.jdt.debug.ui.launchConfigurations.JavaDependenciesTab;
import org.eclipse.jdt.debug.ui.launchConfigurations.JavaJRETab;
import org.eclipse.jdt.debug.ui.launchConfigurations.JavaMainTab;
+import org.eclipse.jdt.launching.JavaRuntime;
+@SuppressWarnings("restriction")
public class LocalJavaApplicationTabGroup extends AbstractLaunchConfigurationTabGroup {
/**
* @see ILaunchConfigurationTabGroup#createTabs(ILaunchConfigurationDialog, String)
*/
+ @SuppressWarnings("restriction")
@Override
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+ JavaClasspathTab tab = null;
+ if (dialog instanceof LaunchConfigurationsDialog) {
+ LaunchConfigurationTabGroupViewer tabViewer = ((LaunchConfigurationsDialog) dialog).getTabViewer();
+ if (tabViewer != null) {
+ Object input = tabViewer.getInput();
+ if (input instanceof ILaunchConfiguration) {
+ ILaunchConfiguration configuration = (ILaunchConfiguration) input;
+ if (JavaRuntime.isModularConfiguration(configuration)) {
+ tab = new JavaDependenciesTab();
+ }
+ }
+ }
+ }
+ if (tab == null) {
+ tab = new JavaClasspathTab();
+ }
ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
new JavaMainTab(),
new JavaArgumentsTab(),
new JavaJRETab(),
- new JavaClasspathTab(),
+ tab,
new SourceLookupTab(),
new EnvironmentTab(),
new CommonTab()
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTEvaluationEngine.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTEvaluationEngine.java
index 8198fa09f..4c1cae604 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTEvaluationEngine.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTEvaluationEngine.java
@@ -750,66 +750,58 @@ public class ASTEvaluationEngine implements IAstEvaluationEngine {
EvaluationRunnable er = new EvaluationRunnable();
CoreException exception = null;
+ long start = System.currentTimeMillis();
try {
- long start = System.currentTimeMillis();
- try {
- fThread.runEvaluation(er, null, fEvaluationDetail,
- fHitBreakpoints);
- } catch (DebugException e) {
- exception = e;
- } catch (Exception e) {
- IStatus status = new Status(IStatus.ERROR,
- JDIDebugPlugin.getUniqueIdentifier(),
- JDIDebugPlugin.ERROR,
- EvaluationEngineMessages.ASTEvaluationEngine_An_unknown_error_occurred_during_evaluation, e);
- exception = new DebugException(status);
- }
- long end = System.currentTimeMillis();
+ fThread.runEvaluation(er, null, fEvaluationDetail,
+ fHitBreakpoints);
+ } catch (DebugException e) {
+ exception = e;
+ }
+ long end = System.currentTimeMillis();
- IJavaValue value = interpreter.getResult();
+ IJavaValue value = interpreter.getResult();
- if (exception == null) {
- exception = er.getException();
- }
+ if (exception == null) {
+ exception = er.getException();
+ }
- result.setTerminated(er.fTerminated);
- if (exception != null) {
+ result.setTerminated(er.fTerminated);
+ if (exception != null) {
+ if (JDIDebugOptions.DEBUG_AST_EVAL) {
+ StringBuffer buf = new StringBuffer();
+ buf.append("\tException: "); //$NON-NLS-1$
+ buf.append(exception.toString());
+ JDIDebugOptions.trace(buf.toString());
+ }
+ if (exception instanceof DebugException) {
+ result.setException((DebugException) exception);
+ } else {
+ result.setException(new DebugException(exception
+ .getStatus()));
+ }
+ } else {
+ if (value != null) {
+ result.setValue(value);
if (JDIDebugOptions.DEBUG_AST_EVAL) {
StringBuffer buf = new StringBuffer();
- buf.append("\tException: "); //$NON-NLS-1$
- buf.append(exception.toString());
+ buf.append("\tResult: "); //$NON-NLS-1$
+ buf.append(value);
JDIDebugOptions.trace(buf.toString());
}
- if (exception instanceof DebugException) {
- result.setException((DebugException) exception);
- } else {
- result.setException(new DebugException(exception
- .getStatus()));
- }
} else {
- if (value != null) {
- result.setValue(value);
- if (JDIDebugOptions.DEBUG_AST_EVAL) {
- StringBuffer buf = new StringBuffer();
- buf.append("\tResult: "); //$NON-NLS-1$
- buf.append(value);
- JDIDebugOptions.trace(buf.toString());
- }
- } else {
- result.addError(EvaluationEngineMessages.ASTEvaluationEngine_An_unknown_error_occurred_during_evaluation);
- }
+ result.addError(EvaluationEngineMessages.ASTEvaluationEngine_An_unknown_error_occurred_during_evaluation);
}
+ }
- if (JDIDebugOptions.DEBUG_AST_EVAL) {
- StringBuffer buf = new StringBuffer();
- buf.append("\tDuration: "); //$NON-NLS-1$
- buf.append(end - start);
- buf.append("ms"); //$NON-NLS-1$
- JDIDebugOptions.trace(buf.toString());
- }
- } finally {
- evaluationFinished(result);
+ if (JDIDebugOptions.DEBUG_AST_EVAL) {
+ StringBuffer buf = new StringBuffer();
+ buf.append("\tDuration: "); //$NON-NLS-1$
+ buf.append(end - start);
+ buf.append("ms"); //$NON-NLS-1$
+ JDIDebugOptions.trace(buf.toString());
}
+
+ evaluationFinished(result);
}
private void evaluationFinished(IEvaluationResult result) {
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/BinaryBasedSourceGenerator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/BinaryBasedSourceGenerator.java
index 8520276d1..9f4cb10a2 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/BinaryBasedSourceGenerator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/BinaryBasedSourceGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -61,10 +61,19 @@ public class BinaryBasedSourceGenerator {
fLocalVariableNames = localVariables;
fIsInStaticMethod = isInStaticMethod;
int index = sourceLevel.indexOf('.');
- String num = sourceLevel.substring(0, index);
+ String num;
+ if (index != -1) {
+ num = sourceLevel.substring(0, index);
+ } else {
+ num = sourceLevel;
+ }
fSourceMajorLevel = Integer.valueOf(num).intValue();
- num = sourceLevel.substring(index + 1);
- fSourceMinorLevel = Integer.valueOf(num).intValue();
+ if (index != -1) {
+ num = sourceLevel.substring(index + 1);
+ fSourceMinorLevel = Integer.valueOf(num).intValue();
+ } else {
+ fSourceMinorLevel = 0;
+ }
}
/**
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationSourceGenerator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationSourceGenerator.java
index 1bb3fc007..9c6878041 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationSourceGenerator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationSourceGenerator.java
@@ -79,9 +79,6 @@ public class EvaluationSourceGenerator {
*/
protected String getCompleteSnippet(String codeSnippet) {
codeSnippet = codeSnippet.trim(); // remove whitespaces at the end
- if(codeSnippet.isEmpty()) {
- return "return;"; //$NON-NLS-1$
- }
boolean inString = false;
char[] chars = codeSnippet.toCharArray();
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/SourceBasedSourceGenerator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/SourceBasedSourceGenerator.java
index 72bca4edf..5a65c6b59 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/SourceBasedSourceGenerator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/SourceBasedSourceGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -193,10 +193,19 @@ public class SourceBasedSourceGenerator extends ASTVisitor {
fCodeSnippet = codeSnippet;
fCreateInAStaticMethod = createInAStaticMethod;
int index = sourceLevel.indexOf('.');
- String num = sourceLevel.substring(0, index);
+ String num;
+ if (index != -1) {
+ num = sourceLevel.substring(0, index);
+ } else {
+ num = sourceLevel;
+ }
fSourceMajorLevel = Integer.valueOf(num).intValue();
- num = sourceLevel.substring(index + 1);
- fSourceMinorLevel = Integer.valueOf(num).intValue();
+ if (index != -1) {
+ num = sourceLevel.substring(index + 1);
+ fSourceMinorLevel = Integer.valueOf(num).intValue();
+ } else {
+ fSourceMinorLevel = 0;
+ }
}
/**
@@ -265,7 +274,9 @@ public class SourceBasedSourceGenerator extends ASTVisitor {
buffer.append(' ');
buffer.append(fLocalVariableNames[i]);
if (i + 1 < length)
+ {
buffer.append(", "); //$NON-NLS-1$
+ }
}
buffer.append(") throws Throwable {"); //$NON-NLS-1$
buffer.append('\n');
diff --git a/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/connect/ConnectMessages.properties b/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/connect/ConnectMessages.properties
index 4c45d2dbc..a10c8bdb6 100644
--- a/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/connect/ConnectMessages.properties
+++ b/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/connect/ConnectMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2017 IBM Corporation and others.
+# Copyright (c) 2000, 2016 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -14,9 +14,9 @@ PacketReceiveManager_Got_IOException_from_Virtual_Machine_1=Got IOException from
PacketReceiveManager_Got_IOException_from_Virtual_Machine_2=Got IOException from Virtual Machine
PacketSendManager_Got_IOException_from_Virtual_Machine_1=Got IOException from Virtual Machine
SocketAttachingConnectorImpl_Machine_name_to_which_to_attach_for_VM_connections_1=Machine name to which to attach for VM connections
-SocketAttachingConnectorImpl_Host_2=&Host:
+SocketAttachingConnectorImpl_Host_2=Host:
SocketAttachingConnectorImpl_Port_number_to_which_to_attach_for_VM_connections_3=Port number to which to attach for VM connections
-SocketAttachingConnectorImpl_Port_4=&Port:
+SocketAttachingConnectorImpl_Port_4=Port:
SocketAttachingConnectorImpl_1=Connection Timeout
SocketAttachingConnectorImpl_2=Connection Timeout:
SocketAttachingConnectorImpl_Attaches_by_socket_to_other_VMs_5=Attaches by socket to other VMs
@@ -40,14 +40,14 @@ SocketLaunchingConnectorImpl_Connection_argument_is_not_of_the_right_type_14=Con
SocketLaunchingConnectorImpl_Necessary_connection_argument_is_null_15=Necessary connection argument is null
SocketLaunchingConnectorImpl_Connection_argument_is_not_a_number_16=Connection argument is not a number
SocketListeningConnectorImpl_Port_number_at_which_to_listen_for_VM_connections_1=Port number at which to listen for VM connections
-SocketListeningConnectorImpl_Port_2=&Port:
+SocketListeningConnectorImpl_Port_2=Port:
SocketListeningConnectorImpl_Timeout_before_accept_returns_3=Timeout before accept returns
SocketListeningConnectorImpl_Timeout_4=Timeout:
SocketListeningConnectorImpl_Accepts_socket_connections_initiated_by_other_VMs_5=Accepts socket connections initiated by other VMs
SocketListeningConnectorImpl_Connection_argument_is_not_of_the_right_type_6=Connection argument is not of the right type
SocketListeningConnectorImpl_Necessary_connection_argument_is_null_7=Necessary connection argument is null
SocketListeningConnectorImpl_Connection_argument_is_not_a_number_8=Connection argument is not a number
-SocketListeningConnectorImpl_Limit=&Connection limit:
+SocketListeningConnectorImpl_Limit=Connection limit:
SocketListeningConnectorImpl_Limit_incoming_connections=Limit incoming connections (0 = no limit)
SocketListeningConnectorImpl_ListeningConnector_Socket_Port=ListeningConnector Socket Port=
SocketRawLaunchingConnectorImpl_Raw_command_to_start_the_debugged_application_VM_1=Raw command to start the debugged application VM
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaDebugUtils.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaDebugUtils.java
index 30ac59dcd..6410d1a93 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaDebugUtils.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaDebugUtils.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2016 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,10 +25,10 @@ import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.ISourceLocator;
import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
-import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IOrdinaryClassFile;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.dom.AST;
@@ -223,8 +223,8 @@ public class JavaDebugUtils {
IJavaElement javaElement) {
IType type = null;
String[] typeNames = getNestedTypeNames(qualifiedName);
- if (javaElement instanceof IClassFile) {
- type = ((IClassFile) javaElement).getType();
+ if (javaElement instanceof IOrdinaryClassFile) {
+ type = ((IOrdinaryClassFile) javaElement).getType();
} else if (javaElement instanceof ICompilationUnit) {
type = ((ICompilationUnit) javaElement).getType(typeNames[0]);
} else if (javaElement instanceof IType) {
diff --git a/org.eclipse.jdt.launching/.settings/.api_filters b/org.eclipse.jdt.launching/.settings/.api_filters
index 4c622ceb5..3dafd54d6 100644
--- a/org.eclipse.jdt.launching/.settings/.api_filters
+++ b/org.eclipse.jdt.launching/.settings/.api_filters
@@ -1,19 +1,185 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<component id="org.eclipse.jdt.launching" version="2">
- <resource path="launching/org/eclipse/jdt/launching/sourcelookup/LocalFileStorage.java" type="org.eclipse.jdt.launching.sourcelookup.LocalFileStorage">
- <filter comment="Known illegal extension" id="571473929">
- <message_arguments>
- <message_argument value="LocalFileStorage"/>
- <message_argument value="LocalFileStorage"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="launching/org/eclipse/jdt/launching/sourcelookup/ZipEntryStorage.java" type="org.eclipse.jdt.launching.sourcelookup.ZipEntryStorage">
- <filter comment="This is a known illegal extension" id="571473929">
- <message_arguments>
- <message_argument value="ZipEntryStorage"/>
- <message_argument value="ZipEntryStorage"/>
- </message_arguments>
- </filter>
- </resource>
-</component>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<component id="org.eclipse.jdt.launching" version="2">
+ <resource path="META-INF/MANIFEST.MF">
+ <filter comment="keep the same version as in 4.7.1 for now" id="924844039">
+ <message_arguments>
+ <message_argument value="3.9.0"/>
+ <message_argument value="3.9.0"/>
+ </message_arguments>
+ </filter>
+ <filter id="924844039">
+ <message_arguments>
+ <message_argument value="3.9.50"/>
+ <message_argument value="3.9.0"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="launching/org/eclipse/jdt/launching/AbstractJavaLaunchConfigurationDelegate.java" type="org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate">
+ <filter id="1141899266">
+ <message_arguments>
+ <message_argument value="3.10"/>
+ <message_argument value="3.9"/>
+ <message_argument value="getClasspathAndModulepath(ILaunchConfiguration)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="launching/org/eclipse/jdt/launching/AbstractVMRunner.java" type="org.eclipse.jdt.launching.AbstractVMRunner">
+ <filter id="1141899266">
+ <message_arguments>
+ <message_argument value="3.10"/>
+ <message_argument value="3.9"/>
+ <message_argument value="isModular(VMRunnerConfiguration, IVMInstall)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="launching/org/eclipse/jdt/launching/IJavaLaunchConfigurationConstants.java" type="org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants">
+ <filter id="1209008130">
+ <message_arguments>
+ <message_argument value="3.10"/>
+ <message_argument value="3.9"/>
+ <message_argument value="ATTR_MODULEPATH"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="launching/org/eclipse/jdt/launching/IRuntimeClasspathEntry.java" type="org.eclipse.jdt.launching.IRuntimeClasspathEntry">
+ <filter id="1209008130">
+ <message_arguments>
+ <message_argument value="3.10"/>
+ <message_argument value="3.9"/>
+ <message_argument value="CLASS_PATH"/>
+ </message_arguments>
+ </filter>
+ <filter id="1209008130">
+ <message_arguments>
+ <message_argument value="3.10"/>
+ <message_argument value="3.9"/>
+ <message_argument value="MODULE_PATH"/>
+ </message_arguments>
+ </filter>
+ <filter id="1209008130">
+ <message_arguments>
+ <message_argument value="3.10"/>
+ <message_argument value="3.9"/>
+ <message_argument value="isAutomodule()"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="launching/org/eclipse/jdt/launching/JavaRuntime.java" type="org.eclipse.jdt.launching.JavaRuntime">
+ <filter id="1141899266">
+ <message_arguments>
+ <message_argument value="3.10"/>
+ <message_argument value="3.9"/>
+ <message_argument value="computeModularJREEntry(IJavaProject)"/>
+ </message_arguments>
+ </filter>
+ <filter id="1141899266">
+ <message_arguments>
+ <message_argument value="3.10"/>
+ <message_argument value="3.9"/>
+ <message_argument value="computeUnresolvedRuntimeDependencies(IJavaProject)"/>
+ </message_arguments>
+ </filter>
+ <filter id="1141899266">
+ <message_arguments>
+ <message_argument value="3.10"/>
+ <message_argument value="3.9"/>
+ <message_argument value="isModularConfiguration(ILaunchConfiguration)"/>
+ </message_arguments>
+ </filter>
+ <filter id="1141899266">
+ <message_arguments>
+ <message_argument value="3.10"/>
+ <message_argument value="3.9"/>
+ <message_argument value="isModularJava(IVMInstall)"/>
+ </message_arguments>
+ </filter>
+ <filter id="1141899266">
+ <message_arguments>
+ <message_argument value="3.10"/>
+ <message_argument value="3.9"/>
+ <message_argument value="isModularProject(IJavaProject)"/>
+ </message_arguments>
+ </filter>
+ <filter id="1141899266">
+ <message_arguments>
+ <message_argument value="3.10"/>
+ <message_argument value="3.9"/>
+ <message_argument value="isModule(IClasspathEntry, IJavaProject)"/>
+ </message_arguments>
+ </filter>
+ <filter id="1141899266">
+ <message_arguments>
+ <message_argument value="3.10"/>
+ <message_argument value="3.9"/>
+ <message_argument value="newArchiveRuntimeClasspathEntry(IPath, IPath, IPath, IAccessRule[], IClasspathAttribute[], boolean)"/>
+ </message_arguments>
+ </filter>
+ <filter id="1141899266">
+ <message_arguments>
+ <message_argument value="3.10"/>
+ <message_argument value="3.9"/>
+ <message_argument value="newArchiveRuntimeClasspathEntry(IPath, int)"/>
+ </message_arguments>
+ </filter>
+ <filter id="1141899266">
+ <message_arguments>
+ <message_argument value="3.10"/>
+ <message_argument value="3.9"/>
+ <message_argument value="newProjectRuntimeClasspathEntry(IJavaProject, int)"/>
+ </message_arguments>
+ </filter>
+ <filter id="1141899266">
+ <message_arguments>
+ <message_argument value="3.10"/>
+ <message_argument value="3.9"/>
+ <message_argument value="newRuntimeContainerClasspathEntry(IClasspathEntry, IJavaProject)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="launching/org/eclipse/jdt/launching/VMRunnerConfiguration.java" type="org.eclipse.jdt.launching.VMRunnerConfiguration">
+ <filter id="1141899266">
+ <message_arguments>
+ <message_argument value="3.10"/>
+ <message_argument value="3.9"/>
+ <message_argument value="getModuleDescription()"/>
+ </message_arguments>
+ </filter>
+ <filter id="1141899266">
+ <message_arguments>
+ <message_argument value="3.10"/>
+ <message_argument value="3.9"/>
+ <message_argument value="getModulepath()"/>
+ </message_arguments>
+ </filter>
+ <filter id="1141899266">
+ <message_arguments>
+ <message_argument value="3.10"/>
+ <message_argument value="3.9"/>
+ <message_argument value="setModuleDescription(String)"/>
+ </message_arguments>
+ </filter>
+ <filter id="1141899266">
+ <message_arguments>
+ <message_argument value="3.10"/>
+ <message_argument value="3.9"/>
+ <message_argument value="setModulepath(String[])"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="launching/org/eclipse/jdt/launching/sourcelookup/LocalFileStorage.java" type="org.eclipse.jdt.launching.sourcelookup.LocalFileStorage">
+ <filter comment="Known illegal extension" id="571473929">
+ <message_arguments>
+ <message_argument value="LocalFileStorage"/>
+ <message_argument value="LocalFileStorage"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="launching/org/eclipse/jdt/launching/sourcelookup/ZipEntryStorage.java" type="org.eclipse.jdt.launching.sourcelookup.ZipEntryStorage">
+ <filter comment="This is a known illegal extension" id="571473929">
+ <message_arguments>
+ <message_argument value="ZipEntryStorage"/>
+ <message_argument value="ZipEntryStorage"/>
+ </message_arguments>
+ </filter>
+ </resource>
+</component>
diff --git a/org.eclipse.jdt.launching/META-INF/MANIFEST.MF b/org.eclipse.jdt.launching/META-INF/MANIFEST.MF
index 03a978b88..fc0027d7a 100644
--- a/org.eclipse.jdt.launching/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.launching/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.launching; singleton:=true
-Bundle-Version: 3.9.0.qualifier
+Bundle-Version: 3.10.0.qualifier
Bundle-Activator: org.eclipse.jdt.internal.launching.LaunchingPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/AbstractRuntimeClasspathEntry.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/AbstractRuntimeClasspathEntry.java
index 1185ae0af..4f7042fd0 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/AbstractRuntimeClasspathEntry.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/AbstractRuntimeClasspathEntry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -260,4 +260,9 @@ public abstract class AbstractRuntimeClasspathEntry extends PlatformObject imple
protected void setJavaProject(IJavaProject javaProject) {
fJavaProject = javaProject;
}
+
+ @Override
+ public boolean isAutomodule() {
+ return false;
+ }
}
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/DefaultEntryResolver.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/DefaultEntryResolver.java
index c2a33ed36..90023ff2a 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/DefaultEntryResolver.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/DefaultEntryResolver.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -33,7 +33,8 @@ public class DefaultEntryResolver implements IRuntimeClasspathEntryResolver {
@Override
public IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry, ILaunchConfiguration configuration) throws CoreException {
IRuntimeClasspathEntry2 entry2 = (IRuntimeClasspathEntry2)entry;
- IRuntimeClasspathEntry[] entries = entry2.getRuntimeClasspathEntries(configuration);
+ IRuntimeClasspathEntry[] entries;
+ entries = entry2.getRuntimeClasspathEntries(configuration);
List<IRuntimeClasspathEntry> resolved = new ArrayList<>();
for (int i = 0; i < entries.length; i++) {
IRuntimeClasspathEntry[] temp = JavaRuntime.resolveRuntimeClasspathEntry(entries[i], configuration);
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/DefaultProjectClasspathEntry.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/DefaultProjectClasspathEntry.java
index 472fbbd40..569eaa252 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/DefaultProjectClasspathEntry.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/DefaultProjectClasspathEntry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -299,7 +299,7 @@ public class DefaultProjectClasspathEntry extends AbstractRuntimeClasspathEntry
IPackageFragmentRoot[] roots = project.findPackageFragmentRoots(entry);
for (int i = 0; i < roots.length; i++) {
IPackageFragmentRoot root = roots[i];
- r = JavaRuntime.newArchiveRuntimeClasspathEntry(root.getPath());
+ r = JavaRuntime.newArchiveRuntimeClasspathEntry(root.getPath(), entry.getSourceAttachmentPath(), entry.getSourceAttachmentRootPath(), entry.getAccessRules(), entry.getExtraAttributes(), entry.isExported());
r.setSourceAttachmentPath(entry.getSourceAttachmentPath());
r.setSourceAttachmentRootPath(entry.getSourceAttachmentRootPath());
if (!expandedPath.contains(r)) {
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/JavaFxLibraryResolver.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/JavaFxLibraryResolver.java
index 42c139daf..d1917c9f3 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/JavaFxLibraryResolver.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/JavaFxLibraryResolver.java
@@ -52,7 +52,7 @@ public class JavaFxLibraryResolver implements ILibraryLocationResolver {
public URL getJavadocLocation(IPath libraryPath) {
if (isJavaFx(libraryPath)) {
/*
- * TODO: We don't know if JavaSE-1.9 will ship JavaFX in the ext folder as well. If yes, then we have to use something like
+ * TODO: We don't know if JavaSE-9 will ship JavaFX in the ext folder as well. If yes, then we have to use something like
* JavaRuntime#getVMInstall(IPath) and IVMInstall2#getJavaVersion() to determine the right Javadoc URL.
*/
try {
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/JavaLaunchableTester.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/JavaLaunchableTester.java
index b7b539cfe..471965f79 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/JavaLaunchableTester.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/JavaLaunchableTester.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -37,6 +37,7 @@ import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IOpenable;
+import org.eclipse.jdt.core.IOrdinaryClassFile;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.ISourceRange;
@@ -143,8 +144,8 @@ public class JavaLaunchableTester extends PropertyTester {
if (element instanceof ICompilationUnit) {
type= ((ICompilationUnit) element).findPrimaryType();
}
- else if (element instanceof IClassFile) {
- type = ((IClassFile)element).getType();
+ else if (element instanceof IOrdinaryClassFile) {
+ type = ((IOrdinaryClassFile) element).getType();
}
else if (element instanceof IType) {
type = (IType) element;
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/LaunchingMessages.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/LaunchingMessages.java
index 947f93d5d..06f626e84 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/LaunchingMessages.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/LaunchingMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -233,4 +233,8 @@ public class LaunchingMessages extends NLS {
public static String MacInstalledJREs_1;
+ public static String RunnerBootpathError;
+
+ public static String RunnerBootpathPError;
+
}
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/LaunchingMessages.properties b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/LaunchingMessages.properties
index a06cc2945..5a28638f8 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/LaunchingMessages.properties
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/LaunchingMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2013 IBM Corporation and others.
+# Copyright (c) 2000, 2017 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -195,3 +195,5 @@ VMDefinitionsContainer_6=Unable to restore Javadoc location for installed JRE ''
VMDefinitionsContainer_7=Installed JRE ''{0}'' removed due to missing id.
VMDefinitionsContainer_9=Installed JRE of type ''{0}'' removed due to missing install path, name, and id.
VMDefinitionsContainer_10=Installed JREs
+RunnerBootpathError=Xbootclasspath option have been removed as not supported beyond Java 8.
+RunnerBootpathPError=Xbootclasspath/p option have been removed as not supported beyond Java 8. \ No newline at end of file
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/RuntimeClasspathEntry.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/RuntimeClasspathEntry.java
index df2e51066..2038cf4bc 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/RuntimeClasspathEntry.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/RuntimeClasspathEntry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -113,8 +113,18 @@ public class RuntimeClasspathEntry implements IRuntimeClasspathEntry {
case IClasspathEntry.CPE_CONTAINER:
setType(CONTAINER);
break;
+ case IClasspathEntry.CPE_PROJECT:
+ setType(PROJECT);
+ break;
+ case IClasspathEntry.CPE_LIBRARY:
+ setType(ARCHIVE);
+ break;
+ case IClasspathEntry.CPE_VARIABLE:
+ setType(VARIABLE);
+ break;
default:
- throw new IllegalArgumentException(NLS.bind(LaunchingMessages.RuntimeClasspathEntry_Illegal_classpath_entry__0__1, new String[] {entry.toString()}));
+ throw new IllegalArgumentException(NLS.bind(LaunchingMessages.RuntimeClasspathEntry_Illegal_classpath_entry__0__1, new String[] {
+ entry.toString() }));
}
setClasspathEntry(entry);
setClasspathProperty(classpathProperty);
@@ -716,4 +726,15 @@ public class RuntimeClasspathEntry implements IRuntimeClasspathEntry {
public void setJavaProject(IJavaProject project) {
fJavaProject = project;
}
+
+ @Override
+ public boolean isAutomodule() {
+ IClasspathAttribute[] extraAttributes = getClasspathEntry().getExtraAttributes();
+ for (IClasspathAttribute attribute : extraAttributes) {
+ if (IClasspathAttribute.MODULE.equals(attribute.getName()) && Boolean.TRUE.toString().equals(attribute.getValue())) {
+ return true;
+ }
+ }
+ return false;
+ }
}
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMDebugger.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMDebugger.java
index ed11b38b7..e67fdb533 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMDebugger.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMDebugger.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -209,6 +209,12 @@ public class StandardVMDebugger extends StandardVMRunner {
addArguments(ensureEncoding(launch, allVMArgs), arguments);
addBootClassPathArguments(arguments, config);
+ String[] mp = config.getModulepath();
+ if (isModular(config, fVMInstance) && (mp != null && mp.length > 0)) {
+ arguments.add("-p"); //$NON-NLS-1$
+ arguments.add(convertClassPath(mp));
+ }
+
String[] cp= config.getClassPath();
int cpidx = -1;
if (cp.length > 0) {
@@ -217,7 +223,19 @@ public class StandardVMDebugger extends StandardVMRunner {
arguments.add(convertClassPath(cp));
}
- arguments.add(config.getClassToLaunch());
+ if (isModular(config, fVMInstance)) {
+ arguments.add("-m"); //$NON-NLS-1$
+ arguments.add(config.getModuleDescription() + "/" + config.getClassToLaunch()); //$NON-NLS-1$
+ } else {
+ arguments.add(config.getClassToLaunch());
+ }
+
+ /*
+ * String[] cp= config.getClassPath(); int cpidx = -1; if (cp.length > 0) { cpidx = arguments.size(); arguments.add("-classpath");
+ * //$NON-NLS-1$ arguments.add(convertClassPath(cp)); }
+ *
+ * arguments.add(config.getClassToLaunch());
+ */
addArguments(config.getProgramArguments(), arguments);
//With the newer VMs and no backwards compatibility we have to always prepend the current env path (only the runtime one)
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMRunner.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMRunner.java
index 6d27b25c9..a0b4d4241 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMRunner.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMRunner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -35,6 +35,7 @@ import org.eclipse.jdt.launching.AbstractVMRunner;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.IVMInstall2;
+import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jdt.launching.VMRunnerConfiguration;
import org.eclipse.osgi.util.NLS;
@@ -372,6 +373,12 @@ public class StandardVMRunner extends AbstractVMRunner {
addBootClassPathArguments(arguments, config);
+ String[] mp = config.getModulepath();
+ if (isModular(config, fVMInstance) && (mp != null && mp.length > 0)) {
+ arguments.add("-p"); //$NON-NLS-1$
+ arguments.add(convertClassPath(mp));
+ }
+
String[] cp= config.getClassPath();
int cpidx = -1;
if (cp.length > 0) {
@@ -379,7 +386,13 @@ public class StandardVMRunner extends AbstractVMRunner {
arguments.add("-classpath"); //$NON-NLS-1$
arguments.add(convertClassPath(cp));
}
- arguments.add(config.getClassToLaunch());
+
+ if (isModular(config, fVMInstance)) {
+ arguments.add("-m"); //$NON-NLS-1$
+ arguments.add(config.getModuleDescription() + "/" + config.getClassToLaunch()); //$NON-NLS-1$
+ } else {
+ arguments.add(config.getClassToLaunch());
+ }
String[] programArgs= config.getProgramArguments();
addArguments(programArgs, arguments);
@@ -583,17 +596,30 @@ public class StandardVMRunner extends AbstractVMRunner {
String[] appendBootCP= null;
Map<String, Object> map = config.getVMSpecificAttributesMap();
if (map != null) {
- prependBootCP= (String[]) map.get(IJavaLaunchConfigurationConstants.ATTR_BOOTPATH_PREPEND);
- bootCP= (String[]) map.get(IJavaLaunchConfigurationConstants.ATTR_BOOTPATH);
+ prependBootCP = (String[]) map.get(IJavaLaunchConfigurationConstants.ATTR_BOOTPATH_PREPEND);
+ bootCP = (String[]) map.get(IJavaLaunchConfigurationConstants.ATTR_BOOTPATH);
+ if (JavaRuntime.isModularJava(fVMInstance)) {
+ if (prependBootCP != null && prependBootCP.length > 0) {
+ prependBootCP = null;
+ LaunchingPlugin.log(LaunchingMessages.RunnerBootpathPError);
+ }
+ if (bootCP != null && bootCP.length > 0) {
+ bootCP = null;
+ LaunchingPlugin.log(LaunchingMessages.RunnerBootpathError);
+ }
+ }
appendBootCP= (String[]) map.get(IJavaLaunchConfigurationConstants.ATTR_BOOTPATH_APPEND);
}
- if (prependBootCP == null && bootCP == null && appendBootCP == null) {
- // use old single attribute instead of new attributes if not specified
- bootCP = config.getBootClassPath();
- }
- if (prependBootCP != null) {
- arguments.add("-Xbootclasspath/p:" + convertClassPath(prependBootCP)); //$NON-NLS-1$
+ if (!JavaRuntime.isModularJava(fVMInstance)) {
+ if (prependBootCP == null && bootCP == null && appendBootCP == null) {
+ // use old single attribute instead of new attributes if not specified
+ bootCP = config.getBootClassPath();
+ }
}
+ if (prependBootCP != null) {
+ arguments.add("-Xbootclasspath/p:" + convertClassPath(prependBootCP)); //$NON-NLS-1$
+ }
+
if (bootCP != null) {
if (bootCP.length > 0) {
arguments.add("-Xbootclasspath:" + convertClassPath(bootCP)); //$NON-NLS-1$
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMType.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMType.java
index a7080e78f..ff2eec023 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMType.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,6 +19,8 @@ import java.io.FilenameFilter;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
@@ -29,6 +31,8 @@ import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Optional;
+import java.util.stream.Stream;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -68,6 +72,8 @@ public class StandardVMType extends AbstractVMInstallType {
private static final String JRE = "jre"; //$NON-NLS-1$
private static final String LIB = "lib"; //$NON-NLS-1$
private static final String BAR = "|"; //$NON-NLS-1$
+ private static final String RELEASE_FILE = "release"; //$NON-NLS-1$
+ private static final String JAVA_VERSION = "JAVA_VERSION"; //$NON-NLS-1$
public static final String ID_STANDARD_VM_TYPE = "org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType"; //$NON-NLS-1$
@@ -205,13 +211,19 @@ public class StandardVMType extends AbstractVMInstallType {
if (info == null || LaunchingPlugin.timeStampChanged(installPath)) {
info = fgFailedInstallPath.get(installPath);
if (info == null) {
- info = generateLibraryInfo(javaHome, javaExecutable);
- if (info == null) {
- info = getDefaultLibraryInfo(javaHome);
- fgFailedInstallPath.put(installPath, info);
+ String version = readReleaseVersion(javaHome);
+ if (JavaCore.compareJavaVersions(version, JavaCore.VERSION_1_8) > 0) {
+ info = new LibraryInfo(version, new String[0], new String[0], new String[0]);
+ LaunchingPlugin.setLibraryInfo(installPath, info);
} else {
- // only persist if we were able to generate information - see bug 70011
- LaunchingPlugin.setLibraryInfo(installPath, info);
+ info = generateLibraryInfo(javaHome, javaExecutable);
+ if (info == null) {
+ info = getDefaultLibraryInfo(javaHome);
+ fgFailedInstallPath.put(installPath, info);
+ } else {
+ // only persist if we were able to generate information - see bug 70011
+ LaunchingPlugin.setLibraryInfo(installPath, info);
+ }
}
}
}
@@ -422,11 +434,41 @@ public class StandardVMType extends AbstractVMInstallType {
// Add all endorsed libraries - they are first, as they replace
allLibs = new ArrayList<>(gatherAllLibraries(libInfo.getEndorsedDirs()));
+ URL url = getDefaultJavadocLocation(installLocation);
+ if (libInfo.getBootpath().length == 0) {
+ // TODO: Bug 489207: Temporary workaround for Jigsaw-previews that don't declare a bootpath.
+ // JDT Core currently requires a non-empty library path, so let's give it jrt-fs.jar as a stand-in for now.
+ // Code referencing org.eclipse.jdt.internal.compiler.util.JimageUtil.JRT_FS_JAR looks for this file.
+ IPath sourceRootPath = Path.EMPTY;
+ // src zip moved to lib folder from JDK 9 EA Build 151
+ IPath path = new Path(installLocation.getAbsolutePath()).append("lib").append("src.zip"); //$NON-NLS-1$ //$NON-NLS-2$
+ File lib = path.toFile();
+ if (lib.exists() && lib.isFile()) {
+ sourceRootPath = getDefaultSystemLibrarySource(lib); // To attach source if available
+ } else {
+ path = new Path(installLocation.getAbsolutePath()).append("src.zip"); //$NON-NLS-1$
+ lib = path.toFile();
+ if (lib.exists() && lib.isFile()) {
+ sourceRootPath = getDefaultSystemLibrarySource(lib); // To attach source if available
+ }
+ }
+ IPath pathName = new Path(installLocation.getAbsolutePath()).append("lib").append("jrt-fs.jar"); //$NON-NLS-1$ //$NON-NLS-2$
+ // From Java 9 149 version, we see that jrt-fs.jar is moved to lib directory so we need to look at both places
+ File jrtfsJar = pathName.toFile();
+ if (!jrtfsJar.exists()) {
+ pathName = new Path(installLocation.getAbsolutePath()).append("jrt-fs.jar"); //$NON-NLS-1$
+ }
+
+ LibraryLocation libraryLocation = new LibraryLocation(pathName,
+ sourceRootPath, getDefaultPackageRootPath(),
+ getDefaultJavadocLocation(installLocation));
+ allLibs.add(libraryLocation);
+ }
// next is the boot path libraries
String[] bootpath = libInfo.getBootpath();
List<LibraryLocation> boot = new ArrayList<>(bootpath.length);
- URL url = getDefaultJavadocLocation(installLocation);
+
for (int i = 0; i < bootpath.length; i++) {
IPath path = new Path(bootpath[i]);
File lib = path.toFile();
@@ -762,7 +804,9 @@ public class StandardVMType extends AbstractVMInstallType {
*/
public static URL getDefaultJavadocLocation(String version) {
try {
- if (version.startsWith(JavaCore.VERSION_1_8)) {
+ if (version.startsWith(JavaCore.VERSION_9)) {
+ return new URL("http://download.java.net/java/jdk9/docs/api/"); //$NON-NLS-1$
+ } else if (version.startsWith(JavaCore.VERSION_1_8)) {
return new URL("https://docs.oracle.com/javase/8/docs/api/"); //$NON-NLS-1$
} else if (version.startsWith(JavaCore.VERSION_1_7)) {
return new URL("https://docs.oracle.com/javase/7/docs/api/"); //$NON-NLS-1$
@@ -782,4 +826,22 @@ public class StandardVMType extends AbstractVMInstallType {
return null;
}
+ private synchronized String readReleaseVersion(File javaHome) {
+
+ String version = ""; //$NON-NLS-1$
+ try (Stream<String> lines = Files.lines(Paths.get(javaHome.getAbsolutePath(), RELEASE_FILE)).filter(s -> s.contains(JAVA_VERSION))) {
+ Optional<String> hasVersion = lines.findFirst();
+ if (hasVersion.isPresent()) {
+ String line = hasVersion.get();
+ version = line.substring(14, line.length() - 1); // length of JAVA_VERSION + 2 in JAVA_VERSION="9"
+ }
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ return version;
+
+ }
+
}
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironment.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironment.java
index ca101f021..06c30c683 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironment.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironment.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -451,6 +451,7 @@ class ExecutionEnvironment implements IExecutionEnvironment {
if (is != null) {
Properties profile = new Properties();
profile.load(is);
+ fixJavaSE9ComplianceSourceTargetLevels(profile);
return profile;
}
} catch (IOException e) {
@@ -459,6 +460,20 @@ class ExecutionEnvironment implements IExecutionEnvironment {
return null;
}
+
+ /**
+ * Bug 470616: [1.9] JavaSE-9 Execution Environment should set proper compiler compliance/source/target levels
+ * <p>
+ * This is a workaround for Bug 495497: [9] JavaSE-9.profile Execution Environment should set compiler levels to 9
+ */
+ private void fixJavaSE9ComplianceSourceTargetLevels(Properties profile) {
+ if (ExecutionEnvironmentAnalyzer.JavaSE_9.equals(getId())) {
+ profile.setProperty(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_9);
+ profile.setProperty(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_9);
+ profile.setProperty(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_9);
+ }
+ }
+
/* (non-Javadoc)
* @see org.eclipse.jdt.launching.environments.IExecutionEnvironment#getSubEnvironments()
*/
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironmentAnalyzer.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironmentAnalyzer.java
index 780e2a7a0..a4e3ea954 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironmentAnalyzer.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironmentAnalyzer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2015 IBM Corporation and others.
+ * Copyright (c) 2006, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,10 +18,8 @@ import java.util.StringTokenizer;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-
import org.eclipse.jdt.internal.launching.EEVMInstall;
import org.eclipse.jdt.internal.launching.EEVMType;
-
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.IVMInstall2;
import org.eclipse.jdt.launching.IVMInstall3;
@@ -38,6 +36,7 @@ import org.eclipse.jdt.launching.environments.IExecutionEnvironmentsManager;
public class ExecutionEnvironmentAnalyzer implements IExecutionEnvironmentAnalyzerDelegate {
// XXX: Note that this string is not yet standardized by OSGi, see http://wiki.osgi.org/wiki/Execution_Environment
+ static final String JavaSE_9 = "JavaSE-9"; //$NON-NLS-1$
private static final String JavaSE_1_8 = "JavaSE-1.8"; //$NON-NLS-1$
private static final String JavaSE_1_7 = "JavaSE-1.7"; //$NON-NLS-1$
@@ -76,6 +75,7 @@ public class ExecutionEnvironmentAnalyzer implements IExecutionEnvironmentAnalyz
mappings.put(JavaSE_1_6, new String[] {J2SE_1_5});
mappings.put(JavaSE_1_7, new String[] {JavaSE_1_6});
mappings.put(JavaSE_1_8, new String[] { JavaSE_1_7 });
+ mappings.put(JavaSE_9, new String[] { JavaSE_1_8 });
}
@Override
public CompatibleEnvironment[] analyze(IVMInstall vm, IProgressMonitor monitor) throws CoreException {
@@ -101,7 +101,9 @@ public class ExecutionEnvironmentAnalyzer implements IExecutionEnvironmentAnalyz
types = getTypes(CDC_FOUNDATION_1_1);
}
} else {
- if (javaVersion.startsWith("1.8")) { //$NON-NLS-1$
+ if (javaVersion.startsWith("9")) { //$NON-NLS-1$
+ types = getTypes(JavaSE_9);
+ } else if (javaVersion.startsWith("1.8")) { //$NON-NLS-1$
types = getTypes(JavaSE_1_8);
} else if (javaVersion.startsWith("1.7")) { //$NON-NLS-1$
types = getTypes(JavaSE_1_7);
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 d46cb524c..ae0c1e6f5 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -238,6 +238,9 @@ public abstract class AbstractJavaLaunchConfigurationDelegate extends LaunchConf
*/
public String[] getBootpath(ILaunchConfiguration configuration)
throws CoreException {
+ if (JavaRuntime.isModularConfiguration(configuration)) {
+ return null;
+ }
String[][] paths = getBootpathExt(configuration);
String[] pre = paths[0];
String[] main = paths[1];
@@ -410,12 +413,13 @@ public abstract class AbstractJavaLaunchConfigurationDelegate extends LaunchConf
IRuntimeClasspathEntry[] entries = JavaRuntime
.computeUnresolvedRuntimeClasspath(configuration);
entries = JavaRuntime.resolveRuntimeClasspath(entries, configuration);
+
List<String> userEntries = new ArrayList<>(entries.length);
Set<String> set = new HashSet<>(entries.length);
- for (int i = 0; i < entries.length; i++) {
- if (entries[i].getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) {
- String location = entries[i].getLocation();
- if (location != null) {
+ for (IRuntimeClasspathEntry entry : entries) {
+ String location = entry.getLocation();
+ if (location != null) {
+ if (entry.getClasspathProperty() != IRuntimeClasspathEntry.MODULE_PATH) {
if (!set.contains(location)) {
userEntries.add(location);
set.add(location);
@@ -425,6 +429,54 @@ public abstract class AbstractJavaLaunchConfigurationDelegate extends LaunchConf
}
return userEntries.toArray(new String[userEntries.size()]);
}
+
+ /**
+ * Returns the entries that should appear on the user portion of the classpath and modulepath as specified by the given launch configuration, as
+ * an array of resolved strings. The returned array is empty if no classpath and modulepath is specified.
+ *
+ * @param config
+ * launch configuration
+ * @return the classpath and modulepath specified by the given launch configuration, possibly an empty array
+ * @exception CoreException
+ * if unable to retrieve the attribute
+ * @since 3.10
+ */
+ public String[][] getClasspathAndModulepath(ILaunchConfiguration config) throws CoreException {
+ IRuntimeClasspathEntry[] entries = JavaRuntime.computeUnresolvedRuntimeClasspath(config);
+ entries = JavaRuntime.resolveRuntimeClasspath(entries, config);
+ String[][] path = new String[2][entries.length];
+ List<String> classpathEntries = new ArrayList<>(entries.length);
+ List<String> modulepathEntries = new ArrayList<>(entries.length);
+ Set<String> classpathSet = new HashSet<>(entries.length);
+ Set<String> modulepathSet = new HashSet<>(entries.length);
+ for (IRuntimeClasspathEntry entry : entries) {
+ String location = entry.getLocation();
+ if (location != null) {
+ if (entry.getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) {
+ if (!classpathSet.contains(location)) {
+ classpathEntries.add(location);
+ classpathSet.add(location);
+ }
+ } else if (entry.getClasspathProperty() == IRuntimeClasspathEntry.CLASS_PATH) {
+ if (!classpathSet.contains(location)) {
+ classpathEntries.add(location);
+ classpathSet.add(location);
+ }
+
+ } else if (entry.getClasspathProperty() == IRuntimeClasspathEntry.MODULE_PATH) {
+ if (!modulepathSet.contains(location)) {
+ modulepathEntries.add(location);
+ modulepathSet.add(location);
+ }
+ }
+
+ }
+ }
+ path[0] = classpathEntries.toArray(new String[classpathEntries.size()]);
+ path[1] = modulepathEntries.toArray(new String[classpathEntries.size()]);
+ return path;
+ }
+
/**
* Returns the Java project specified by the given launch configuration, or
* <code>null</code> if none.
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/AbstractVMRunner.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/AbstractVMRunner.java
index 3c7dfff23..de281cdb5 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/AbstractVMRunner.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/AbstractVMRunner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,6 +25,7 @@ import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.internal.launching.LaunchingMessages;
import org.eclipse.jdt.internal.launching.LaunchingPlugin;
import org.eclipse.osgi.service.environment.Constants;
@@ -109,10 +110,13 @@ public abstract class AbstractVMRunner implements IVMRunner {
private static boolean needsQuoting(String s) {
int len = s.length();
- if (len == 0) // empty string has to be quoted
+ if (len == 0) {
return true;
+ }
if ("\"\"".equals(s)) //$NON-NLS-1$
+ {
return false; // empty quotes must not be quoted again
+ }
for (int i = 0; i < len; i++) {
switch (s.charAt(i)) {
case ' ': case '\t': case '\\': case '"':
@@ -123,8 +127,9 @@ public abstract class AbstractVMRunner implements IVMRunner {
}
private static String winQuote(String s) {
- if (! needsQuoting(s))
+ if (! needsQuoting(s)) {
return s;
+ }
s = s.replaceAll("([\\\\]*)\"", "$1$1\\\\\""); //$NON-NLS-1$ //$NON-NLS-2$
s = s.replaceAll("([\\\\]*)\\z", "$1$1"); //$NON-NLS-1$ //$NON-NLS-2$
return "\"" + s + "\""; //$NON-NLS-1$ //$NON-NLS-2$
@@ -208,4 +213,29 @@ public abstract class AbstractVMRunner implements IVMRunner {
System.arraycopy(launchVMArgs, 0, allVMArgs, vmVMArgs.length, launchVMArgs.length);
return allVMArgs;
}
+
+ /**
+ * Examines the project and install for presence of module and execution support.
+ *
+ * @param config
+ * runner configuration
+ * @param vmInstall
+ * VM install
+ * @return <code>true</code> if project is a module and uses JRE version 9 or more, or <code>false</code> otherwise
+ * @since 3.10
+ */
+ protected boolean isModular(VMRunnerConfiguration config, IVMInstall vmInstall) {
+ if (config.getModuleDescription() != null && config.getModuleDescription().length() > 0 && vmInstall instanceof AbstractVMInstall) {
+ AbstractVMInstall install = (AbstractVMInstall) vmInstall;
+ String vmver = install.getJavaVersion();
+ // versionToJdkLevel only handles 3 char versions = 1.5, 1.6, 1.9, etc
+ if (vmver.length() > 3) {
+ vmver = vmver.substring(0, 3);
+ }
+ if (JavaCore.compareJavaVersions(vmver, JavaCore.VERSION_9) >= 0) {
+ return true;
+ }
+ }
+ return false;
+ }
}
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/IJavaLaunchConfigurationConstants.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/IJavaLaunchConfigurationConstants.java
index e471ffcc0..46d14195b 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/IJavaLaunchConfigurationConstants.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/IJavaLaunchConfigurationConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -176,6 +176,15 @@ public interface IJavaLaunchConfigurationConstants {
public static final String ATTR_CLASSPATH = LaunchingPlugin.getUniqueIdentifier() + ".CLASSPATH"; //$NON-NLS-1$
/**
+ * Launch configuration attribute key. The attribute value is an ordered list of strings which are mementos for runtime module path entries. When
+ * unspecified, a default modulepath is generated by the dependency provider associated with a launch configuration (via the
+ * <code>ATTR_CLASSPATH_PROVIDER</code> attribute).
+ *
+ * @since 3.10
+ */
+ public static final String ATTR_MODULEPATH = LaunchingPlugin.getUniqueIdentifier() + ".MODULEPATH"; //$NON-NLS-1$
+
+ /**
* Launch configuration attribute key. The value is a boolean specifying
* whether a default classpath should be used when launching a local
* Java application. When <code>false</code>, a classpath must be specified
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/IRuntimeClasspathEntry.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/IRuntimeClasspathEntry.java
index 165632b2e..265c19d2a 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/IRuntimeClasspathEntry.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/IRuntimeClasspathEntry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -96,6 +96,20 @@ public interface IRuntimeClasspathEntry {
public static final int USER_CLASSES = 3;
/**
+ * Classpath property identifier for entries that should appear on the module path for modular project.
+ *
+ * @since 3.10
+ */
+ public static final int MODULE_PATH = 4;
+
+ /**
+ * Classpath property identifier for entries that should appear on the class path for modular project.
+ *
+ * @since 3.10
+ */
+ public static final int CLASS_PATH = 5;
+
+ /**
* Returns this classpath entry's type. The type of a runtime classpath entry is
* identified by one of the following constants:
* <ul>
@@ -347,4 +361,12 @@ public interface IRuntimeClasspathEntry {
* @since 3.0
*/
public IJavaProject getJavaProject();
+
+ /**
+ * Returns <code>true</code> if the java project associated is an AutoModule.
+ *
+ * @return <code>true</code> if the Java project associated is an AutoModule or <code>false</code> if not
+ * @since 3.10
+ */
+ public boolean isAutomodule();
}
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 089ed833e..87c363ca9 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,6 +18,8 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IModuleDescription;
import org.eclipse.jdt.internal.launching.LaunchingMessages;
import org.eclipse.osgi.util.NLS;
@@ -68,19 +70,32 @@ public class JavaLaunchDelegate extends AbstractJavaLaunchConfigurationDelegate
// VM-specific attributes
Map<String, Object> vmAttributesMap = getVMSpecificAttributesMap(configuration);
- // Classpath
- String[] classpath = getClasspath(configuration);
-
+ // Bug 522333 :to be used for modulepath only for 4.7.*
+ String[][] paths = getClasspathAndModulepath(configuration);
// Create VM config
- VMRunnerConfiguration runConfig = new VMRunnerConfiguration(mainTypeName, classpath);
+ VMRunnerConfiguration runConfig = new VMRunnerConfiguration(mainTypeName, getClasspath(configuration));
runConfig.setProgramArguments(execArgs.getProgramArgumentsArray());
runConfig.setEnvironment(envp);
runConfig.setVMArguments(execArgs.getVMArgumentsArray());
runConfig.setWorkingDirectory(workingDirName);
runConfig.setVMSpecificAttributesMap(vmAttributesMap);
+ // current module name, if so
+ IJavaProject proj = JavaRuntime.getJavaProject(configuration);
+ if (proj != null) {
+ IModuleDescription module = proj == null ? null : proj.getModuleDescription();
+ String modName = module == null ? null : module.getElementName();
+ if (modName != null) {
+ runConfig.setModuleDescription(modName);
+ }
+ }
- // Bootpath
- runConfig.setBootClassPath(getBootpath(configuration));
+ if (!JavaRuntime.isModularConfiguration(configuration)) {
+ // Bootpath
+ runConfig.setBootClassPath(getBootpath(configuration));
+ } else {
+ // module path
+ runConfig.setModulepath(paths[1]);
+ }
// check for cancellation
if (monitor.isCanceled()) {
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaRuntime.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaRuntime.java
index 3f112f4bd..ebca8424a 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaRuntime.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaRuntime.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -56,12 +56,16 @@ import org.eclipse.core.variables.IStringVariableManager;
import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
+import org.eclipse.jdt.core.IAccessRule;
import org.eclipse.jdt.core.IClasspathAttribute;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaModel;
import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IModuleDescription;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.launching.CompositeId;
import org.eclipse.jdt.internal.launching.DefaultEntryResolver;
import org.eclipse.jdt.internal.launching.DefaultProjectClasspathEntry;
@@ -635,6 +639,21 @@ public final class JavaRuntime {
return newRuntimeClasspathEntry(JavaCore.newProjectEntry(project.getProject().getFullPath()));
}
+ /**
+ * Returns a new runtime classpath entry for the given project.
+ *
+ * @param project
+ * Java project
+ * @param classpathProperty
+ * the type of entry - one of <code>USER_CLASSES</code>, <code>BOOTSTRAP_CLASSES</code>,<code>STANDARD_CLASSES</code>,
+ * <code>MODULE_PATH</code> or <code>CLASS_PATH</code>
+ * @return runtime classpath entry
+ * @since 3.10
+ */
+ public static IRuntimeClasspathEntry newProjectRuntimeClasspathEntry(IJavaProject project, int classpathProperty) {
+ return newRuntimeClasspathEntry(JavaCore.newProjectEntry(project.getProject().getFullPath()), classpathProperty);
+ }
+
/**
* Returns a new runtime classpath entry for the given archive.
@@ -648,6 +667,21 @@ public final class JavaRuntime {
}
/**
+ * Returns a new runtime classpath entry for the given archive(possibly external).
+ *
+ * @param path
+ * absolute path to an archive
+ * @param classpathProperty
+ * the type of entry - one of <code>USER_CLASSES</code>, <code>BOOTSTRAP_CLASSES</code>,<code>STANDARD_CLASSES</code>,
+ * <code>MODULE_PATH</code> or <code>CLASS_PATH</code>
+ * @return runtime classpath entry
+ * @since 3.10
+ */
+ public static IRuntimeClasspathEntry newArchiveRuntimeClasspathEntry(IPath path, int classpathProperty) {
+ return newRuntimeClasspathEntry(JavaCore.newLibraryEntry(path, null, null), classpathProperty);
+ }
+
+ /**
* Returns a new runtime classpath entry for the given archive (possibly
* external).
*
@@ -660,6 +694,31 @@ public final class JavaRuntime {
}
/**
+ * Returns a new runtime classpath entry for the given archive (possibly external).
+ *
+ * @param path
+ * absolute path to an archive
+ * @param sourceAttachmentPath
+ * the absolute path of the corresponding source archive or folder, or <code>null</code> if none. Note, since 3.0, an empty path is
+ * allowed to denote no source attachment. and will be automatically converted to <code>null</code>. Since 3.4, this path can also
+ * denote a path external to the workspace.
+ * @param sourceAttachmentRootPath
+ * the location of the root of the source files within the source archive or folder or <code>null</code> if this location should be
+ * automatically detected.
+ * @param accessRules
+ * the possibly empty list of access rules for this entry
+ * @param extraAttributes
+ * the possibly empty list of extra attributes to persist with this entry
+ * @param isExported
+ * indicates whether this entry is contributed to dependent projects in addition to the output location
+ * @return runtime classpath entry
+ * @since 3.10
+ */
+ public static IRuntimeClasspathEntry newArchiveRuntimeClasspathEntry(IPath path, IPath sourceAttachmentPath, IPath sourceAttachmentRootPath, IAccessRule[] accessRules, IClasspathAttribute[] extraAttributes, boolean isExported) {
+ return newRuntimeClasspathEntry(JavaCore.newLibraryEntry(path, sourceAttachmentPath, sourceAttachmentRootPath, accessRules, extraAttributes, isExported));
+ }
+
+ /**
* Returns a new runtime classpath entry for the classpath
* variable with the given path.
*
@@ -678,7 +737,8 @@ public final class JavaRuntime {
*
* @param path container path
* @param classpathProperty the type of entry - one of <code>USER_CLASSES</code>,
- * <code>BOOTSTRAP_CLASSES</code>, or <code>STANDARD_CLASSES</code>
+ * <code>BOOTSTRAP_CLASSES</code>,<code>STANDARD_CLASSES</code>, <code>MODULE_PATH</code>
+ * or <code>CLASS_PATH</code>
* @return runtime classpath entry
* @exception CoreException if unable to construct a runtime classpath entry
* @since 2.0
@@ -765,6 +825,19 @@ public final class JavaRuntime {
}
/**
+ * Returns a runtime classpath entry that corresponds to the given classpath entry. The classpath entry may not be of type <code>CPE_SOURCE</code>
+ * or <code>CPE_CONTAINER</code>.
+ *
+ * @param entry
+ * a classpath entry
+ * @return runtime classpath entry
+ * @since 2.0
+ */
+ private static IRuntimeClasspathEntry newRuntimeClasspathEntry(IClasspathEntry entry, int classPathProperty) {
+ return new RuntimeClasspathEntry(entry, classPathProperty);
+ }
+
+ /**
* Computes and returns the default unresolved runtime classpath for the
* given project.
*
@@ -812,6 +885,189 @@ public final class JavaRuntime {
}
/**
+ * Computes and returns the default unresolved runtime classpath and modulepath for the given project.
+ *
+ * @param project
+ * the {@link IJavaProject} to compute the unresolved runtime classpath and modulepath for
+ * @return runtime classpath and modulepath entries
+ * @exception CoreException
+ * if unable to compute the runtime classpath and/or modulepath
+ * @see IRuntimeClasspathEntry
+ * @since 3.10
+ */
+ public static IRuntimeClasspathEntry[] computeUnresolvedRuntimeDependencies(IJavaProject project) throws CoreException {
+ IClasspathEntry[] entries = project.getResolvedClasspath(true);
+ List<IRuntimeClasspathEntry> classpathEntries = new ArrayList<>(3);
+
+ IClasspathEntry entry1 = JavaCore.newProjectEntry(project.getProject().getFullPath());
+ if (isModularProject(project)) {
+ classpathEntries.add(new RuntimeClasspathEntry(entry1, IRuntimeClasspathEntry.MODULE_PATH));
+ } else {
+ classpathEntries.add(new RuntimeClasspathEntry(entry1, IRuntimeClasspathEntry.CLASS_PATH));
+ }
+ for (int i = 0; i < entries.length; i++) {
+ IClasspathEntry entry = entries[i];
+ switch (entry.getEntryKind()) {
+ case IClasspathEntry.CPE_CONTAINER:
+ IClasspathContainer container = JavaCore.getClasspathContainer(entry.getPath(), project);
+ if (container != null) {
+ switch (container.getKind()) {
+ case IClasspathContainer.K_APPLICATION:
+ // don't look at application entries
+ break;
+ case IClasspathContainer.K_DEFAULT_SYSTEM:
+ if (isModule(entry, project)) {
+ classpathEntries.add(newRuntimeContainerClasspathEntry(container.getPath(), IRuntimeClasspathEntry.MODULE_PATH, project));
+ } else {
+ classpathEntries.add(newRuntimeContainerClasspathEntry(container.getPath(), IRuntimeClasspathEntry.CLASS_PATH, project));
+ }
+ break;
+ case IClasspathContainer.K_SYSTEM:
+ if (isModule(entry, project)) {
+ classpathEntries.add(newRuntimeContainerClasspathEntry(container.getPath(), IRuntimeClasspathEntry.MODULE_PATH, project));
+ } else {
+ classpathEntries.add(newRuntimeContainerClasspathEntry(container.getPath(), IRuntimeClasspathEntry.CLASS_PATH, project));
+ }
+ break;
+ }
+ }
+ break;
+ case IClasspathEntry.CPE_PROJECT:
+ String name = entry.getPath().lastSegment();
+ IProject dep = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+ IJavaProject javaProject = JavaCore.create(dep);
+ if (isModule(entry, project)) {
+ classpathEntries.add(newProjectRuntimeClasspathEntry(javaProject, IRuntimeClasspathEntry.MODULE_PATH));
+ } else {
+ classpathEntries.add(newProjectRuntimeClasspathEntry(javaProject, IRuntimeClasspathEntry.CLASS_PATH));
+ }
+ break;
+ case IClasspathEntry.CPE_VARIABLE:
+ if (JRELIB_VARIABLE.equals(entry.getPath().segment(0))) {
+ IRuntimeClasspathEntry jre = newVariableRuntimeClasspathEntry(entry.getPath());
+ jre.setClasspathProperty(IRuntimeClasspathEntry.MODULE_PATH);
+ classpathEntries.add(jre);
+ }
+ break;
+ case IClasspathEntry.CPE_LIBRARY:
+ IPackageFragmentRoot root = project.findPackageFragmentRoot(entry.getPath());
+ if (!root.getRawClasspathEntry().getPath().segment(0).contains("JRE_CONTAINER")) { //$NON-NLS-1$
+ IRuntimeClasspathEntry r;
+ if (JavaRuntime.isModule(entry, project)) {
+ r = JavaRuntime.newArchiveRuntimeClasspathEntry(entry.getPath(), IRuntimeClasspathEntry.MODULE_PATH);
+ } else {
+ r = JavaRuntime.newArchiveRuntimeClasspathEntry(entry.getPath(), IRuntimeClasspathEntry.CLASS_PATH);
+ }
+ r.setSourceAttachmentPath(entry.getSourceAttachmentPath());
+ r.setSourceAttachmentRootPath(entry.getSourceAttachmentRootPath());
+ classpathEntries.add(r);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+
+ classpathEntries.add(JavaRuntime.computeModularJREEntry(project));
+ return classpathEntries.toArray(new IRuntimeClasspathEntry[classpathEntries.size()]);
+ }
+
+ /**
+ * Checks if classpath entry is modular and project is modular .
+ *
+ * @param entry
+ * the classpath entry
+ * @return boolean <code>true</code> if entry is module else <code>false</code>
+ * @since 3.10
+ */
+ public static boolean isModule(IClasspathEntry entry, IJavaProject proj) {
+ if (!isModularProject(proj)) {
+ return false;
+ }
+
+ if (entry == null) {
+ return false;
+ }
+ for (IClasspathAttribute classpathAttribute : entry.getExtraAttributes()) {
+ if (classpathAttribute.getName().equals(IClasspathAttribute.MODULE) && "true".equals(classpathAttribute.getValue())) {//$NON-NLS-1$
+ return true;
+ }
+ }
+ return false;
+
+ }
+
+ /**
+ * Checks if configuration JRE is greater than 8.
+ *
+ * @param configuration
+ * the launch configuration
+ * @return boolean <code>true</code> if jre used in configuration is greater than 8 else <code>false</code>
+ * @since 3.10
+ */
+ public static boolean isModularConfiguration(ILaunchConfiguration configuration) {
+
+ try {
+ IVMInstall vm = JavaRuntime.computeVMInstall(configuration);
+ return isModularJava(vm);
+ }
+ catch (CoreException e) {
+ e.printStackTrace();
+ }
+ return false;
+
+ }
+
+ /**
+ * Checks if vm install is modular( version greater than 8).
+ *
+ * @param vm
+ * the vm install
+ * @return boolean <code>true</code> if vm install is modular else <code>false</code>
+ * @since 3.10
+ */
+ public static boolean isModularJava(IVMInstall vm) {
+
+ if (vm instanceof AbstractVMInstall) {
+ AbstractVMInstall install = (AbstractVMInstall) vm;
+ String vmver = install.getJavaVersion();
+ // versionToJdkLevel only handles 3 char versions = 1.5, 1.6, 1.7, etc
+ if (vmver.length() > 3) {
+ vmver = vmver.substring(0, 3);
+ }
+ if (JavaCore.compareJavaVersions(vmver, JavaCore.VERSION_1_8) > 0) {
+ return true;
+ }
+ }
+ return false;
+
+ }
+
+ /**
+ * Checks if project entry is modular
+ *
+ * @param proj
+ * the project
+ * @return boolean <code>true</code> if project is modular else <code>false</code>
+ * @since 3.10
+ */
+ public static boolean isModularProject(IJavaProject proj) {
+
+ IModuleDescription module;
+ try {
+ module = proj == null ? null : proj.getModuleDescription();
+ String modName = module == null ? null : module.getElementName();
+ if (modName != null && modName.length() > 0) {
+ return true;
+ }
+ }
+ catch (JavaModelException e) {
+ }
+ return false;
+ }
+
+ /**
* Computes and returns the unresolved source lookup path for the given launch
* configuration.
*
@@ -1257,6 +1513,30 @@ public final class JavaRuntime {
* @since 2.0
*/
public static IRuntimeClasspathEntry[] resolveRuntimeClasspath(IRuntimeClasspathEntry[] entries, ILaunchConfiguration configuration) throws CoreException {
+ if (isModularConfiguration(configuration)) {
+ IRuntimeClasspathEntry[] entries1 = getClasspathProvider(configuration).resolveClasspath(entries, configuration);
+ ArrayList<IRuntimeClasspathEntry> entries2 = new ArrayList<>(entries1.length);
+ for (IRuntimeClasspathEntry entry : entries1) {
+ switch (entry.getClasspathEntry().getEntryKind()) {
+ case IClasspathEntry.CPE_LIBRARY:
+ IJavaProject project = JavaRuntime.getJavaProject(configuration);
+ if (project == null) {
+ entries2.add(entry);
+ }
+ else {
+ IPackageFragmentRoot root = project.findPackageFragmentRoot(entry.getPath());
+ if (root != null && !root.getRawClasspathEntry().getPath().segment(0).contains("JRE_CONTAINER")) { //$NON-NLS-1$
+ entries2.add(entry);
+ }
+ }
+ break;
+ default:
+ entries2.add(entry);
+
+ }
+ }
+ return entries2.toArray(new IRuntimeClasspathEntry[entries2.size()]);
+ }
return getClasspathProvider(configuration).resolveClasspath(entries, configuration);
}
@@ -2044,6 +2324,9 @@ public final class JavaRuntime {
if (proj == null) {
containerPath = newDefaultJREContainerPath();
} else {
+ if (isModularConfiguration(configuration)) {
+ return computeModularJREEntry(proj);
+ }
return computeJREEntry(proj);
}
} else {
@@ -2057,6 +2340,9 @@ public final class JavaRuntime {
containerPath = Path.fromPortableString(jreAttr);
}
if (containerPath != null) {
+ if (isModularConfiguration(configuration)) {
+ return newRuntimeContainerClasspathEntry(containerPath, IRuntimeClasspathEntry.MODULE_PATH);
+ }
return newRuntimeContainerClasspathEntry(containerPath, IRuntimeClasspathEntry.STANDARD_CLASSES);
}
return null;
@@ -2112,6 +2398,64 @@ public final class JavaRuntime {
}
/**
+ * Returns a runtime classpath or modulepath entry identifying the JRE referenced by the specified project, or <code>null</code> if none. The
+ * entry returned represents a either a classpath variable or classpath container that resolves to a JRE.
+ *
+ * @param project
+ * Java project
+ * @return JRE runtime classpath or modulepath entry or <code>null</code>
+ * @exception org.eclipse.core.runtime.CoreException
+ * if an exception occurs accessing the project's classpath
+ * @since 3.10
+ */
+ public static IRuntimeClasspathEntry computeModularJREEntry(IJavaProject project) throws CoreException {
+ IClasspathEntry[] rawClasspath = project.getRawClasspath();
+ IRuntimeClasspathEntryResolver2 resolver = null;
+ for (int i = 0; i < rawClasspath.length; i++) {
+ IClasspathEntry entry = rawClasspath[i];
+ switch (entry.getEntryKind()) {
+ case IClasspathEntry.CPE_VARIABLE:
+ resolver = getVariableResolver(entry.getPath().segment(0));
+ if (resolver != null) {
+ if (resolver.isVMInstallReference(entry)) {
+ if (isModularProject(project)) {
+ return newRuntimeClasspathEntry(entry, IRuntimeClasspathEntry.MODULE_PATH);
+ }
+ return newRuntimeClasspathEntry(entry, IRuntimeClasspathEntry.CLASS_PATH);
+ }
+ }
+ break;
+ case IClasspathEntry.CPE_CONTAINER:
+ resolver = getContainerResolver(entry.getPath().segment(0));
+ if (resolver != null) {
+ if (resolver.isVMInstallReference(entry)) {
+ IClasspathContainer container = JavaCore.getClasspathContainer(entry.getPath(), project);
+ if (container != null) {
+ switch (container.getKind()) {
+ case IClasspathContainer.K_APPLICATION:
+ break;
+ case IClasspathContainer.K_DEFAULT_SYSTEM:
+ if (isModularProject(project)) {
+ return newRuntimeContainerClasspathEntry(entry.getPath(), IRuntimeClasspathEntry.MODULE_PATH);
+ }
+ return newRuntimeContainerClasspathEntry(entry.getPath(), IRuntimeClasspathEntry.CLASS_PATH);
+ case IClasspathContainer.K_SYSTEM:
+ if (isModularProject(project)) {
+ return newRuntimeContainerClasspathEntry(entry.getPath(), IRuntimeClasspathEntry.MODULE_PATH);
+ }
+ return newRuntimeContainerClasspathEntry(entry.getPath(), IRuntimeClasspathEntry.CLASS_PATH);
+ }
+ }
+ }
+ }
+ break;
+ }
+
+ }
+ return null;
+ }
+
+ /**
* Returns whether the given runtime classpath entry refers to a VM install.
*
* @param entry the entry to check
@@ -2796,8 +3140,11 @@ public final class JavaRuntime {
compliance = JavaCore.VERSION_1_7;
} else if (javaVersion.startsWith(JavaCore.VERSION_1_8)) {
compliance = JavaCore.VERSION_1_8;
+ } else if (javaVersion.startsWith(JavaCore.VERSION_9)
+ && (javaVersion.length() == JavaCore.VERSION_9.length() || javaVersion.charAt(JavaCore.VERSION_9.length()) == '.')) {
+ compliance = JavaCore.VERSION_9;
} else {
- compliance = JavaCore.VERSION_1_8; // use latest by default
+ compliance = JavaCore.VERSION_9; // use latest by default
}
Hashtable<String, String> options= JavaCore.getOptions();
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/StandardClasspathProvider.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/StandardClasspathProvider.java
index dbf77790a..396ee7fb2 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/StandardClasspathProvider.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/StandardClasspathProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,6 +11,7 @@
package org.eclipse.jdt.launching;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashSet;
@@ -36,6 +37,7 @@ public class StandardClasspathProvider implements IRuntimeClasspathProvider {
@Override
public IRuntimeClasspathEntry[] computeUnresolvedClasspath(ILaunchConfiguration configuration) throws CoreException {
boolean useDefault = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, true);
+ boolean isModular = JavaRuntime.isModularConfiguration(configuration);
if (useDefault) {
IJavaProject proj = JavaRuntime.getJavaProject(configuration);
IRuntimeClasspathEntry jreEntry = JavaRuntime.computeJREEntry(configuration);
@@ -46,9 +48,14 @@ public class StandardClasspathProvider implements IRuntimeClasspathProvider {
}
return new IRuntimeClasspathEntry[]{jreEntry};
}
- IRuntimeClasspathEntry[] entries = JavaRuntime.computeUnresolvedRuntimeClasspath(proj);
+ IRuntimeClasspathEntry[] entries = null;
+ if (isModular) {
+ entries = JavaRuntime.computeUnresolvedRuntimeDependencies(proj);
+ } else {
+ entries = JavaRuntime.computeUnresolvedRuntimeClasspath(proj);
+ }
// replace project JRE with config's JRE
- IRuntimeClasspathEntry projEntry = JavaRuntime.computeJREEntry(proj);
+ IRuntimeClasspathEntry projEntry = isModular ? JavaRuntime.computeModularJREEntry(proj) : JavaRuntime.computeJREEntry(proj);
if (jreEntry != null && projEntry != null) {
if (!jreEntry.equals(projEntry)) {
for (int i = 0; i < entries.length; i++) {
@@ -63,6 +70,13 @@ public class StandardClasspathProvider implements IRuntimeClasspathProvider {
return entries;
}
// recover persisted classpath
+ if (isModular) {
+ IRuntimeClasspathEntry[] runtimeModulePaths = recoverRuntimePath(configuration, IJavaLaunchConfigurationConstants.ATTR_MODULEPATH);
+ IRuntimeClasspathEntry[] runtimeClasspaths = recoverRuntimePath(configuration, IJavaLaunchConfigurationConstants.ATTR_CLASSPATH);
+ IRuntimeClasspathEntry[] result = Arrays.copyOf(runtimeModulePaths, runtimeModulePaths.length + runtimeClasspaths.length);
+ System.arraycopy(runtimeClasspaths, 0, result, runtimeModulePaths.length, runtimeClasspaths.length);
+ return result;
+ }
return recoverRuntimePath(configuration, IJavaLaunchConfigurationConstants.ATTR_CLASSPATH);
}
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/VMRunnerConfiguration.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/VMRunnerConfiguration.java
index 86037ae38..390bd5df8 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/VMRunnerConfiguration.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/VMRunnerConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -31,6 +31,8 @@ public class VMRunnerConfiguration {
private String[] fEnvironment;
private String[] fClassPath;
private String[] fBootClassPath;
+ private String[] fModulepath;
+ private String fModuleDescription;
private String fWorkingDirectory;
private Map<String, Object> fVMSpecificAttributesMap;
private boolean fResume = true;
@@ -264,4 +266,46 @@ public class VMRunnerConfiguration {
public boolean isResumeOnStartup() {
return fResume;
}
+
+ /**
+ * Sets the modulepath.
+ *
+ * @param modulepath
+ * modulepath
+ * @since 3.10
+ */
+ public void setModulepath(String[] modulepath) {
+ this.fModulepath = modulepath;
+ }
+
+ /**
+ * Returns the Modulepath.
+ *
+ * @return the modulepath
+ * @since 3.10
+ */
+ public String[] getModulepath() {
+ return this.fModulepath;
+ }
+
+ /**
+ * Sets the fModuleDescription.
+ *
+ * @param fModuleDescription
+ * fModuleDescription
+ * @since 3.10
+ */
+ public void setModuleDescription(String fModuleDescription) {
+ this.fModuleDescription = fModuleDescription;
+ }
+
+ /**
+ * Returns the ModuleDescription.
+ *
+ * @return the ModuleDescription
+ * @since 3.10
+ */
+ public String getModuleDescription() {
+ return this.fModuleDescription;
+ }
}
diff --git a/org.eclipse.jdt.launching/plugin.properties b/org.eclipse.jdt.launching/plugin.properties
index 5d024d7ea..792acb309 100644
--- a/org.eclipse.jdt.launching/plugin.properties
+++ b/org.eclipse.jdt.launching/plugin.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2014 IBM Corporation and others.
+# Copyright (c) 2000, 2016 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -58,6 +58,7 @@ environment.description.8 = CDC 1.1, Foundation 1.1
environment.description.9 = Java Platform, Standard Edition 6.0
environment.description.11 = Java Platform, Standard Edition 7.0
environment.description.12 = Java Platform, Standard Edition 8.0
+environment.description.13 = Java Platform, Standard Edition 9
classpathVariableInitializer.deprecated = Use the JRE System Library instead
diff --git a/org.eclipse.jdt.launching/plugin.xml b/org.eclipse.jdt.launching/plugin.xml
index 81d9bb0e8..13eec51bf 100644
--- a/org.eclipse.jdt.launching/plugin.xml
+++ b/org.eclipse.jdt.launching/plugin.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<!--
- Copyright (c) 2005, 2014 IBM Corporation and others.
+ Copyright (c) 2005, 2017 IBM Corporation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
@@ -292,6 +292,11 @@
description="%environment.description.12"
id="JavaSE-1.8"
ruleParticipant="org.eclipse.jdt.internal.launching.environments.DefaultAccessRuleParticipant">
+ </environment>
+ <environment
+ description="%environment.description.13"
+ id="JavaSE-9"
+ ruleParticipant="org.eclipse.jdt.internal.launching.environments.DefaultAccessRuleParticipant">
</environment>
<analyzer
class="org.eclipse.jdt.internal.launching.environments.ExecutionEnvironmentAnalyzer"
diff --git a/org.eclipse.jdt.launching/pom.xml b/org.eclipse.jdt.launching/pom.xml
index 57a50c910..3dad1bb27 100644
--- a/org.eclipse.jdt.launching/pom.xml
+++ b/org.eclipse.jdt.launching/pom.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2012, 2016 Eclipse Foundation and others.
+ Copyright (c) 2012, 2017 Eclipse Foundation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
@@ -18,7 +18,7 @@
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.launching</artifactId>
- <version>3.9.0-SNAPSHOT</version>
+ <version>3.10.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<build>

Back to the top