Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaDependenciesTab.java21
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/DefaultEntryResolver.java6
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/DefaultProjectDependencies.java255
-rw-r--r--org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaRuntime.java147
-rw-r--r--org.eclipse.jdt.launching/plugin.xml6
5 files changed, 82 insertions, 353 deletions
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
index 2396fa2aa..1be1f71f6 100644
--- 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
@@ -22,8 +22,6 @@ 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.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.internal.debug.ui.IJavaDebugHelpContextIds;
import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
import org.eclipse.jdt.internal.debug.ui.JavaDebugImages;
@@ -51,7 +49,6 @@ 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.internal.launching.DefaultProjectDependencies;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
import org.eclipse.jdt.launching.JavaRuntime;
@@ -259,25 +256,7 @@ public class JavaDependenciesTab extends JavaClasspathTab {
entry= entries[i];
switch (entry.getClasspathProperty()) {
case IRuntimeClasspathEntry.MODULE_PATH:
-
- if (entry instanceof DefaultProjectDependencies) {
- DefaultProjectDependencies r = (DefaultProjectDependencies) entry;
- IRuntimeClasspathEntry[] runtimeClasspathEntries = r.getDefualtDependencies();
- for (IRuntimeClasspathEntry iRuntimeClasspathEntry : runtimeClasspathEntries) {
- if (iRuntimeClasspathEntry.getClasspathEntry().getEntryKind() == org.eclipse.jdt.core.IClasspathEntry.CPE_LIBRARY) {
- IJavaProject project = JavaRuntime.getJavaProject(configuration);
- IPackageFragmentRoot root = project.findPackageFragmentRoot(iRuntimeClasspathEntry.getClasspathEntry().getPath());
- if (!root.getRawClasspathEntry().getPath().segment(0).contains("JRE_CONTAINER")) { //$NON-NLS-1$
- fModel.addEntry(DependencyModel.MODULE_PATH, iRuntimeClasspathEntry);
- }
- } else {
- fModel.addEntry(DependencyModel.MODULE_PATH, iRuntimeClasspathEntry);
- }
- }
- }
- else {
fModel.addEntry(DependencyModel.MODULE_PATH, entry);
- }
break;
default:
if (JavaRuntime.isModule(entry.getClasspathEntry())) {
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 14cf760df..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
@@ -34,11 +34,7 @@ public class DefaultEntryResolver implements IRuntimeClasspathEntryResolver {
public IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry, ILaunchConfiguration configuration) throws CoreException {
IRuntimeClasspathEntry2 entry2 = (IRuntimeClasspathEntry2)entry;
IRuntimeClasspathEntry[] entries;
- if (entry2 instanceof DefaultProjectDependencies) {
- entries = ((DefaultProjectDependencies) entry2).getDefualtDependencies();
- } else {
- entries = entry2.getRuntimeClasspathEntries(configuration);
- }
+ 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/DefaultProjectDependencies.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/DefaultProjectDependencies.java
deleted file mode 100644
index bfd64d55d..000000000
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/DefaultProjectDependencies.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*******************************************************************************
- * 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.launching;
-
-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.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.osgi.util.NLS;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * Default Project dependencies entries for a Java project
- */
-public class DefaultProjectDependencies extends AbstractRuntimeClasspathEntry {
-
- public static final String TYPE_ID = "org.eclipse.jdt.launching.classpathentry.defaultDependencies"; //$NON-NLS-1$
-
- /**
- * Whether only exported entries should be on the runtime classpath.
- * By default all entries are on the runtime classpath.
- */
- private boolean fExportedEntriesOnly = false;
-
- /**
- * Default constructor need to instantiate extensions
- */
- public DefaultProjectDependencies() {
- setClasspathProperty(IRuntimeClasspathEntry.MODULE_PATH);
- }
-
- /**
- * Constructs a new classpath entry for the given project.
- *
- * @param project Java project
- */
- public DefaultProjectDependencies(IJavaProject project) {
- setJavaProject(project);
- setClasspathProperty(IRuntimeClasspathEntry.MODULE_PATH);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jdt.internal.launching.AbstractRuntimeClasspathEntry#buildMemento(org.w3c.dom.Document, org.w3c.dom.Element)
- */
- @Override
- protected void buildMemento(Document document, Element memento) throws CoreException {
- memento.setAttribute("project", getJavaProject().getElementName()); //$NON-NLS-1$
- memento.setAttribute("exportedEntriesOnly", Boolean.toString(fExportedEntriesOnly)); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jdt.launching.IRuntimeClasspathEntry2#initializeFrom(org.w3c.dom.Element)
- */
- @Override
- public void initializeFrom(Element memento) throws CoreException {
- String name = memento.getAttribute("project"); //$NON-NLS-1$
- if (name == null) {
- abort(LaunchingMessages.DefaultProjectClasspathEntry_3, null);
- }
- IJavaProject project = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot().getProject(name));
- setJavaProject(project);
- name = memento.getAttribute("exportedEntriesOnly"); //$NON-NLS-1$
- if (name != null) {
- fExportedEntriesOnly = Boolean.valueOf(name).booleanValue();
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.jdt.launching.IRuntimeClasspathEntry2#getTypeId()
- */
- @Override
- public String getTypeId() {
- return TYPE_ID;
- }
- /* (non-Javadoc)
- * @see org.eclipse.jdt.launching.IRuntimeClasspathEntry#getType()
- */
- @Override
- public int getType() {
- return OTHER;
- }
-
- protected IProject getProject() {
- return getJavaProject().getProject();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jdt.launching.IRuntimeClasspathEntry#getLocation()
- */
- @Override
- public String getLocation() {
- return getProject().getLocation().toOSString();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jdt.launching.IRuntimeClasspathEntry#getPath()
- */
- @Override
- public IPath getPath() {
- return getProject().getFullPath();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jdt.launching.IRuntimeClasspathEntry#getResource()
- */
- @Override
- public IResource getResource() {
- return getProject();
- }
-
- public IRuntimeClasspathEntry[] getDefualtDependencies() throws CoreException {
- IClasspathEntry entry = JavaCore.newProjectEntry(getJavaProject().getProject().getFullPath());
- List<Object> classpathEntries = new ArrayList<>(5);
- expandProject(entry, classpathEntries);
- IRuntimeClasspathEntry[] runtimeEntries = new IRuntimeClasspathEntry[classpathEntries.size()];
- for (int i = 0; i < runtimeEntries.length; i++) {
- Object e = classpathEntries.get(i);
- if (e instanceof IClasspathEntry) {
- IClasspathEntry cpe = (IClasspathEntry) e;
- runtimeEntries[i] = new RuntimeClasspathEntry(cpe);
- } else {
- runtimeEntries[i] = (IRuntimeClasspathEntry) e;
- }
- }
- return runtimeEntries;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jdt.launching.IRuntimeClasspathEntry2#getRuntimeClasspathEntries(org.eclipse.debug.core.ILaunchConfiguration)
- */
- @Override
- public IRuntimeClasspathEntry[] getRuntimeClasspathEntries(ILaunchConfiguration configuration) throws CoreException {
- return new IRuntimeClasspathEntry[0];
- }
-
- /**
- * Returns the transitive closure of classpath entries for the
- * given project entry.
- *
- * @param projectEntry project classpath entry
- * @param expandedPath a list of entries already expanded, should be empty
- * to begin, and contains the result
- * @param expanding a list of projects that have been or are currently being
- * expanded (to detect cycles)
- * @exception CoreException if unable to expand the classpath
- */
- private void expandProject(IClasspathEntry projectEntry, List<Object> expandedPath) throws CoreException {
- IPath projectPath = projectEntry.getPath();
- IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(projectPath.lastSegment());
- if (res == null) {
- // add project entry and return
- expandedPath.add(projectEntry);
- return;
- }
- IJavaProject project = (IJavaProject)JavaCore.create(res);
- if (project == null || !project.getProject().isOpen() || !project.exists()) {
- // add project entry and return
- expandedPath.add(projectEntry);
- return;
- }
-
- expandedPath.add(projectEntry);
- IClasspathEntry[] buildPath1 = project.getResolvedClasspath(true);
- for (IClasspathEntry iClasspathEntry : buildPath1) {
- if (iClasspathEntry.getEntryKind() != IClasspathEntry.CPE_SOURCE) {
- IRuntimeClasspathEntry r = JavaRuntime.newRuntimeContainerClasspathEntry(iClasspathEntry, project);
- expandedPath.add(r);
- }
- }
- return;
- }
- /* (non-Javadoc)
- * @see org.eclipse.jdt.launching.IRuntimeClasspathEntry2#isComposite()
- */
- @Override
- public boolean isComposite() {
- return true;
- }
- /* (non-Javadoc)
- * @see org.eclipse.jdt.launching.IRuntimeClasspathEntry2#getName()
- */
- @Override
- public String getName() {
- if (isExportedEntriesOnly()) {
- return NLS.bind(LaunchingMessages.DefaultProjectClasspathEntry_2, new String[] {getJavaProject().getElementName()});
- }
- return NLS.bind(LaunchingMessages.DefaultProjectClasspathEntry_4, new String[] {getJavaProject().getElementName()});
- }
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof DefaultProjectDependencies) {
- DefaultProjectDependencies entry = (DefaultProjectDependencies) obj;
- return entry.getJavaProject().equals(getJavaProject()) &&
- entry.isExportedEntriesOnly() == isExportedEntriesOnly();
- }
- return false;
- }
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return getJavaProject().hashCode();
- }
-
- /**
- * Sets whether the runtime classpath computation should only
- * include exported entries in referenced projects.
- *
- * @param exportedOnly if the runtime classpath computation should only
- * include exported entries in referenced projects.
- * @since 3.2
- */
- public void setExportedEntriesOnly(boolean exportedOnly) {
- fExportedEntriesOnly = exportedOnly;
- }
-
- /**
- * Returns whether the classpath computation only includes exported
- * entries in referenced projects.
- *
- * @return if the classpath computation only includes exported
- * entries in referenced projects.
- * @since 3.2
- */
- public boolean isExportedEntriesOnly() {
- return fExportedEntriesOnly | Platform.getPreferencesService().getBoolean(
- LaunchingPlugin.ID_PLUGIN,
- JavaRuntime.PREF_ONLY_INCLUDE_EXPORTED_CLASSPATH_ENTRIES,
- false,
- null);
- }
-} \ No newline at end of file
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 1d71580ef..6577b27e2 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
@@ -62,11 +62,11 @@ 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.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.internal.launching.CompositeId;
import org.eclipse.jdt.internal.launching.DefaultEntryResolver;
import org.eclipse.jdt.internal.launching.DefaultProjectClasspathEntry;
-import org.eclipse.jdt.internal.launching.DefaultProjectDependencies;
import org.eclipse.jdt.internal.launching.EEVMInstall;
import org.eclipse.jdt.internal.launching.EEVMType;
import org.eclipse.jdt.internal.launching.JREContainerInitializer;
@@ -627,26 +627,29 @@ public final class JavaRuntime {
}
/**
- * Returns a new runtime classpath entry containing the default classpath for the specified Java project.
+ * Returns a new runtime classpath entry for the given project.
*
- * @param project
- * Java project
+ * @param project Java project
* @return runtime classpath entry
- * @since 3.9
+ * @since 2.0
*/
- public static IRuntimeClasspathEntry newDefaultProjectDependencies(IJavaProject project) {
- return new DefaultProjectDependencies(project);
+ public static IRuntimeClasspathEntry newProjectRuntimeClasspathEntry(IJavaProject project) {
+ return newRuntimeClasspathEntry(JavaCore.newProjectEntry(project.getProject().getFullPath()));
}
/**
* Returns a new runtime classpath entry for the given project.
*
- * @param project Java 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 2.0
+ * @since 3.9
*/
- public static IRuntimeClasspathEntry newProjectRuntimeClasspathEntry(IJavaProject project) {
- return newRuntimeClasspathEntry(JavaCore.newProjectEntry(project.getProject().getFullPath()));
+ public static IRuntimeClasspathEntry newProjectRuntimeClasspathEntry(IJavaProject project, int classpathProperty) {
+ return newRuntimeClasspathEntry(JavaCore.newProjectEntry(project.getProject().getFullPath()), classpathProperty);
}
@@ -662,6 +665,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.9
+ */
+ 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).
*
@@ -714,7 +732,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
@@ -811,6 +830,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.
*
@@ -869,7 +901,7 @@ public final class JavaRuntime {
* @since 3.9
*/
public static IRuntimeClasspathEntry[] computeUnresolvedRuntimeDependencies(IJavaProject project) throws CoreException {
- IClasspathEntry[] entries = project.getRawClasspath();
+ IClasspathEntry[] entries = project.getResolvedClasspath(true);
List<IRuntimeClasspathEntry> classpathEntries = new ArrayList<>(3);
for (int i = 0; i < entries.length; i++) {
IClasspathEntry entry = entries[i];
@@ -898,6 +930,16 @@ public final class JavaRuntime {
}
}
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)) {
+ 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());
@@ -905,11 +947,25 @@ public final class JavaRuntime {
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)) {
+ 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(newDefaultProjectDependencies(project));
+ classpathEntries.add(JavaRuntime.computeModularJREEntry(project));
return classpathEntries.toArray(new IRuntimeClasspathEntry[classpathEntries.size()]);
}
@@ -2208,6 +2264,9 @@ public final class JavaRuntime {
if (proj == null) {
containerPath = newDefaultJREContainerPath();
} else {
+ if (isModularConfiguration(configuration)) {
+ return computeModularJREEntry(proj);
+ }
return computeJREEntry(proj);
}
} else {
@@ -2221,6 +2280,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;
@@ -2276,58 +2338,6 @@ public final class JavaRuntime {
}
/**
- * Returns a runtime classpath entry identifying the JRE to use when launching the specified configuration or <code>null</code> if none is
- * specified. The entry returned represents a either a classpath variable or classpath container that resolves to a JRE.
- * <p>
- * The entry is resolved as follows:
- * <ol>
- * <li>If the <code>ATTR_JRE_CONTAINER_PATH</code> is present, it is used to create a classpath container referring to a JRE.</li>
- * <li>Next, if the <code>ATTR_VM_INSTALL_TYPE</code> and <code>ATTR_VM_INSTALL_NAME</code> attributes are present, they are used to create a
- * classpath container.</li>
- * <li>When none of the above attributes are specified, a default entry is created which refers to the JRE referenced by the build path of the
- * configuration's associated Java project. This could be a classpath variable or classpath container.</li>
- * <li>When there is no Java project associated with a configuration, the workspace default JRE is used to create a container path.</li>
- * </ol>
- * </p>
- *
- * @param configuration
- * the backing {@link ILaunchConfiguration}
- * @return classpath container path identifying a JRE or <code>null</code>
- * @exception org.eclipse.core.runtime.CoreException
- * if an exception occurs retrieving attributes from the specified launch configuration
- * @since 3.9
- */
- public static IRuntimeClasspathEntry computeModularJREEntry(ILaunchConfiguration configuration) throws CoreException {
- String jreAttr = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, (String) null);
- IPath containerPath = null;
- if (jreAttr == null) {
- @SuppressWarnings("deprecation")
- String type = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE, (String) null);
- if (type == null) {
- // default JRE for the launch configuration
- IJavaProject proj = getJavaProject(configuration);
- if (proj == null) {
- containerPath = newDefaultJREContainerPath();
- } else {
- return computeJREEntry(proj);
- }
- } else {
- @SuppressWarnings("deprecation")
- String name = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_NAME, (String) null);
- if (name != null) {
- containerPath = newDefaultJREContainerPath().append(type).append(name);
- }
- }
- } else {
- containerPath = Path.fromPortableString(jreAttr);
- }
- if (containerPath != null) {
- return newRuntimeContainerClasspathEntry(containerPath, IRuntimeClasspathEntry.MODULE_PATH);
- }
- return null;
- }
-
- /**
* Returns a runtime classpath 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.
*
@@ -2348,7 +2358,10 @@ public final class JavaRuntime {
resolver = getVariableResolver(entry.getPath().segment(0));
if (resolver != null) {
if (resolver.isVMInstallReference(entry)) {
- return newRuntimeClasspathEntry(entry);
+ if (isModule(entry)) {
+ return newRuntimeClasspathEntry(entry, IRuntimeClasspathEntry.MODULE_PATH);
+ }
+ return newRuntimeClasspathEntry(entry, IRuntimeClasspathEntry.CLASS_PATH);
}
}
break;
diff --git a/org.eclipse.jdt.launching/plugin.xml b/org.eclipse.jdt.launching/plugin.xml
index b7ca41a0e..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, 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
@@ -144,10 +144,6 @@
class="org.eclipse.jdt.internal.launching.DefaultProjectClasspathEntry">
</runtimeClasspathEntry>
<runtimeClasspathEntry
- id="org.eclipse.jdt.launching.classpathentry.defaultDependencies"
- class="org.eclipse.jdt.internal.launching.DefaultProjectDependencies">
- </runtimeClasspathEntry>
- <runtimeClasspathEntry
id="org.eclipse.jdt.launching.classpathentry.variableClasspathEntry"
class="org.eclipse.jdt.internal.launching.VariableClasspathEntry">
</runtimeClasspathEntry>

Back to the top