From 66c6f6adffad35e7d6f94c3e50e1b5e4a00bddaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=8A?= =?UTF-8?q?=D1=80=20=D0=9A=D1=83=D1=80=D1=82=D0=B0=D0=BA=D0=BE=D0=B2?= Date: Wed, 20 Sep 2023 15:31:14 +0300 Subject: [PATCH] Switch default jre version in JREAction to 17 Eclipse doesn't support running on older version for quite some time. --- .../p2/publisher/actions/JREAction.java | 40 +++++++++++++++---- .../publisher/actions/JREActionTest.java | 3 +- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java index 097ef8edf5..7926c36e21 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java @@ -16,33 +16,57 @@ ******************************************************************************/ package org.eclipse.equinox.p2.publisher.actions; -import java.io.*; +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileFilter; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleDescriptor.Exports; import java.net.URL; import java.nio.file.Files; -import java.util.*; -import org.eclipse.core.runtime.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.Status; import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils; import org.eclipse.equinox.internal.p2.metadata.ArtifactKey; import org.eclipse.equinox.internal.p2.publisher.Activator; import org.eclipse.equinox.internal.p2.publisher.Messages; -import org.eclipse.equinox.p2.metadata.*; +import org.eclipse.equinox.p2.metadata.IArtifactKey; +import org.eclipse.equinox.p2.metadata.IInstallableUnit; +import org.eclipse.equinox.p2.metadata.IProvidedCapability; +import org.eclipse.equinox.p2.metadata.MetadataFactory; import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription; import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitFragmentDescription; import org.eclipse.equinox.p2.metadata.Version; import org.eclipse.equinox.p2.metadata.VersionRange; -import org.eclipse.equinox.p2.publisher.*; +import org.eclipse.equinox.p2.publisher.AbstractPublisherAction; +import org.eclipse.equinox.p2.publisher.IPublisherInfo; +import org.eclipse.equinox.p2.publisher.IPublisherResult; import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; import org.eclipse.equinox.spi.p2.publisher.PublisherHelper; import org.eclipse.osgi.util.ManifestElement; import org.eclipse.osgi.util.NLS; -import org.osgi.framework.*; +import org.osgi.framework.BundleException; +import org.osgi.framework.Constants; +import org.osgi.framework.FrameworkUtil; public class JREAction extends AbstractPublisherAction { private static final String DEFAULT_JRE_NAME = "a.jre"; //$NON-NLS-1$ - private static final Version DEFAULT_JRE_VERSION = Version.parseVersion("11.0"); //$NON-NLS-1$ - private static final String DEFAULT_PROFILE = "JavaSE-11"; //$NON-NLS-1$ + private static final Version DEFAULT_JRE_VERSION = Version.parseVersion("17.0"); //$NON-NLS-1$ + private static final String DEFAULT_PROFILE = "JavaSE-17"; //$NON-NLS-1$ private static final String PROFILE_LOCATION = "jre.action.profile.location"; //$NON-NLS-1$ private static final String PROFILE_NAME = "osgi.java.profile.name"; //$NON-NLS-1$ private static final String PROFILE_TARGET_VERSION = "org.eclipse.jdt.core.compiler.codegen.targetPlatform"; //$NON-NLS-1$ diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java index 5a50a1c029..8a884af21a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java @@ -36,6 +36,7 @@ import java.util.HashMap; import java.util.Map; import java.util.zip.ZipInputStream; + import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.equinox.internal.p2.core.helpers.FileUtils; @@ -147,7 +148,7 @@ public void testDefaultJavaProfile() throws Exception { performAction(new JREAction((String) null)); // these assertions need to be changed each time the default java profile, hardcoded in o.e.e.p2.publisher.actions.JREAction, is changed; - verifyMetadataIU("a.jre.javase", 226, 23, Version.parseVersion("11.0.0")); + verifyMetadataIU("a.jre.javase", 226, 23, Version.parseVersion("17.0.0")); // verifyConfigIU(DEFAULT_JRE_NAME, DEFAULT_JRE_VERSION); // TODO config IU is not needed!? }