Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust to JavaCore.defaultRootModules deprecation #1958

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019 GK Software SE, and others.
* Copyright (c) 2019, 2025 GK Software SE, and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -13,6 +13,7 @@
*******************************************************************************/
package org.eclipse.jdt.internal.ui.wizards.buildpaths;

import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
Expand All @@ -26,8 +27,6 @@
import java.util.function.Predicate;
import java.util.stream.Collectors;

import java.text.MessageFormat;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.events.SelectionListener;
Expand Down Expand Up @@ -347,7 +346,14 @@ protected void scanModules() {
}
try {
if (fCurrJProject.getModuleDescription() == null) { // cache default roots when compiling the unnamed module:
fAllDefaultSystemModules= closure(JavaCore.defaultRootModules(Arrays.asList(fAllSystemRoots)));
String release = fCurrJProject.getOption(JavaCore.COMPILER_RELEASE, true);
if (release == null) {
release = fCurrJProject.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, true);
}
if (release == null) {
release = JavaCore.latestSupportedJavaVersion();
}
fAllDefaultSystemModules= closure(JavaCore.defaultRootModules(Arrays.asList(fAllSystemRoots), release));
}
} catch (JavaModelException e) {
JavaPlugin.log(e);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2020 GK Software SE, and others.
* Copyright (c) 2017, 2025 GK Software SE, and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -799,11 +799,18 @@ private List<String> defaultIncludedModuleNamesForUnnamedModule() {
if (fJavaElements != null) {
List<IPackageFragmentRoot> roots= new ArrayList<>();
for (IJavaElement element : fJavaElements) {
if (element instanceof IPackageFragmentRoot) {
roots.add((IPackageFragmentRoot) element);
if (element instanceof IPackageFragmentRoot el) {
roots.add(el);
}
}
return JavaCore.defaultRootModules(roots);
String release = fJavaElements[0].getJavaProject().getOption(JavaCore.COMPILER_RELEASE, true);
if (release == null) {
release = fJavaElements[0].getJavaProject().getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, true);
}
if (release == null) {
release = JavaCore.latestSupportedJavaVersion();
}
return JavaCore.defaultRootModules(roots, release);
}
return Collections.emptyList();
}
Expand Down
Loading