From 7162365d223fdce3bd180b2611741f32a4013191 Mon Sep 17 00:00:00 2001 From: Christian Wimmer Date: Mon, 18 Oct 2021 11:56:28 -0700 Subject: [PATCH] Remove support for outdated JDK versions between 11 and 17 --- substratevm/CHANGELOG.md | 4 +- substratevm/mx.substratevm/suite.py | 58 ++----------------- .../svm/core/graal/llvm/LLVMGenerator.java | 31 +++++----- .../Target_java_lang_Module_JDK11OrLater.java | 14 ++--- .../core/jdk15/HiddenClassSupportImpl.java | 52 ----------------- .../JDKClassLoadingDeadlockWorkaround.java | 51 ---------------- .../jdk17/RecordSupportJDK17OrLater.java} | 10 ++-- ...t_java_lang_ClassLoader_JDK17OrLater.java} | 20 +++---- ...Target_java_lang_Module_JDK17OrLater.java} | 8 +-- ...va_nio_DirectByteBuffer_JDK17OrLater.java} | 26 ++++----- ...ernal_loader_BootLoader_JDK17OrLater.java} | 8 +-- .../src/com/oracle/svm/core/Containers.java | 2 +- .../com/oracle/svm/core/SubstrateOptions.java | 2 +- .../com/oracle/svm/core/SubstrateUtil.java | 4 +- ...Target_java_lang_ref_PhantomReference.java | 4 +- .../heap/Target_java_lang_ref_Reference.java | 14 ++--- .../heap/Target_jdk_internal_ref_Cleaner.java | 14 ++--- .../com/oracle/svm/core/hub/DynamicHub.java | 33 +++++------ .../svm/core/jdk/HiddenClassSupport.java | 52 ----------------- .../com/oracle/svm/core/jdk/JDK11To14.java | 36 ------------ .../com/oracle/svm/core/jdk/JDK11To16.java | 36 ------------ .../svm/core/jdk/JDK11_0_10OrEarlier.java | 38 ------------ .../svm/core/jdk/JDK11_0_11OrLater.java | 38 ------------ .../oracle/svm/core/jdk/JDK14OrEarlier.java | 36 ------------ .../com/oracle/svm/core/jdk/JDK14OrLater.java | 36 ------------ .../oracle/svm/core/jdk/JDK15OrEarlier.java | 36 ------------ .../com/oracle/svm/core/jdk/JDK15OrLater.java | 36 ------------ .../oracle/svm/core/jdk/JDK16OrEarlier.java | 36 ------------ .../com/oracle/svm/core/jdk/JDK16OrLater.java | 36 ------------ .../svm/core/jdk/JavaLangSubstitutions.java | 2 +- .../Package_jdk_internal_loader_helper.java | 2 +- .../oracle/svm/core/jdk/RecomputedFields.java | 6 +- .../oracle/svm/core/jdk/RecordSupport.java | 10 ++-- .../svm/core/jdk/SecuritySubstitutions.java | 8 +-- .../svm/core/jdk/SunMiscSubstitutions.java | 8 +-- .../svm/core/jdk/SunNioSubstitutions.java | 4 +- .../jdk/Target_java_lang_ClassLoader.java | 12 ++-- .../jdk/Target_javax_net_ssl_SSLContext.java | 43 -------------- ...rget_jdk_internal_util_StaticProperty.java | 8 +-- ...jdk_nashorn_api_scripting_ClassFilter.java | 2 +- ..._scripting_NashornScriptEngineFactory.java | 2 +- .../core/jdk/ThreadLocalRandomAccessors.java | 4 +- .../oracle/svm/core/jdk/VarHandleFeature.java | 4 +- ...rviceProviderPool_OptimizedLocaleMode.java | 4 +- .../SubstrateOperatingSystemMXBean.java | 6 +- .../SubstrateOperatingSystemMXBeanBase.java | 3 +- .../oracle/svm/core/thread/JavaThreads.java | 6 +- .../core/thread/Target_java_lang_Thread.java | 18 +++--- .../com/oracle/svm/driver/NativeImage.java | 2 +- .../JNIRegistrationSupport_JDK17OrLater.java} | 13 ++++- .../hosted/NativeImageGeneratorRunner.java | 4 +- .../src/com/oracle/svm/hosted/SVMHost.java | 4 +- .../svm/hosted/SecurityServicesFeature.java | 12 ++-- .../analysis/DynamicHubInitializer.java | 10 ++-- .../svm/hosted/image/sources/SourceCache.java | 6 +- .../svm/hosted/jdk/JDKRegistrations.java | 7 +-- .../hosted/jdk/JNIRegistrationJavaNet.java | 14 +++-- .../hosted/jdk/JNIRegistrationJavaNio.java | 15 +++-- .../hosted/jdk/JNIRegistrationSupport.java | 4 +- .../SubstrateGraphBuilderPlugins.java | 2 +- .../UnsafeAutomaticSubstitutionProcessor.java | 6 +- .../src/com/oracle/svm/jfr/JfrEnabled.java | 2 +- .../com/oracle/svm/jfr/JfrTypeRepository.java | 7 ++- .../svm/jfr/Target_jdk_jfr_internal_JVM.java | 29 +++++----- .../svm/jfr/logging/JfrLogConfiguration.java | 12 +--- .../methodhandles/MethodHandleFeature.java | 2 +- ..._java_lang_invoke_MethodHandleNatives.java | 19 +++--- ...java_lang_invoke_MethodHandles_Lookup.java | 20 +++---- ...et_java_lang_reflect_AccessibleObject.java | 4 +- .../src/com/oracle/svm/test/GitHub1398.java | 2 +- 70 files changed, 246 insertions(+), 873 deletions(-) delete mode 100644 substratevm/src/com.oracle.svm.core.jdk15/src/com/oracle/svm/core/jdk15/HiddenClassSupportImpl.java delete mode 100644 substratevm/src/com.oracle.svm.core.jdk16/src/com/oracle/svm/core/jdk16/JDKClassLoadingDeadlockWorkaround.java rename substratevm/src/{com.oracle.svm.core.jdk16/src/com/oracle/svm/core/jdk16/RecordSupportJDK16OrLater.java => com.oracle.svm.core.jdk17/src/com/oracle/svm/core/jdk17/RecordSupportJDK17OrLater.java} (93%) rename substratevm/src/{com.oracle.svm.core.jdk15/src/com/oracle/svm/core/jdk15/Target_java_lang_ClassLoader_JDK15OrLater.java => com.oracle.svm.core.jdk17/src/com/oracle/svm/core/jdk17/Target_java_lang_ClassLoader_JDK17OrLater.java} (87%) rename substratevm/src/{com.oracle.svm.core.jdk15/src/com/oracle/svm/core/jdk15/Target_java_lang_Module_JDK15OrLater.java => com.oracle.svm.core.jdk17/src/com/oracle/svm/core/jdk17/Target_java_lang_Module_JDK17OrLater.java} (90%) rename substratevm/src/{com.oracle.svm.core.jdk14/src/com/oracle/svm/core/jdk14/Target_java_nio_DirectByteBuffer_JDK14OrLater.java => com.oracle.svm.core.jdk17/src/com/oracle/svm/core/jdk17/Target_java_nio_DirectByteBuffer_JDK17OrLater.java} (76%) rename substratevm/src/{com.oracle.svm.core.jdk15/src/com/oracle/svm/core/jdk15/Target_jdk_internal_loader_BootLoader_JDK15OrLater.java => com.oracle.svm.core.jdk17/src/com/oracle/svm/core/jdk17/Target_jdk_internal_loader_BootLoader_JDK17OrLater.java} (89%) delete mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/HiddenClassSupport.java delete mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK11To14.java delete mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK11To16.java delete mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK11_0_10OrEarlier.java delete mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK11_0_11OrLater.java delete mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK14OrEarlier.java delete mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK14OrLater.java delete mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK15OrEarlier.java delete mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK15OrLater.java delete mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK16OrEarlier.java delete mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK16OrLater.java delete mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_javax_net_ssl_SSLContext.java rename substratevm/src/{com.oracle.svm.hosted.jdk14/src/com/oracle/svm/hosted/jdk/JNIRegistrationSupport_JDK14OrLater.java => com.oracle.svm.hosted.jdk17/src/com/oracle/svm/hosted/jdk17/JNIRegistrationSupport_JDK17OrLater.java} (82%) diff --git a/substratevm/CHANGELOG.md b/substratevm/CHANGELOG.md index 5823faf69b22..b01373c7212c 100644 --- a/substratevm/CHANGELOG.md +++ b/substratevm/CHANGELOG.md @@ -1,10 +1,10 @@ # Native Image Changelog -This changelog summarizes major changes to Native Image, developed under the codename **Substrate VM**. +This changelog summarizes major changes to GraalVM Native Image. ## Version 22.0.0 * (GR-33930) Decouple HostedOptionParser setup from classpath/modulepath scanning (use ServiceLoader for collecting options). * (GR-33504) Implement --add-reads for native-image and fix --add-opens error handling. * (GR-33983) Remove obsolete com.oracle.svm.thirdparty.jline.JLineFeature from substratevm:LIBRARY_SUPPORT. +* (GR-34577) Remove support for outdated JDK versions between 11 and 17. Since JDK versions 12, 13, 14, 15, 16 are no longer supported, there is no need to explicitly check for and allow these versions. -## Version 21.3.0
 diff --git a/substratevm/mx.substratevm/suite.py b/substratevm/mx.substratevm/suite.py index c1b7e79a15bf..add17042b116 100644 --- a/substratevm/mx.substratevm/suite.py +++ b/substratevm/mx.substratevm/suite.py @@ -230,58 +230,13 @@ "workingSets": "SVM", }, - "com.oracle.svm.core.jdk14": { - "subDir": "src", - "sourceDirs": ["src"], - "dependencies": ["com.oracle.svm.core"], - "requiresConcealed" : { - "java.base" : [ - "jdk.internal.access.foreign", - ], - }, - "javaCompliance": "14+", - "checkstyle": "com.oracle.svm.core", - "workingSets": "SVM", - }, - - "com.oracle.svm.core.jdk15": { - "subDir": "src", - "sourceDirs": ["src"], - "dependencies": ["com.oracle.svm.core.jdk11"], - "requiresConcealed" : { - "java.base" : [ - "jdk.internal.loader", - "jdk.internal.misc", - "sun.invoke.util", - ], - }, - "javaCompliance": "15+", - "checkstyle": "com.oracle.svm.core", - "workingSets": "SVM", - }, - - "com.oracle.svm.core.jdk16": { - "subDir": "src", - "sourceDirs": ["src"], - "dependencies": ["com.oracle.svm.core"], - "requiresConcealed" : { - "java.base" : [ - "jdk.internal.loader", - "jdk.internal.misc", - "sun.invoke.util", - ], - }, - "javaCompliance": "16+", - "checkstyle": "com.oracle.svm.core", - "workingSets": "SVM", - }, - "com.oracle.svm.core.jdk17": { "subDir": "src", "sourceDirs": ["src"], - "dependencies": ["com.oracle.svm.core"], + "dependencies": ["com.oracle.svm.core.jdk11"], "requiresConcealed" : { "java.base" : [ + "jdk.internal.access.foreign", "jdk.internal.loader", "jdk.internal.misc", "jdk.internal.platform", @@ -455,7 +410,7 @@ ], "workingSets": "SVM", }, - "com.oracle.svm.hosted.jdk14": { + "com.oracle.svm.hosted.jdk17": { "subDir": "src", "sourceDirs": ["src"], "dependencies": [ @@ -467,7 +422,7 @@ "jdk.internal.vm.ci" : ["jdk.vm.ci.meta"], }, - "javaCompliance": "14+", + "javaCompliance": "17+", "annotationProcessors": [ "compiler:GRAAL_PROCESSOR", ], @@ -1079,13 +1034,10 @@ "com.oracle.svm.hosted", "com.oracle.svm.hosted.jdk8", "com.oracle.svm.hosted.jdk11", - "com.oracle.svm.hosted.jdk14", + "com.oracle.svm.hosted.jdk17", "com.oracle.svm.core", "com.oracle.svm.core.jdk8", "com.oracle.svm.core.jdk11", - "com.oracle.svm.core.jdk14", - "com.oracle.svm.core.jdk15", - "com.oracle.svm.core.jdk16", "com.oracle.svm.core.jdk17", "com.oracle.svm.core.graal.amd64", "com.oracle.svm.core.graal.aarch64", diff --git a/substratevm/src/com.oracle.svm.core.graal.llvm/src/com/oracle/svm/core/graal/llvm/LLVMGenerator.java b/substratevm/src/com.oracle.svm.core.graal.llvm/src/com/oracle/svm/core/graal/llvm/LLVMGenerator.java index fc117c5a3ae1..de477e6a83f4 100644 --- a/substratevm/src/com.oracle.svm.core.graal.llvm/src/com/oracle/svm/core/graal/llvm/LLVMGenerator.java +++ b/substratevm/src/com.oracle.svm.core.graal.llvm/src/com/oracle/svm/core/graal/llvm/LLVMGenerator.java @@ -40,9 +40,6 @@ import static org.graalvm.compiler.debug.GraalError.shouldNotReachHere; import static org.graalvm.compiler.debug.GraalError.unimplemented; -// Checkstyle: allow reflection -import java.lang.reflect.Field; -// Checkstyle: disallow reflection import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -131,6 +128,7 @@ import com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMBasicBlockRef; import com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMTypeRef; import com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMValueRef; +import com.oracle.svm.util.ReflectionUtil; import jdk.vm.ci.code.CallingConvention; import jdk.vm.ci.code.CodeCacheProvider; @@ -2015,25 +2013,22 @@ public void emitCacheWritebackSync(boolean isPreSync) { /** * Gets the value of {@code jdk.internal.misc.UnsafeConstants.DATA_CACHE_LINE_FLUSH_SIZE} which - * was introduced in JDK 14 by JEP 352. + * was introduced after JDK 11 by JEP 352. * - * This method uses reflection to be compatible with JDKs prior to 14. + * This method uses reflection to be compatible with JDK 11 and earlier. */ private static int initDataCacheLineFlushSize() { - if (JavaVersionUtil.JAVA_SPEC >= 14) { - Class c; - try { - // Checkstyle: stop - c = Class.forName("jdk.internal.misc.UnsafeConstants"); - // Checkstyle: resume - Field f = c.getDeclaredField("DATA_CACHE_LINE_FLUSH_SIZE"); - f.setAccessible(true); - return (int) f.get(null); - } catch (Exception e) { - throw new GraalError(e, "Expected UnsafeConstants.DATA_CACHE_LINE_FLUSH_SIZE to exist and be readable"); - } + if (JavaVersionUtil.JAVA_SPEC <= 11) { + return 0; + } + try { + // Checkstyle: stop + Class c = Class.forName("jdk.internal.misc.UnsafeConstants"); + // Checkstyle: resume + return ReflectionUtil.readStaticField(c, "DATA_CACHE_LINE_FLUSH_SIZE"); + } catch (ClassNotFoundException e) { + throw new GraalError(e, "Expected UnsafeConstants.DATA_CACHE_LINE_FLUSH_SIZE to exist and be readable"); } - return 0; } private static int getDataCacheLineFlushSize() { diff --git a/substratevm/src/com.oracle.svm.core.jdk11/src/com/oracle/svm/core/jdk11/Target_java_lang_Module_JDK11OrLater.java b/substratevm/src/com.oracle.svm.core.jdk11/src/com/oracle/svm/core/jdk11/Target_java_lang_Module_JDK11OrLater.java index 53b5b2217105..a77695ddac3f 100644 --- a/substratevm/src/com.oracle.svm.core.jdk11/src/com/oracle/svm/core/jdk11/Target_java_lang_Module_JDK11OrLater.java +++ b/substratevm/src/com.oracle.svm.core.jdk11/src/com/oracle/svm/core/jdk11/Target_java_lang_Module_JDK11OrLater.java @@ -24,21 +24,21 @@ */ package com.oracle.svm.core.jdk11; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.Arrays; +import java.util.Objects; + import com.oracle.svm.core.annotate.Alias; import com.oracle.svm.core.annotate.RecomputeFieldValue; import com.oracle.svm.core.annotate.Substitute; import com.oracle.svm.core.annotate.TargetClass; import com.oracle.svm.core.annotate.TargetElement; +import com.oracle.svm.core.jdk.JDK11OrEarlier; import com.oracle.svm.core.jdk.JDK11OrLater; -import com.oracle.svm.core.jdk.JDK11To14; import com.oracle.svm.core.jdk.Resources; import com.oracle.svm.core.jdk.resources.ResourceStorageEntry; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.Arrays; -import java.util.Objects; - @SuppressWarnings("unused") @TargetClass(value = java.lang.Module.class, onlyWith = JDK11OrLater.class) public final class Target_java_lang_Module_JDK11OrLater { @@ -58,7 +58,7 @@ public InputStream getResourceAsStream(String name) { } @Substitute // - @TargetElement(onlyWith = JDK11To14.class) + @TargetElement(onlyWith = {JDK11OrLater.class, JDK11OrEarlier.class}) private static void defineModule0(Module module, boolean isOpen, String version, String location, String[] pns) { ModuleUtil.defineModule(module, isOpen, Arrays.asList(pns)); } diff --git a/substratevm/src/com.oracle.svm.core.jdk15/src/com/oracle/svm/core/jdk15/HiddenClassSupportImpl.java b/substratevm/src/com.oracle.svm.core.jdk15/src/com/oracle/svm/core/jdk15/HiddenClassSupportImpl.java deleted file mode 100644 index a8981b0cfd79..000000000000 --- a/substratevm/src/com.oracle.svm.core.jdk15/src/com/oracle/svm/core/jdk15/HiddenClassSupportImpl.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2021, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.svm.core.jdk15; - -import org.graalvm.compiler.serviceprovider.JavaVersionUtil; -import org.graalvm.nativeimage.ImageSingletons; -import org.graalvm.nativeimage.hosted.Feature; - -import com.oracle.svm.core.annotate.AutomaticFeature; -import com.oracle.svm.core.jdk.HiddenClassSupport; - -final class HiddenClassSupportImpl extends HiddenClassSupport { - @Override - public boolean isHidden(Class clazz) { - return clazz.isHidden(); - } -} - -@AutomaticFeature -final class HiddenClassFeature implements Feature { - @Override - public boolean isInConfiguration(IsInConfigurationAccess access) { - return JavaVersionUtil.JAVA_SPEC >= 15; - } - - @Override - public void afterRegistration(AfterRegistrationAccess access) { - ImageSingletons.add(HiddenClassSupport.class, new HiddenClassSupportImpl()); - } -} diff --git a/substratevm/src/com.oracle.svm.core.jdk16/src/com/oracle/svm/core/jdk16/JDKClassLoadingDeadlockWorkaround.java b/substratevm/src/com.oracle.svm.core.jdk16/src/com/oracle/svm/core/jdk16/JDKClassLoadingDeadlockWorkaround.java deleted file mode 100644 index 70fdf9871f68..000000000000 --- a/substratevm/src/com.oracle.svm.core.jdk16/src/com/oracle/svm/core/jdk16/JDKClassLoadingDeadlockWorkaround.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2021, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.svm.core.jdk16; - -import java.lang.constant.ConstantDescs; - -import org.graalvm.compiler.serviceprovider.JavaVersionUtil; -import org.graalvm.nativeimage.hosted.Feature; - -import com.oracle.svm.core.annotate.AutomaticFeature; - -/** - * Workaround for JDK bug JDK-8263108. Class initialization of classes in java.lang.constant can - * deadlock during the multi-threaded static analysis. Forcing class initialization early before the - * analysis resolves the problem. - */ -@AutomaticFeature -final class JDKClassLoadingDeadlockWorkaround implements Feature { - @Override - public boolean isInConfiguration(IsInConfigurationAccess access) { - return JavaVersionUtil.JAVA_SPEC >= 16; - } - - @SuppressWarnings("unused") - @Override - public void afterRegistration(AfterRegistrationAccess access) { - Object unused = ConstantDescs.CD_Object; - } -} diff --git a/substratevm/src/com.oracle.svm.core.jdk16/src/com/oracle/svm/core/jdk16/RecordSupportJDK16OrLater.java b/substratevm/src/com.oracle.svm.core.jdk17/src/com/oracle/svm/core/jdk17/RecordSupportJDK17OrLater.java similarity index 93% rename from substratevm/src/com.oracle.svm.core.jdk16/src/com/oracle/svm/core/jdk16/RecordSupportJDK16OrLater.java rename to substratevm/src/com.oracle.svm.core.jdk17/src/com/oracle/svm/core/jdk17/RecordSupportJDK17OrLater.java index 70e543c7697a..4a38a60ba77e 100644 --- a/substratevm/src/com.oracle.svm.core.jdk16/src/com/oracle/svm/core/jdk16/RecordSupportJDK16OrLater.java +++ b/substratevm/src/com.oracle.svm.core.jdk17/src/com/oracle/svm/core/jdk17/RecordSupportJDK17OrLater.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package com.oracle.svm.core.jdk16; +package com.oracle.svm.core.jdk17; // Checkstyle: allow reflection @@ -39,7 +39,7 @@ import com.oracle.svm.core.jdk.RecordSupport; import com.oracle.svm.core.util.VMError; -final class RecordSupportJDK16OrLater extends RecordSupport { +final class RecordSupportJDK17OrLater extends RecordSupport { @Override public boolean isRecord(Class clazz) { return clazz.isRecord(); @@ -73,14 +73,14 @@ public Constructor getCanonicalRecordConstructor(Class clazz) { } @AutomaticFeature -final class RecordFeatureJDK16OrLater implements Feature { +final class RecordFeatureJDK17OrLater implements Feature { @Override public boolean isInConfiguration(IsInConfigurationAccess access) { - return JavaVersionUtil.JAVA_SPEC >= 16; + return JavaVersionUtil.JAVA_SPEC >= 17; } @Override public void afterRegistration(AfterRegistrationAccess access) { - ImageSingletons.add(RecordSupport.class, new RecordSupportJDK16OrLater()); + ImageSingletons.add(RecordSupport.class, new RecordSupportJDK17OrLater()); } } diff --git a/substratevm/src/com.oracle.svm.core.jdk15/src/com/oracle/svm/core/jdk15/Target_java_lang_ClassLoader_JDK15OrLater.java b/substratevm/src/com.oracle.svm.core.jdk17/src/com/oracle/svm/core/jdk17/Target_java_lang_ClassLoader_JDK17OrLater.java similarity index 87% rename from substratevm/src/com.oracle.svm.core.jdk15/src/com/oracle/svm/core/jdk15/Target_java_lang_ClassLoader_JDK15OrLater.java rename to substratevm/src/com.oracle.svm.core.jdk17/src/com/oracle/svm/core/jdk17/Target_java_lang_ClassLoader_JDK17OrLater.java index d3cf2247687a..414a31e47c77 100644 --- a/substratevm/src/com.oracle.svm.core.jdk15/src/com/oracle/svm/core/jdk15/Target_java_lang_ClassLoader_JDK15OrLater.java +++ b/substratevm/src/com.oracle.svm.core.jdk17/src/com/oracle/svm/core/jdk17/Target_java_lang_ClassLoader_JDK17OrLater.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package com.oracle.svm.core.jdk15; +package com.oracle.svm.core.jdk17; import java.io.File; import java.util.Deque; @@ -32,15 +32,15 @@ import com.oracle.svm.core.annotate.Delete; import com.oracle.svm.core.annotate.Substitute; import com.oracle.svm.core.annotate.TargetClass; -import com.oracle.svm.core.jdk.JDK15OrLater; +import com.oracle.svm.core.jdk.JDK17OrLater; import com.oracle.svm.core.jdk.NativeLibrarySupport; import jdk.internal.loader.NativeLibraries; import jdk.internal.loader.NativeLibrary; -@TargetClass(value = ClassLoader.class, onlyWith = JDK15OrLater.class) +@TargetClass(value = ClassLoader.class, onlyWith = JDK17OrLater.class) @SuppressWarnings({"static-method", "unused"}) -final class Target_java_lang_ClassLoader_JDK15OrLater { +final class Target_java_lang_ClassLoader_JDK17OrLater { @Substitute static NativeLibrary loadLibrary(Class fromClass, String name) { @@ -57,8 +57,8 @@ static NativeLibrary loadLibrary(Class fromClass, File file) { } } -@TargetClass(value = jdk.internal.loader.NativeLibraries.class, onlyWith = JDK15OrLater.class) -final class Target_jdk_internal_loader_NativeLibraries_JDK15OrLater { +@TargetClass(value = jdk.internal.loader.NativeLibraries.class, onlyWith = JDK17OrLater.class) +final class Target_jdk_internal_loader_NativeLibraries_JDK17OrLater { /** * The NativeLibraries is only used by the `loadLibrary` methods that are substituted, so we do @@ -88,7 +88,7 @@ public static NativeLibraries jniNativeLibraries(ClassLoader loader) { */ @Delete - private static native boolean load(Target_jdk_internal_loader_NativeLibraries_NativeLibraryImpl_JDK15OrLater impl, String name, boolean isBuiltin, boolean isJNI); + private static native boolean load(Target_jdk_internal_loader_NativeLibraries_NativeLibraryImpl_JDK17OrLater impl, String name, boolean isBuiltin, boolean isJNI); @Delete private static native void unload(String name, boolean isBuiltin, boolean isJNI, long handle); @@ -97,9 +97,9 @@ public static NativeLibraries jniNativeLibraries(ClassLoader loader) { private static native String findBuiltinLib(String name); @Delete - private static native long findEntry0(Target_jdk_internal_loader_NativeLibraries_NativeLibraryImpl_JDK15OrLater lib, String name); + private static native long findEntry0(Target_jdk_internal_loader_NativeLibraries_NativeLibraryImpl_JDK17OrLater lib, String name); } -@TargetClass(value = jdk.internal.loader.NativeLibraries.class, innerClass = "NativeLibraryImpl", onlyWith = JDK15OrLater.class) -final class Target_jdk_internal_loader_NativeLibraries_NativeLibraryImpl_JDK15OrLater { +@TargetClass(value = jdk.internal.loader.NativeLibraries.class, innerClass = "NativeLibraryImpl", onlyWith = JDK17OrLater.class) +final class Target_jdk_internal_loader_NativeLibraries_NativeLibraryImpl_JDK17OrLater { } diff --git a/substratevm/src/com.oracle.svm.core.jdk15/src/com/oracle/svm/core/jdk15/Target_java_lang_Module_JDK15OrLater.java b/substratevm/src/com.oracle.svm.core.jdk17/src/com/oracle/svm/core/jdk17/Target_java_lang_Module_JDK17OrLater.java similarity index 90% rename from substratevm/src/com.oracle.svm.core.jdk15/src/com/oracle/svm/core/jdk15/Target_java_lang_Module_JDK15OrLater.java rename to substratevm/src/com.oracle.svm.core.jdk17/src/com/oracle/svm/core/jdk17/Target_java_lang_Module_JDK17OrLater.java index f4ca16397f9e..787a9785d78a 100644 --- a/substratevm/src/com.oracle.svm.core.jdk15/src/com/oracle/svm/core/jdk15/Target_java_lang_Module_JDK15OrLater.java +++ b/substratevm/src/com.oracle.svm.core.jdk17/src/com/oracle/svm/core/jdk17/Target_java_lang_Module_JDK17OrLater.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package com.oracle.svm.core.jdk15; +package com.oracle.svm.core.jdk17; import java.util.Arrays; import java.util.List; @@ -31,12 +31,12 @@ import com.oracle.svm.core.annotate.Substitute; import com.oracle.svm.core.annotate.TargetClass; -import com.oracle.svm.core.jdk.JDK15OrLater; +import com.oracle.svm.core.jdk.JDK17OrLater; import com.oracle.svm.core.jdk11.ModuleUtil; @SuppressWarnings("unused") -@TargetClass(value = Module.class, onlyWith = JDK15OrLater.class) -public final class Target_java_lang_Module_JDK15OrLater { +@TargetClass(value = Module.class, onlyWith = JDK17OrLater.class) +public final class Target_java_lang_Module_JDK17OrLater { // Checkstyle: allow synchronization @Substitute diff --git a/substratevm/src/com.oracle.svm.core.jdk14/src/com/oracle/svm/core/jdk14/Target_java_nio_DirectByteBuffer_JDK14OrLater.java b/substratevm/src/com.oracle.svm.core.jdk17/src/com/oracle/svm/core/jdk17/Target_java_nio_DirectByteBuffer_JDK17OrLater.java similarity index 76% rename from substratevm/src/com.oracle.svm.core.jdk14/src/com/oracle/svm/core/jdk14/Target_java_nio_DirectByteBuffer_JDK14OrLater.java rename to substratevm/src/com.oracle.svm.core.jdk17/src/com/oracle/svm/core/jdk17/Target_java_nio_DirectByteBuffer_JDK17OrLater.java index 9fc54b52b726..122b63bccbed 100644 --- a/substratevm/src/com.oracle.svm.core.jdk14/src/com/oracle/svm/core/jdk14/Target_java_nio_DirectByteBuffer_JDK14OrLater.java +++ b/substratevm/src/com.oracle.svm.core.jdk17/src/com/oracle/svm/core/jdk17/Target_java_nio_DirectByteBuffer_JDK17OrLater.java @@ -22,48 +22,48 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package com.oracle.svm.core.jdk14; +package com.oracle.svm.core.jdk17; import java.io.FileDescriptor; import com.oracle.svm.core.annotate.Alias; import com.oracle.svm.core.annotate.Substitute; import com.oracle.svm.core.annotate.TargetClass; -import com.oracle.svm.core.jdk.JDK14OrLater; +import com.oracle.svm.core.jdk.JDK17OrLater; import jdk.internal.access.foreign.MemorySegmentProxy; -@TargetClass(className = "java.nio.DirectByteBuffer", onlyWith = JDK14OrLater.class) +@TargetClass(className = "java.nio.DirectByteBuffer", onlyWith = JDK17OrLater.class) @SuppressWarnings("unused") -final class Target_java_nio_DirectByteBuffer_JDK14OrLater { +final class Target_java_nio_DirectByteBuffer_JDK17OrLater { @Alias - protected Target_java_nio_DirectByteBuffer_JDK14OrLater(int cap, long addr, FileDescriptor fd, Runnable unmapper, boolean isSync, MemorySegmentProxy segment) { + protected Target_java_nio_DirectByteBuffer_JDK17OrLater(int cap, long addr, FileDescriptor fd, Runnable unmapper, boolean isSync, MemorySegmentProxy segment) { } } -@TargetClass(className = "java.nio.DirectByteBufferR", onlyWith = JDK14OrLater.class) +@TargetClass(className = "java.nio.DirectByteBufferR", onlyWith = JDK17OrLater.class) @SuppressWarnings("unused") -final class Target_java_nio_DirectByteBufferR_JDK14OrLater { +final class Target_java_nio_DirectByteBufferR_JDK17OrLater { @Alias - protected Target_java_nio_DirectByteBufferR_JDK14OrLater(int cap, long addr, FileDescriptor fd, Runnable unmapper, boolean isSync, MemorySegmentProxy segment) { + protected Target_java_nio_DirectByteBufferR_JDK17OrLater(int cap, long addr, FileDescriptor fd, Runnable unmapper, boolean isSync, MemorySegmentProxy segment) { } } -@TargetClass(className = "sun.nio.ch.Util", onlyWith = JDK14OrLater.class) +@TargetClass(className = "sun.nio.ch.Util", onlyWith = JDK17OrLater.class) final class Target_sun_nio_ch_Util { @Substitute - private static Target_java_nio_DirectByteBuffer_JDK14OrLater newMappedByteBuffer(int size, long addr, FileDescriptor fd, Runnable unmapper, boolean isSync) { - return new Target_java_nio_DirectByteBuffer_JDK14OrLater(size, addr, fd, unmapper, isSync, null); + private static Target_java_nio_DirectByteBuffer_JDK17OrLater newMappedByteBuffer(int size, long addr, FileDescriptor fd, Runnable unmapper, boolean isSync) { + return new Target_java_nio_DirectByteBuffer_JDK17OrLater(size, addr, fd, unmapper, isSync, null); } @Substitute - static Target_java_nio_DirectByteBufferR_JDK14OrLater newMappedByteBufferR(int size, long addr, FileDescriptor fd, Runnable unmapper, boolean isSync) { - return new Target_java_nio_DirectByteBufferR_JDK14OrLater(size, addr, fd, unmapper, isSync, null); + static Target_java_nio_DirectByteBufferR_JDK17OrLater newMappedByteBufferR(int size, long addr, FileDescriptor fd, Runnable unmapper, boolean isSync) { + return new Target_java_nio_DirectByteBufferR_JDK17OrLater(size, addr, fd, unmapper, isSync, null); } } diff --git a/substratevm/src/com.oracle.svm.core.jdk15/src/com/oracle/svm/core/jdk15/Target_jdk_internal_loader_BootLoader_JDK15OrLater.java b/substratevm/src/com.oracle.svm.core.jdk17/src/com/oracle/svm/core/jdk17/Target_jdk_internal_loader_BootLoader_JDK17OrLater.java similarity index 89% rename from substratevm/src/com.oracle.svm.core.jdk15/src/com/oracle/svm/core/jdk15/Target_jdk_internal_loader_BootLoader_JDK15OrLater.java rename to substratevm/src/com.oracle.svm.core.jdk17/src/com/oracle/svm/core/jdk17/Target_jdk_internal_loader_BootLoader_JDK17OrLater.java index 09c1e91120f3..b44b604085b7 100644 --- a/substratevm/src/com.oracle.svm.core.jdk15/src/com/oracle/svm/core/jdk15/Target_jdk_internal_loader_BootLoader_JDK15OrLater.java +++ b/substratevm/src/com.oracle.svm.core.jdk17/src/com/oracle/svm/core/jdk17/Target_jdk_internal_loader_BootLoader_JDK17OrLater.java @@ -22,14 +22,14 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package com.oracle.svm.core.jdk15; +package com.oracle.svm.core.jdk17; import com.oracle.svm.core.annotate.Substitute; import com.oracle.svm.core.annotate.TargetClass; -import com.oracle.svm.core.jdk.JDK15OrLater; +import com.oracle.svm.core.jdk.JDK17OrLater; -@TargetClass(className = "jdk.internal.loader.BootLoader", onlyWith = JDK15OrLater.class) -final class Target_jdk_internal_loader_BootLoader_JDK15OrLater { +@TargetClass(className = "jdk.internal.loader.BootLoader", onlyWith = JDK17OrLater.class) +final class Target_jdk_internal_loader_BootLoader_JDK17OrLater { @SuppressWarnings("unused") @Substitute diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/Containers.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/Containers.java index f6828743c3dd..1c338ac0fc4d 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/Containers.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/Containers.java @@ -44,7 +44,7 @@ /** * Provides container awareness to the rest of the VM. * - * The implementation is based on the Container Metrics API from JDK 15. + * The implementation is based on the Container Metrics API from JDK 17. */ public class Containers { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java index 399eb506bfe0..a55ded155484 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java @@ -359,7 +359,7 @@ public static final long getTearDownFailureNanos() { @Override protected void onValueUpdate(EconomicMap, Object> values, String oldValue, String newValue) { if ("llvm".equals(newValue)) { - if (JavaVersionUtil.JAVA_SPEC >= 9) { + if (JavaVersionUtil.JAVA_SPEC >= 11) { /* See GR-14405, https://github.com/oracle/graal/issues/1056 */ GraalOptions.EmitStringSubstitutions.update(values, false); } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateUtil.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateUtil.java index 0cb5e35fdeb1..2f8bfa179701 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateUtil.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateUtil.java @@ -403,10 +403,10 @@ public static String mangleName(String methodName) { return mangled; } - private static final Method isHiddenMethod = JavaVersionUtil.JAVA_SPEC >= 15 ? ReflectionUtil.lookupMethod(Class.class, "isHidden") : null; + private static final Method isHiddenMethod = JavaVersionUtil.JAVA_SPEC >= 17 ? ReflectionUtil.lookupMethod(Class.class, "isHidden") : null; public static boolean isHiddenClass(Class javaClass) { - if (JavaVersionUtil.JAVA_SPEC >= 15) { + if (JavaVersionUtil.JAVA_SPEC >= 17) { try { return (boolean) isHiddenMethod.invoke(javaClass); } catch (IllegalAccessException | InvocationTargetException e) { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/Target_java_lang_ref_PhantomReference.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/Target_java_lang_ref_PhantomReference.java index 0537604c629b..e6a3b291f5d8 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/Target_java_lang_ref_PhantomReference.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/Target_java_lang_ref_PhantomReference.java @@ -30,12 +30,12 @@ import com.oracle.svm.core.annotate.Substitute; import com.oracle.svm.core.annotate.TargetClass; import com.oracle.svm.core.annotate.TargetElement; -import com.oracle.svm.core.jdk.JDK16OrLater; +import com.oracle.svm.core.jdk.JDK17OrLater; @TargetClass(PhantomReference.class) public final class Target_java_lang_ref_PhantomReference { @Substitute - @TargetElement(onlyWith = JDK16OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) boolean refersTo0(Object obj) { return ReferenceInternals.refersTo(SubstrateUtil.cast(this, PhantomReference.class), obj); } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/Target_java_lang_ref_Reference.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/Target_java_lang_ref_Reference.java index 79281b6269b3..848b5db4978e 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/Target_java_lang_ref_Reference.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/Target_java_lang_ref_Reference.java @@ -31,12 +31,12 @@ import java.lang.reflect.Field; import java.util.function.BooleanSupplier; -import com.oracle.svm.core.SubstrateUtil; import org.graalvm.compiler.api.directives.GraalDirectives; import org.graalvm.nativeimage.Platform; import org.graalvm.nativeimage.Platforms; import com.oracle.svm.core.SubstrateOptions; +import com.oracle.svm.core.SubstrateUtil; import com.oracle.svm.core.annotate.Alias; import com.oracle.svm.core.annotate.Delete; import com.oracle.svm.core.annotate.ExcludeFromReferenceMap; @@ -50,7 +50,7 @@ import com.oracle.svm.core.annotate.Uninterruptible; import com.oracle.svm.core.annotate.UnknownClass; import com.oracle.svm.core.jdk.JDK11OrLater; -import com.oracle.svm.core.jdk.JDK16OrLater; +import com.oracle.svm.core.jdk.JDK17OrLater; import com.oracle.svm.core.jdk.JDK17_0_2OrLater; import com.oracle.svm.core.jdk.JDK8OrEarlier; import com.oracle.svm.core.util.VMError; @@ -134,7 +134,7 @@ public void clear() { } @Substitute - @TargetElement(onlyWith = JDK16OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) private void clear0() { clear(); } @@ -144,11 +144,11 @@ private void clear0() { native boolean refersToImpl(T obj); @KeepOriginal - @TargetElement(onlyWith = JDK16OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) public native boolean refersTo(T obj); @Substitute - @TargetElement(onlyWith = JDK16OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) boolean refersTo0(Object obj) { return ReferenceInternals.refersTo(SubstrateUtil.cast(this, Reference.class), obj); } @@ -204,11 +204,11 @@ static void reachabilityFence(Object ref) { } @KeepOriginal - @TargetElement(onlyWith = JDK16OrLater.class) // + @TargetElement(onlyWith = JDK17OrLater.class) // native T getFromInactiveFinalReference(); @Substitute // - @TargetElement(onlyWith = JDK16OrLater.class) // + @TargetElement(onlyWith = JDK17OrLater.class) // void clearInactiveFinalReference() { // assert this instanceof FinalReference; assert next != null; // I.e. FinalReference is inactive diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/Target_jdk_internal_ref_Cleaner.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/Target_jdk_internal_ref_Cleaner.java index c610ee7be797..fab9b8081c7e 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/Target_jdk_internal_ref_Cleaner.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/Target_jdk_internal_ref_Cleaner.java @@ -35,8 +35,8 @@ import com.oracle.svm.core.annotate.RecomputeFieldValue; import com.oracle.svm.core.annotate.TargetClass; import com.oracle.svm.core.annotate.TargetElement; +import com.oracle.svm.core.jdk.JDK11OrEarlier; import com.oracle.svm.core.jdk.JDK11OrLater; -import com.oracle.svm.core.jdk.JDK15OrEarlier; @Platforms(Platform.HOSTED_ONLY.class) class Package_jdk_internal_ref implements Function { @@ -99,11 +99,11 @@ final class Target_jdk_internal_ref_CleanerImpl { Target_jdk_internal_ref_PhantomCleanable phantomCleanableList; @Alias @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.NewInstance, declClassName = "jdk.internal.ref.CleanerImpl$WeakCleanableRef")// - @TargetElement(onlyWith = JDK15OrEarlier.class) // + @TargetElement(onlyWith = JDK11OrEarlier.class) // Target_jdk_internal_ref_WeakCleanable weakCleanableList; @Alias @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.NewInstance, declClassName = "jdk.internal.ref.CleanerImpl$SoftCleanableRef")// - @TargetElement(onlyWith = JDK15OrEarlier.class) // + @TargetElement(onlyWith = JDK11OrEarlier.class) // Target_jdk_internal_ref_SoftCleanable softCleanableList; @Alias @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.NewInstance, declClassName = "java.lang.ref.ReferenceQueue")// @@ -114,12 +114,12 @@ final class Target_jdk_internal_ref_CleanerImpl { final class Target_jdk_internal_ref_PhantomCleanable { } -// Removed by JDK-8251861 in JDK 16 -@TargetClass(className = "jdk.internal.ref.WeakCleanable", onlyWith = {JDK11OrLater.class, JDK15OrEarlier.class}) +// Removed by JDK-8251861 +@TargetClass(className = "jdk.internal.ref.WeakCleanable", onlyWith = {JDK11OrLater.class, JDK11OrEarlier.class}) final class Target_jdk_internal_ref_WeakCleanable { } -// Removed by JDK-8251861 in JDK 16 -@TargetClass(className = "jdk.internal.ref.SoftCleanable", onlyWith = {JDK11OrLater.class, JDK15OrEarlier.class}) +// Removed by JDK-8251861 +@TargetClass(className = "jdk.internal.ref.SoftCleanable", onlyWith = {JDK11OrLater.class, JDK11OrEarlier.class}) final class Target_jdk_internal_ref_SoftCleanable { } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHub.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHub.java index d83b17f47a47..152a650b5892 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHub.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHub.java @@ -79,8 +79,7 @@ import com.oracle.svm.core.classinitialization.EnsureClassInitializedNode; import com.oracle.svm.core.code.CodeInfoDecoder; import com.oracle.svm.core.jdk.JDK11OrLater; -import com.oracle.svm.core.jdk.JDK15OrLater; -import com.oracle.svm.core.jdk.JDK16OrLater; +import com.oracle.svm.core.jdk.JDK17OrLater; import com.oracle.svm.core.jdk.JDK8OrEarlier; import com.oracle.svm.core.jdk.Package_jdk_internal_reflect; import com.oracle.svm.core.jdk.Resources; @@ -176,12 +175,12 @@ public final class DynamicHub implements JavaKind.FormatWithToString, AnnotatedE private static final int IS_INSTANTIATED_FLAG_BIT = 0; /** - * Is this a Hidden Class (Since JDK 15). + * Is this a Hidden Class. */ private static final int IS_HIDDED_FLAG_BIT = 1; /** - * Is this a Record Class (Since JDK 15). + * Is this a Record Class. */ private static final int IS_RECORD_FLAG_BIT = 2; @@ -807,13 +806,13 @@ private boolean isAnonymousClass() { } @Substitute - @TargetElement(onlyWith = JDK15OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) public boolean isHidden() { return isFlagSet(IS_HIDDED_FLAG_BIT); } @Substitute - @TargetElement(onlyWith = JDK15OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) public boolean isRecord() { return isFlagSet(IS_RECORD_FLAG_BIT); } @@ -1283,11 +1282,11 @@ private Method[] privateGetPublicMethods() { } @KeepOriginal - @TargetElement(onlyWith = JDK16OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) private native Target_java_lang_reflect_RecordComponent[] getRecordComponents(); @Substitute - @TargetElement(onlyWith = JDK16OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) private Target_java_lang_reflect_RecordComponent[] getRecordComponents0() { Object[] result = rd.recordComponents; if (result == null) { @@ -1567,14 +1566,14 @@ private Class[] getNestMembers() { } @Substitute - @TargetElement(onlyWith = JDK15OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) @Override public DynamicHub componentType() { return componentType; } @Substitute - @TargetElement(onlyWith = JDK15OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) @Override public DynamicHub arrayType() { return arrayHub; @@ -1587,20 +1586,20 @@ public DynamicHub arrayType() { */ @KeepOriginal - @TargetElement(onlyWith = JDK15OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) private Class elementType() { throw VMError.unsupportedFeature("Method is not available in JDK 8 or JDK 11"); } @KeepOriginal - @TargetElement(onlyWith = JDK15OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) @Override public String descriptorString() { throw VMError.unsupportedFeature("Method is not available in JDK 8 or JDK 11"); } @KeepOriginal - @TargetElement(onlyWith = JDK15OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) @Override public Optional describeConstable() { throw VMError.unsupportedFeature("Method is not available in JDK 8 or JDK 11"); @@ -1687,21 +1686,21 @@ public Optional describeConstable() { */ @Substitute -@TargetClass(className = "java.lang.constant.Constable", onlyWith = JDK15OrLater.class) +@TargetClass(className = "java.lang.constant.Constable", onlyWith = JDK17OrLater.class) interface Target_java_lang_constant_Constable { @KeepOriginal Optional describeConstable(); } @Substitute -@TargetClass(className = "java.lang.invoke.TypeDescriptor", onlyWith = JDK15OrLater.class) +@TargetClass(className = "java.lang.invoke.TypeDescriptor", onlyWith = JDK17OrLater.class) interface Target_java_lang_invoke_TypeDescriptor { @KeepOriginal String descriptorString(); } @Substitute -@TargetClass(className = "java.lang.invoke.TypeDescriptor", innerClass = "OfField", onlyWith = JDK15OrLater.class) +@TargetClass(className = "java.lang.invoke.TypeDescriptor", innerClass = "OfField", onlyWith = JDK17OrLater.class) interface Target_java_lang_invoke_TypeDescriptor_OfField> extends Target_java_lang_invoke_TypeDescriptor { @KeepOriginal boolean isArray(); @@ -1737,6 +1736,6 @@ public static Target_jdk_internal_reflect_ReflectionFactory getReflectionFactory } } -@TargetClass(className = "java.lang.reflect.RecordComponent", onlyWith = JDK16OrLater.class) +@TargetClass(className = "java.lang.reflect.RecordComponent", onlyWith = JDK17OrLater.class) final class Target_java_lang_reflect_RecordComponent { } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/HiddenClassSupport.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/HiddenClassSupport.java deleted file mode 100644 index 9f3713891e35..000000000000 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/HiddenClassSupport.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2021, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.svm.core.jdk; - -import org.graalvm.compiler.api.replacements.Fold; -import org.graalvm.nativeimage.ImageSingletons; - -import com.oracle.svm.core.util.VMError; - -/** - * Abstracts the information about hidden classes, which are not available in Java 11 and Java 8. - * This class provides all information about hidden classes without exposing any JDK types and - * methods that are not yet present in the old JDKs. - */ -public abstract class HiddenClassSupport { - @Fold - public static HiddenClassSupport singleton() { - return ImageSingletons.lookup(HiddenClassSupport.class); - } - - @Fold - public static boolean isAvailable() { - return ImageSingletons.contains(HiddenClassSupport.class); - } - - /** Same as {@code Class.isHidden()}. */ - public boolean isHidden(@SuppressWarnings("unused") Class clazz) { - throw VMError.shouldNotReachHere(); - } -} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK11To14.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK11To14.java deleted file mode 100644 index b4a8261954da..000000000000 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK11To14.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2018, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.svm.core.jdk; - -import java.util.function.BooleanSupplier; - -import org.graalvm.compiler.serviceprovider.JavaVersionUtil; - -public class JDK11To14 implements BooleanSupplier { - @Override - public boolean getAsBoolean() { - return JavaVersionUtil.JAVA_SPEC >= 11 && JavaVersionUtil.JAVA_SPEC <= 14; - } -} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK11To16.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK11To16.java deleted file mode 100644 index f1dbc16c2979..000000000000 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK11To16.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.svm.core.jdk; - -import java.util.function.BooleanSupplier; - -import org.graalvm.compiler.serviceprovider.JavaVersionUtil; - -public class JDK11To16 implements BooleanSupplier { - @Override - public boolean getAsBoolean() { - return JavaVersionUtil.JAVA_SPEC >= 11 && JavaVersionUtil.JAVA_SPEC <= 16; - } -} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK11_0_10OrEarlier.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK11_0_10OrEarlier.java deleted file mode 100644 index 826e99189c19..000000000000 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK11_0_10OrEarlier.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2021, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.svm.core.jdk; - -import java.util.function.BooleanSupplier; - -import org.graalvm.compiler.serviceprovider.JavaVersionUtil; -import org.graalvm.compiler.serviceprovider.GraalServices; - -public class JDK11_0_10OrEarlier implements BooleanSupplier { - @Override - public boolean getAsBoolean() { - return JavaVersionUtil.JAVA_SPEC < 11 || - (JavaVersionUtil.JAVA_SPEC == 11 && GraalServices.getJavaUpdateVersion() <= 10); - } -} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK11_0_11OrLater.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK11_0_11OrLater.java deleted file mode 100644 index cf6f5c52a22c..000000000000 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK11_0_11OrLater.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2021, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.svm.core.jdk; - -import java.util.function.BooleanSupplier; - -import org.graalvm.compiler.serviceprovider.JavaVersionUtil; -import org.graalvm.compiler.serviceprovider.GraalServices; - -public class JDK11_0_11OrLater implements BooleanSupplier { - @Override - public boolean getAsBoolean() { - return JavaVersionUtil.JAVA_SPEC > 11 || - (JavaVersionUtil.JAVA_SPEC == 11 && GraalServices.getJavaUpdateVersion() > 10); - } -} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK14OrEarlier.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK14OrEarlier.java deleted file mode 100644 index 1a1941e754c4..000000000000 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK14OrEarlier.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2020, 2020, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.svm.core.jdk; - -import java.util.function.BooleanSupplier; - -import org.graalvm.compiler.serviceprovider.JavaVersionUtil; - -public class JDK14OrEarlier implements BooleanSupplier { - @Override - public boolean getAsBoolean() { - return JavaVersionUtil.JAVA_SPEC <= 14; - } -} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK14OrLater.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK14OrLater.java deleted file mode 100644 index 57e1645fbbd6..000000000000 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK14OrLater.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2019, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.svm.core.jdk; - -import java.util.function.BooleanSupplier; - -import org.graalvm.compiler.serviceprovider.JavaVersionUtil; - -public class JDK14OrLater implements BooleanSupplier { - @Override - public boolean getAsBoolean() { - return JavaVersionUtil.JAVA_SPEC >= 14; - } -} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK15OrEarlier.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK15OrEarlier.java deleted file mode 100644 index 2967a069bcd6..000000000000 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK15OrEarlier.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2020, 2020, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.svm.core.jdk; - -import java.util.function.BooleanSupplier; - -import org.graalvm.compiler.serviceprovider.JavaVersionUtil; - -public class JDK15OrEarlier implements BooleanSupplier { - @Override - public boolean getAsBoolean() { - return JavaVersionUtil.JAVA_SPEC <= 15; - } -} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK15OrLater.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK15OrLater.java deleted file mode 100644 index 91c8331a6548..000000000000 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK15OrLater.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2020, 2020, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.svm.core.jdk; - -import java.util.function.BooleanSupplier; - -import org.graalvm.compiler.serviceprovider.JavaVersionUtil; - -public class JDK15OrLater implements BooleanSupplier { - @Override - public boolean getAsBoolean() { - return JavaVersionUtil.JAVA_SPEC >= 15; - } -} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK16OrEarlier.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK16OrEarlier.java deleted file mode 100644 index 8e0738e42b8f..000000000000 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK16OrEarlier.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2020, 2020, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.svm.core.jdk; - -import java.util.function.BooleanSupplier; - -import org.graalvm.compiler.serviceprovider.JavaVersionUtil; - -public class JDK16OrEarlier implements BooleanSupplier { - @Override - public boolean getAsBoolean() { - return JavaVersionUtil.JAVA_SPEC <= 16; - } -} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK16OrLater.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK16OrLater.java deleted file mode 100644 index 51b1acebf518..000000000000 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK16OrLater.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2021, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.svm.core.jdk; - -import java.util.function.BooleanSupplier; - -import org.graalvm.compiler.serviceprovider.JavaVersionUtil; - -public class JDK16OrLater implements BooleanSupplier { - @Override - public boolean getAsBoolean() { - return JavaVersionUtil.JAVA_SPEC >= 16; - } -} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JavaLangSubstitutions.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JavaLangSubstitutions.java index cc63053484bf..44394c64a92c 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JavaLangSubstitutions.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JavaLangSubstitutions.java @@ -647,7 +647,7 @@ static void disable() { final class Target_java_lang_NullPointerException { @Substitute - @TargetElement(onlyWith = JDK14OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) @SuppressWarnings("static-method") private String getExtendedNPEMessage() { return null; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Package_jdk_internal_loader_helper.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Package_jdk_internal_loader_helper.java index dd2ba22bd3fb..bbf64c8771e3 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Package_jdk_internal_loader_helper.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Package_jdk_internal_loader_helper.java @@ -37,7 +37,7 @@ public class Package_jdk_internal_loader_helper implements Function clazz) { return false; @@ -104,14 +104,14 @@ public Constructor getCanonicalRecordConstructor(Class clazz) { } @AutomaticFeature -final class RecordFeatureBeforeJDK16 implements Feature { +final class RecordFeatureBeforeJDK17 implements Feature { @Override public boolean isInConfiguration(IsInConfigurationAccess access) { - return JavaVersionUtil.JAVA_SPEC < 16; + return JavaVersionUtil.JAVA_SPEC <= 11; } @Override public void afterRegistration(AfterRegistrationAccess access) { - ImageSingletons.add(RecordSupport.class, new RecordSupportBeforeJDK16()); + ImageSingletons.add(RecordSupport.class, new RecordSupportJDK11OrEarlier()); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/SecuritySubstitutions.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/SecuritySubstitutions.java index 27325d3b6f01..2eb7250dd07c 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/SecuritySubstitutions.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/SecuritySubstitutions.java @@ -308,7 +308,7 @@ final class Target_javax_crypto_JceSecurity { * * This is only used in {@link KeyAgreement}, it's safe to remove. */ - @Alias @TargetElement(onlyWith = JDK15OrEarlier.class) // + @Alias @TargetElement(onlyWith = JDK11OrEarlier.class) // @InjectAccessors(JceSecurityAccessor.class) // static SecureRandom RANDOM; @@ -376,7 +376,7 @@ public Object transform(MetaAccessProvider metaAccess, ResolvedJavaField origina } } -@TargetClass(className = "javax.crypto.JceSecurity", innerClass = "IdentityWrapper", onlyWith = JDK16OrLater.class) +@TargetClass(className = "javax.crypto.JceSecurity", innerClass = "IdentityWrapper", onlyWith = JDK17OrLater.class) @SuppressWarnings({"unused"}) final class Target_javax_crypto_JceSecurity_IdentityWrapper { @Alias // @@ -419,10 +419,10 @@ private static synchronized SecureRandom initializeOnce() { final class JceSecurityUtil { static Object providerKey(Provider p) { - if (JavaVersionUtil.JAVA_SPEC < 16) { + if (JavaVersionUtil.JAVA_SPEC <= 11) { return p; } - /* Starting with JDK 16 the verification results map key is an identity wrapper object. */ + /* Starting with JDK 17 the verification results map key is an identity wrapper object. */ return new Target_javax_crypto_JceSecurity_IdentityWrapper(p); } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/SunMiscSubstitutions.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/SunMiscSubstitutions.java index d2439f7f6ab1..fdfcc3c478ba 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/SunMiscSubstitutions.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/SunMiscSubstitutions.java @@ -145,10 +145,6 @@ private void setMemory0(Object destBase, long destOffset, long bytes, byte bvalu @Substitute private int addressSize() { - /* - * JDK 14 now injects Unsafe contants via the Hotspot VM, so we just determine the size of - * pointers ourself. - */ return ConfigurationValues.getTarget().wordSize; } @@ -208,7 +204,7 @@ private Class defineClass(String name, byte[] b, int off, int len, ClassLoade // JDK-8243287 @Substitute - @TargetElement(onlyWith = JDK16OrEarlier.class) + @TargetElement(onlyWith = JDK11OrEarlier.class) private Class defineAnonymousClass(Class hostClass, byte[] data, Object[] cpPatches) { throw VMError.unsupportedFeature("Defining anonymous classes at runtime is not supported."); } @@ -290,7 +286,7 @@ private Class defineClass0(String name, byte[] b, int off, int len, ClassLoad // JDK-8243287 @Delete - @TargetElement(onlyWith = JDK11To16.class) + @TargetElement(onlyWith = {JDK11OrLater.class, JDK11OrEarlier.class}) private native Class defineAnonymousClass0(Class hostClass, byte[] data, Object[] cpPatches); @Delete diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/SunNioSubstitutions.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/SunNioSubstitutions.java index 306cb60b80e2..4106a14d6f90 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/SunNioSubstitutions.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/SunNioSubstitutions.java @@ -31,7 +31,7 @@ import com.oracle.svm.core.annotate.TargetClass; import com.oracle.svm.core.util.VMError; -@TargetClass(className = "java.nio.channels.spi.SelectorProvider", onlyWith = JDK14OrEarlier.class) +@TargetClass(className = "java.nio.channels.spi.SelectorProvider", onlyWith = JDK11OrEarlier.class) final class Target_java_nio_channels_spi_SelectorProvider { @Alias// @@ -57,7 +57,7 @@ static SelectorProvider provider() { } } -@TargetClass(className = "java.nio.channels.spi.SelectorProvider", innerClass = "Holder", onlyWith = JDK15OrLater.class) +@TargetClass(className = "java.nio.channels.spi.SelectorProvider", innerClass = "Holder", onlyWith = JDK17OrLater.class) final class Target_java_nio_channels_spi_SelectorProvider_Holder { @Alias// diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_java_lang_ClassLoader.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_java_lang_ClassLoader.java index a51b8b25800e..1cae57e01340 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_java_lang_ClassLoader.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_java_lang_ClassLoader.java @@ -124,8 +124,8 @@ public static InputStream getSystemResourceAsStream(String name) { @Substitute @SuppressWarnings("unused") - @TargetElement(onlyWith = JDK14OrEarlier.class) // - /* Substitution for JDK 15 and later is in Target_java_lang_ClassLoader_JDK15OrLater. */ + @TargetElement(onlyWith = JDK11OrEarlier.class) // + /* Substitution for JDK 17 and later is in Target_java_lang_ClassLoader_JDK17OrLater. */ static void loadLibrary(Class fromClass, String name, boolean isAbsolute) { if (isAbsolute) { NativeLibrarySupport.singleton().loadLibraryAbsolute(new File(name)); @@ -169,7 +169,7 @@ Class loadClass(String name, boolean resolve) throws ClassNotFoundException { } @Delete - @TargetElement(onlyWith = JDK16OrEarlier.class) + @TargetElement(onlyWith = JDK11OrEarlier.class) native Class findBootstrapClassOrNull(String name); // JDK-8265605 @@ -319,7 +319,7 @@ protected void resolveClass(@SuppressWarnings("unused") Class c) { private static native Class defineClass2(ClassLoader loader, String name, java.nio.ByteBuffer b, int off, int len, ProtectionDomain pd, String source); @Delete - @TargetElement(onlyWith = JDK16OrEarlier.class) + @TargetElement(onlyWith = JDK11OrEarlier.class) private native Class findBootstrapClass(String name); // JDK-8265605 @@ -328,14 +328,14 @@ protected void resolveClass(@SuppressWarnings("unused") Class c) { private static native Class findBootstrapClassJDK17OrLater(String name); @Delete - @TargetElement(onlyWith = JDK14OrEarlier.class) + @TargetElement(onlyWith = JDK11OrEarlier.class) private static native String findBuiltinLib(String name); @Delete private static native Target_java_lang_AssertionStatusDirectives retrieveDirectives(); } -@TargetClass(value = ClassLoader.class, innerClass = "NativeLibrary", onlyWith = JDK14OrEarlier.class) +@TargetClass(value = ClassLoader.class, innerClass = "NativeLibrary", onlyWith = JDK11OrEarlier.class) final class Target_java_lang_ClassLoader_NativeLibrary { /* diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_javax_net_ssl_SSLContext.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_javax_net_ssl_SSLContext.java deleted file mode 100644 index e13e9ab406c6..000000000000 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_javax_net_ssl_SSLContext.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2020, 2020, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.svm.core.jdk; - -import javax.net.ssl.SSLContext; - -import com.oracle.svm.core.annotate.Alias; -import com.oracle.svm.core.annotate.RecomputeFieldValue; -import com.oracle.svm.core.annotate.RecomputeFieldValue.Kind; -import com.oracle.svm.core.annotate.TargetClass; - -/** - * The class SSLContext has a VarHandle field on JDK 15 and later, so we cannot initialize the class - * at run time. We therefore reset just the single static field that is lazily initialized. - */ -@TargetClass(javax.net.ssl.SSLContext.class) -final class Target_javax_net_ssl_SSLContext { - - @Alias @RecomputeFieldValue(kind = Kind.Reset) // - private static volatile SSLContext defaultContext; -} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_internal_util_StaticProperty.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_internal_util_StaticProperty.java index ce5669f7fd7f..29d0e0d88861 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_internal_util_StaticProperty.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_internal_util_StaticProperty.java @@ -63,26 +63,26 @@ private static String userName() { } @Substitute - @TargetElement(onlyWith = JDK16OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) private static String javaIoTmpDir() { return ImageSingletons.lookup(SystemPropertiesSupport.class).tmpDir(); } @Substitute - @TargetElement(onlyWith = JDK15OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) private static String javaLibraryPath() { return ImageSingletons.lookup(SystemPropertiesSupport.class).javaLibraryPath(); } @Substitute - @TargetElement(onlyWith = JDK15OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) private static String sunBootLibraryPath() { String value = ImageSingletons.lookup(SystemPropertiesSupport.class).savedProperties.get("sun.boot.library.path"); return value == null ? "" : value; } @Substitute - @TargetElement(onlyWith = JDK15OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) private static String jdkSerialFilter() { return ImageSingletons.lookup(SystemPropertiesSupport.class).savedProperties.get("jdk.serialFilter"); } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_nashorn_api_scripting_ClassFilter.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_nashorn_api_scripting_ClassFilter.java index 61b0d77b3f55..72a3728caa24 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_nashorn_api_scripting_ClassFilter.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_nashorn_api_scripting_ClassFilter.java @@ -27,6 +27,6 @@ import com.oracle.svm.core.annotate.TargetClass; import com.oracle.svm.core.jdk.NashornSupport.NashornAvailable; -@TargetClass(className = "jdk.nashorn.api.scripting.ClassFilter", onlyWith = {JDK14OrEarlier.class, NashornAvailable.class}) +@TargetClass(className = "jdk.nashorn.api.scripting.ClassFilter", onlyWith = {JDK11OrEarlier.class, NashornAvailable.class}) public final class Target_jdk_nashorn_api_scripting_ClassFilter { } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_nashorn_api_scripting_NashornScriptEngineFactory.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_nashorn_api_scripting_NashornScriptEngineFactory.java index 2af6efcd1fc7..31714e6a4649 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_nashorn_api_scripting_NashornScriptEngineFactory.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_nashorn_api_scripting_NashornScriptEngineFactory.java @@ -31,7 +31,7 @@ import com.oracle.svm.core.jdk.NashornSupport.NashornAvailable; import com.oracle.svm.core.util.VMError; -@TargetClass(className = "jdk.nashorn.api.scripting.NashornScriptEngineFactory", onlyWith = {JDK14OrEarlier.class, NashornAvailable.class}) +@TargetClass(className = "jdk.nashorn.api.scripting.NashornScriptEngineFactory", onlyWith = {JDK11OrEarlier.class, NashornAvailable.class}) public final class Target_jdk_nashorn_api_scripting_NashornScriptEngineFactory { @Substitute @SuppressWarnings({"unused", "static-method"}) diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/ThreadLocalRandomAccessors.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/ThreadLocalRandomAccessors.java index a8bd66da1e57..75671b8a1949 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/ThreadLocalRandomAccessors.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/ThreadLocalRandomAccessors.java @@ -45,7 +45,7 @@ final class Target_java_util_concurrent_ThreadLocalRandom { private static AtomicLong seeder; @Alias - @TargetElement(onlyWith = JDK16OrEarlier.class) + @TargetElement(onlyWith = JDK11OrEarlier.class) static native long mix64(long z); } @@ -72,7 +72,7 @@ public static void setSeeder(AtomicLong value) { @Override long mix64(long l) { - if (JavaVersionUtil.JAVA_SPEC < 17) { + if (JavaVersionUtil.JAVA_SPEC <= 11) { return Target_java_util_concurrent_ThreadLocalRandom.mix64(l); } else { return Target_jdk_internal_util_random_RandomSupport.mixMurmur64(l); diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/VarHandleFeature.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/VarHandleFeature.java index 25569ad9e417..d19a0b91920c 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/VarHandleFeature.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/VarHandleFeature.java @@ -102,7 +102,7 @@ public class VarHandleFeature implements Feature { private static final Unsafe UNSAFE = GraalUnsafeAccess.getUnsafe(); /** The JDK 11 class VarHandleObjects got renamed to VarHandleReferences. */ - static final String OBJECT_SUFFIX = JavaVersionUtil.JAVA_SPEC > 11 ? "References" : "Objects"; + static final String OBJECT_SUFFIX = JavaVersionUtil.JAVA_SPEC <= 11 ? "Objects" : "References"; private final Map, VarHandleInfo> infos = new HashMap<>(); @@ -489,7 +489,7 @@ final class Target_java_lang_invoke_VarHandle { * collects details about the MemberName, which are method handle internals that must not be * reachable. */ - @TargetElement(onlyWith = JDK14OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) @Substitute @Override public String toString() { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/localization/substitutions/Target_sun_util_locale_provider_LocaleServiceProviderPool_OptimizedLocaleMode.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/localization/substitutions/Target_sun_util_locale_provider_LocaleServiceProviderPool_OptimizedLocaleMode.java index 6798bf245fd9..fa3d5b946f97 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/localization/substitutions/Target_sun_util_locale_provider_LocaleServiceProviderPool_OptimizedLocaleMode.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/localization/substitutions/Target_sun_util_locale_provider_LocaleServiceProviderPool_OptimizedLocaleMode.java @@ -28,8 +28,8 @@ import com.oracle.svm.core.annotate.Substitute; import com.oracle.svm.core.annotate.TargetClass; import com.oracle.svm.core.annotate.TargetElement; +import com.oracle.svm.core.jdk.JDK11OrEarlier; import com.oracle.svm.core.jdk.JDK11OrLater; -import com.oracle.svm.core.jdk.JDK11To14; import com.oracle.svm.core.jdk.JDK8OrEarlier; import com.oracle.svm.core.jdk.localization.LocalizationSupport; import com.oracle.svm.core.jdk.localization.substitutions.modes.OptimizedLocaleMode; @@ -94,7 +94,7 @@ public native

S getLocalizedObject(LocaleSe Object... params); @KeepOriginal // - @TargetElement(onlyWith = JDK11To14.class) // + @TargetElement(onlyWith = {JDK11OrLater.class, JDK11OrEarlier.class}) // static native void config(Class caller, String message); @Substitute diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/management/SubstrateOperatingSystemMXBean.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/management/SubstrateOperatingSystemMXBean.java index 4261147b9519..c6a53cd86459 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/management/SubstrateOperatingSystemMXBean.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/management/SubstrateOperatingSystemMXBean.java @@ -70,7 +70,7 @@ public int getAvailableProcessors() { return Runtime.getRuntime().availableProcessors(); } - @SuppressWarnings("deprecation") // getTotalPhysicalMemorySize deprecated since JDK 14 + @SuppressWarnings("deprecation") // getTotalPhysicalMemorySize is deprecated after JDK 11 @Override public long getTotalPhysicalMemorySize() { return PhysicalMemory.size().rawValue(); @@ -101,13 +101,13 @@ public long getProcessCpuTime() { throw VMError.unsupportedFeature(MSG); } - @SuppressWarnings("deprecation") // getFreePhysicalMemorySize deprecated since JDK 14 + @SuppressWarnings("deprecation") // getFreePhysicalMemorySize is deprecated after JDK 11 @Override public long getFreePhysicalMemorySize() { throw VMError.unsupportedFeature(MSG); } - @SuppressWarnings("deprecation") // getSystemCpuLoad deprecated since JDK 14 + @SuppressWarnings("deprecation") // getSystemCpuLoad is deprecated after JDK 11 @Override public double getSystemCpuLoad() { throw VMError.unsupportedFeature(MSG); diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/management/SubstrateOperatingSystemMXBeanBase.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/management/SubstrateOperatingSystemMXBeanBase.java index 3ddc68935c62..dab9ceccd728 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/management/SubstrateOperatingSystemMXBeanBase.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/management/SubstrateOperatingSystemMXBeanBase.java @@ -27,7 +27,7 @@ import com.oracle.svm.core.util.VMError; /** - * Base class for defining methods introduced in JDK 14 by JDK-8226575. + * Base class for defining methods introduced after JDK 11 by JDK-8226575. * * Putting these in a class that does not implement {@link com.sun.management.OperatingSystemMXBean} * avoids javac errors related these methods being annotated by {@link Override}. @@ -35,7 +35,6 @@ public abstract class SubstrateOperatingSystemMXBeanBase { static final String MSG = "OperatingSystemMXBean methods"; - // Temporary fix for JDK14 added methods. // Will be removed after [GR-20166] is implemented. public double getCpuLoad() { throw VMError.unsupportedFeature(MSG); diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/JavaThreads.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/JavaThreads.java index bb208acc802d..23e2dbbbc0e9 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/JavaThreads.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/JavaThreads.java @@ -177,10 +177,10 @@ public static void setThreadStatus(Thread thread, int threadStatus) { * in VM-internal contexts. */ public static boolean isInterrupted(Thread thread) { - if (JavaVersionUtil.JAVA_SPEC >= 14) { - return toTarget(thread).interruptedJDK14OrLater; + if (JavaVersionUtil.JAVA_SPEC >= 17) { + return toTarget(thread).interruptedJDK17OrLater; } - return toTarget(thread).interrupted; + return toTarget(thread).interruptedJDK11OrEarlier; } protected static AtomicReference getUnsafeParkEvent(Thread thread) { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/Target_java_lang_Thread.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/Target_java_lang_Thread.java index 5f45e94a4b90..8f3c109bdff4 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/Target_java_lang_Thread.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/Target_java_lang_Thread.java @@ -43,7 +43,7 @@ import com.oracle.svm.core.annotate.Uninterruptible; import com.oracle.svm.core.jdk.JDK11OrEarlier; import com.oracle.svm.core.jdk.JDK11OrLater; -import com.oracle.svm.core.jdk.JDK14OrLater; +import com.oracle.svm.core.jdk.JDK17OrLater; import com.oracle.svm.core.jdk.JDK8OrEarlier; import com.oracle.svm.core.jdk.LoomJDK; import com.oracle.svm.core.jdk.NotLoomJDK; @@ -64,17 +64,17 @@ public final class Target_java_lang_Thread { * * After JDK 11, a field with same name has been introduced and the logic to set / reset it has * moved into Java code. So this injected field and the substitutions that maintain it are no - * longer necessary. See {@link #interruptedJDK14OrLater}. + * longer necessary. See {@link #interruptedJDK17OrLater}. */ @Inject // @TargetElement(onlyWith = JDK11OrEarlier.class) // @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset) // - volatile boolean interrupted; + volatile boolean interruptedJDK11OrEarlier; @Alias // - @TargetElement(name = "interrupted", onlyWith = JDK14OrLater.class) // + @TargetElement(name = "interrupted", onlyWith = JDK17OrLater.class) // @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset) // - volatile boolean interruptedJDK14OrLater; + volatile boolean interruptedJDK17OrLater; @Inject @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset)// boolean wasStartedByCurrentIsolate; @@ -379,7 +379,7 @@ private void setPriority0(int priority) { @Substitute @TargetElement(onlyWith = JDK11OrEarlier.class) private boolean isInterrupted(boolean clearInterrupted) { - final boolean result = interrupted; + final boolean result = interruptedJDK11OrEarlier; if (result && clearInterrupted) { /* * As we don't use a lock, it is possible to observe any kinds of races with other @@ -389,7 +389,7 @@ private boolean isInterrupted(boolean clearInterrupted) { * isInterrupted as clearInterrupted may only be true if this method is being executed * by the current thread. */ - interrupted = false; + interruptedJDK11OrEarlier = false; } return result; } @@ -403,7 +403,7 @@ private boolean isInterrupted(boolean clearInterrupted) { @Substitute void interrupt0() { if (JavaVersionUtil.JAVA_SPEC <= 11) { - interrupted = true; + interruptedJDK11OrEarlier = true; } else { /* * After JDK 11, the interrupted flag is maintained by the JDK in Java code, i.e., @@ -537,7 +537,7 @@ private static Map getAllStackTraces() { } @Substitute - @TargetElement(onlyWith = JDK14OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) private static void clearInterruptEvent() { /* * In the JDK, this is a no-op except on Windows. The JDK resets the interrupt event used by diff --git a/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java b/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java index 1373baa0d0c9..8c7d20b9f560 100644 --- a/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java +++ b/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java @@ -1804,7 +1804,7 @@ protected String getXmsValue() { return "1g"; } - @SuppressWarnings("deprecation") // getTotalPhysicalMemorySize deprecated since JDK 14 + @SuppressWarnings("deprecation") // getTotalPhysicalMemorySize is deprecated after JDK 11 private static long getPhysicalMemorySize() { OperatingSystemMXBean osMXBean = ManagementFactory.getOperatingSystemMXBean(); long totalPhysicalMemorySize = ((com.sun.management.OperatingSystemMXBean) osMXBean).getTotalPhysicalMemorySize(); diff --git a/substratevm/src/com.oracle.svm.hosted.jdk14/src/com/oracle/svm/hosted/jdk/JNIRegistrationSupport_JDK14OrLater.java b/substratevm/src/com.oracle.svm.hosted.jdk17/src/com/oracle/svm/hosted/jdk17/JNIRegistrationSupport_JDK17OrLater.java similarity index 82% rename from substratevm/src/com.oracle.svm.hosted.jdk14/src/com/oracle/svm/hosted/jdk/JNIRegistrationSupport_JDK14OrLater.java rename to substratevm/src/com.oracle.svm.hosted.jdk17/src/com/oracle/svm/hosted/jdk17/JNIRegistrationSupport_JDK17OrLater.java index bf3572c0cfc5..05db2050e164 100644 --- a/substratevm/src/com.oracle.svm.hosted.jdk14/src/com/oracle/svm/hosted/jdk/JNIRegistrationSupport_JDK14OrLater.java +++ b/substratevm/src/com.oracle.svm.hosted.jdk17/src/com/oracle/svm/hosted/jdk17/JNIRegistrationSupport_JDK17OrLater.java @@ -22,26 +22,33 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package com.oracle.svm.hosted.jdk; +package com.oracle.svm.hosted.jdk17; import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins; import org.graalvm.compiler.phases.util.Providers; +import org.graalvm.compiler.serviceprovider.JavaVersionUtil; import org.graalvm.nativeimage.Platforms; import org.graalvm.nativeimage.impl.InternalPlatform; import com.oracle.svm.core.ParsingReason; import com.oracle.svm.core.annotate.AutomaticFeature; import com.oracle.svm.core.graal.GraalFeature; +import com.oracle.svm.hosted.jdk.JNIRegistrationSupport; import jdk.internal.loader.BootLoader; /** - * Registration of native JDK libraries for JDK 14 and later that are loaded via + * Registration of native JDK libraries for JDK 17 and later that are loaded via * jdk.internal.loader.BootLoader */ @Platforms(InternalPlatform.PLATFORM_JNI.class) @AutomaticFeature -class JNIRegistrationSupport_JDK14OrLater implements GraalFeature { +final class JNIRegistrationSupport_JDK17OrLater implements GraalFeature { + @Override + public boolean isInConfiguration(IsInConfigurationAccess access) { + return JavaVersionUtil.JAVA_SPEC >= 17; + } + @Override public void registerGraphBuilderPlugins(Providers providers, Plugins plugins, ParsingReason reason) { JNIRegistrationSupport.singleton().registerLoadLibraryPlugin(plugins, BootLoader.class); diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageGeneratorRunner.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageGeneratorRunner.java index 67096fe11c59..c66c8b2482bc 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageGeneratorRunner.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageGeneratorRunner.java @@ -590,12 +590,12 @@ public static void main(String[] args) { ModuleSupport.exportAndOpenAllPackagesToUnnamed("jdk.internal.vm.compiler.management", true); ModuleSupport.exportAndOpenAllPackagesToUnnamed("com.oracle.graal.graal_enterprise", true); ModuleSupport.exportAndOpenPackageToUnnamed("java.base", "jdk.internal.loader", false); - if (JavaVersionUtil.JAVA_SPEC >= 15) { + if (JavaVersionUtil.JAVA_SPEC >= 17) { ModuleSupport.exportAndOpenPackageToUnnamed("java.base", "jdk.internal.misc", false); } ModuleSupport.exportAndOpenPackageToUnnamed("java.base", "sun.text.spi", false); ModuleSupport.exportAndOpenPackageToUnnamed("java.base", "jdk.internal.org.objectweb.asm", false); - if (JavaVersionUtil.JAVA_SPEC >= 16) { + if (JavaVersionUtil.JAVA_SPEC >= 17) { ModuleSupport.exportAndOpenPackageToUnnamed("java.base", "sun.reflect.annotation", false); ModuleSupport.exportAndOpenPackageToUnnamed("java.base", "sun.security.jca", false); ModuleSupport.exportAndOpenPackageToUnnamed("jdk.jdeps", "com.sun.tools.classfile", false); diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SVMHost.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SVMHost.java index 357e0d28d858..faa649e0e9b1 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SVMHost.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SVMHost.java @@ -391,9 +391,6 @@ private DynamicHub createHub(AnalysisType type) { */ String sourceFileName = stringTable.deduplicate(type.getSourceFileName(), true); - /* JDK 15 added support for Hidden Classes. Record if this javaClass is hidden. */ - boolean isHidden = SubstrateUtil.isHiddenClass(javaClass); - Class nestHost = null; if (JavaVersionUtil.JAVA_SPEC >= 11) { try { @@ -403,6 +400,7 @@ private DynamicHub createHub(AnalysisType type) { } } + boolean isHidden = SubstrateUtil.isHiddenClass(javaClass); boolean isRecord = RecordSupport.singleton().isRecord(javaClass); boolean assertionStatus = RuntimeAssertionsSupport.singleton().desiredAssertionStatus(javaClass); diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SecurityServicesFeature.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SecurityServicesFeature.java index 1c1aa6a8a8d8..770117823cab 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SecurityServicesFeature.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SecurityServicesFeature.java @@ -296,7 +296,7 @@ public void beforeAnalysis(BeforeAnalysisAccess access) { registerServiceReachabilityHandlers(access); } - if (JavaVersionUtil.JAVA_SPEC < 16) { + if (JavaVersionUtil.JAVA_SPEC <= 11) { // https://bugs.openjdk.java.net/browse/JDK-8235710 access.registerReachabilityHandler(SecurityServicesFeature::linkSunEC, method(access, "sun.security.ec.ECDSASignature", "signDigest", byte[].class, byte[].class, byte[].class, byte[].class, int.class), @@ -314,8 +314,8 @@ public void beforeAnalysis(BeforeAnalysisAccess access) { if (isWindows()) { access.registerReachabilityHandler(SecurityServicesFeature::registerSunMSCAPIConfig, clazz(access, "sun.security.mscapi.SunMSCAPI")); // statically linking sunmscapi conflicts with sunEC - // after the removal of sunEC in jdk 16, we can statically link sunmscapi - if (JavaVersionUtil.JAVA_SPEC >= 16) { + // after the removal of sunEC in jdk 17, we can statically link sunmscapi + if (JavaVersionUtil.JAVA_SPEC >= 17) { access.registerReachabilityHandler(SecurityServicesFeature::linkSunMSCAPI, clazz(access, "sun.security.mscapi.SunMSCAPI")); /* Resolve calls to sun_security_mscapi* as builtIn. */ PlatformNativeLibrarySupport.singleton().addBuiltinPkgNativePrefix("sun_security_mscapi"); @@ -736,10 +736,10 @@ private static void registerForReflection(Class clazz) { @SuppressWarnings("unchecked") private Function constructVerificationCacheCleaner() { /* - * Before JDK 16, the verification cache was a Provider -> Verification result + * For JDK 8 and JDK 11, the verification cache is a Provider -> Verification result * IdentityHashMap. */ - if (JavaVersionUtil.JAVA_SPEC <= 15) { + if (JavaVersionUtil.JAVA_SPEC <= 11) { return obj -> { Map original = (Map) obj; Map verificationResults = new IdentityHashMap<>(original); @@ -750,7 +750,7 @@ private Function constructVerificationCacheCleaner() { }; } /* - * For JDK 16 and later, the verification cache is an IdentityWrapper -> Verification result + * For JDK 17 and later, the verification cache is an IdentityWrapper -> Verification result * ConcurrentHashMap. The IdentityWrapper contains the actual provider in the 'obj' field. */ Class identityWrapper = loader.findClassOrFail("javax.crypto.JceSecurity$IdentityWrapper"); diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/analysis/DynamicHubInitializer.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/analysis/DynamicHubInitializer.java index 7919db92785d..760d97244dc6 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/analysis/DynamicHubInitializer.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/analysis/DynamicHubInitializer.java @@ -229,11 +229,11 @@ static class AnnotatedInterfacesEncodingKey { } /* - * JDK 12 introduced a broken implementation of hashCode() and equals() for the - * implementation classes of annotated types, leading to an infinite recursion. Tracked as - * JDK-8224012. As a workaround, we use shallow implementations that only depend on the - * identity hash code and reference equality. This is the same behavior as on JDK 8 and JDK - * 11 anyway. + * After JDK 11, the implementation of hashCode() and equals() for the implementation + * classes of annotated types can lead to the reification of generic bounds, which can lead + * to TypeNotPresentException when the class path is incomplete. Therefore, we use shallow + * implementations that only depend on the identity hash code and reference equality. This + * is the same behavior as on JDK 8 and JDK 11 anyway. */ @Override diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/sources/SourceCache.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/sources/SourceCache.java index 8fcbce1b5ca8..db79cf0e7819 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/sources/SourceCache.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/sources/SourceCache.java @@ -40,16 +40,16 @@ import java.util.HashMap; import java.util.List; -import com.oracle.svm.core.util.VMError; -import com.oracle.svm.util.ModuleSupport; import org.graalvm.compiler.serviceprovider.JavaVersionUtil; import org.graalvm.nativeimage.hosted.Feature; import com.oracle.svm.core.SubstrateOptions; import com.oracle.svm.core.annotate.AutomaticFeature; import com.oracle.svm.core.option.OptionUtils; +import com.oracle.svm.core.util.VMError; import com.oracle.svm.hosted.FeatureImpl; import com.oracle.svm.hosted.ImageClassLoader; +import com.oracle.svm.util.ModuleSupport; /** * An abstract cache manager for some subspace of the JDK, GraalVM or application source file space. @@ -107,7 +107,7 @@ private void addJDKSources() { assert javaHome != null; Path javaHomePath = Paths.get("", javaHome); Path srcZipPath; - if (JavaVersionUtil.JAVA_SPEC < 11) { + if (JavaVersionUtil.JAVA_SPEC <= 8) { Path srcZipDir = javaHomePath.getParent(); if (srcZipDir == null) { VMError.shouldNotReachHere("Cannot resolve parent directory of " + javaHome); diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JDKRegistrations.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JDKRegistrations.java index fc7f993d28d8..c1dc373bf787 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JDKRegistrations.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JDKRegistrations.java @@ -48,21 +48,18 @@ public void duringSetup(DuringSetupAccess a) { rerunClassInit(a, "java.lang.ProcessImpl", "java.lang.ProcessHandleImpl", "java.lang.ProcessHandleImpl$Info", "java.io.FilePermission"); } - if (JavaVersionUtil.JAVA_SPEC >= 15) { + if (JavaVersionUtil.JAVA_SPEC >= 17) { /* * Holds system and user library paths derived from the `java.library.path` and * `sun.boot.library.path` system properties. */ rerunClassInit(a, "jdk.internal.loader.NativeLibraries$LibraryPaths"); - } - if (JavaVersionUtil.JAVA_SPEC >= 16) { /* * Contains lots of state that is only available at run time: loads a native library, * stores a `Random` object and the temporary directory in a static final field. */ rerunClassInit(a, "sun.nio.ch.UnixDomainSockets"); - } - if (JavaVersionUtil.JAVA_SPEC >= 17) { + rerunClassInit(a, "java.util.concurrent.ThreadLocalRandom$ThreadLocalRandomProxy"); } diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JNIRegistrationJavaNet.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JNIRegistrationJavaNet.java index c0e2ba381a3e..d8252d5cbad5 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JNIRegistrationJavaNet.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JNIRegistrationJavaNet.java @@ -61,10 +61,12 @@ public void duringSetup(DuringSetupAccess a) { rerunClassInit(a, "java.net.DatagramPacket", "java.net.InetAddress", "java.net.NetworkInterface", "java.net.SocketInputStream", "java.net.SocketOutputStream", /* Caches networking properties. */ - "java.net.DefaultDatagramSocketImplFactory"); + "java.net.DefaultDatagramSocketImplFactory", + /* Stores a default SSLContext in a static field. */ + "javax.net.ssl.SSLContext"); if (isWindows()) { rerunClassInit(a, "java.net.DualStackPlainDatagramSocketImpl", "java.net.TwoStacksPlainDatagramSocketImpl"); - if (JavaVersionUtil.JAVA_SPEC < 11) { + if (JavaVersionUtil.JAVA_SPEC <= 8) { rerunClassInit(a, "java.net.DualStackPlainSocketImpl", "java.net.TwoStacksPlainSocketImpl", /* Caches networking properties. */ "java.net.PlainSocketImpl"); @@ -134,7 +136,7 @@ public void beforeAnalysis(BeforeAnalysisAccess a) { a.registerReachabilityHandler(JNIRegistrationJavaNet::registerDatagramPacketInit, method(a, "java.net.DatagramPacket", "init")); - if (JavaVersionUtil.JAVA_SPEC < 15) { + if (JavaVersionUtil.JAVA_SPEC <= 11) { a.registerReachabilityHandler(JNIRegistrationJavaNet::registerDatagramSocketCheckOldImpl, method(a, "java.net.DatagramSocket", "checkOldImpl")); } @@ -145,7 +147,7 @@ public void beforeAnalysis(BeforeAnalysisAccess a) { a.registerReachabilityHandler(JNIRegistrationJavaNet::registerPlainDatagramSocketImplSocketGetOption, method(a, "java.net." + plainDatagramSocketImpl, "socketGetOption", int.class)); - if (JavaVersionUtil.JAVA_SPEC < 11 || isPosix()) { + if (JavaVersionUtil.JAVA_SPEC <= 8 || isPosix()) { String plainSocketImpl = isWindows() ? "TwoStacksPlainSocketImpl" : "PlainSocketImpl"; a.registerReachabilityHandler(JNIRegistrationJavaNet::registerPlainSocketImplInitProto, method(a, "java.net." + plainSocketImpl, "initProto")); @@ -156,7 +158,7 @@ public void beforeAnalysis(BeforeAnalysisAccess a) { a.registerReachabilityHandler(JNIRegistrationJavaNet::registerDualStackPlainDatagramSocketImplInitIDs, method(a, "java.net.DualStackPlainDatagramSocketImpl", "initIDs")); - String dualStackPlainSocketImpl = JavaVersionUtil.JAVA_SPEC < 11 ? "DualStackPlainSocketImpl" : "PlainSocketImpl"; + String dualStackPlainSocketImpl = JavaVersionUtil.JAVA_SPEC <= 8 ? "DualStackPlainSocketImpl" : "PlainSocketImpl"; a.registerReachabilityHandler(JNIRegistrationJavaNet::registerDualStackPlainSocketImplInitIDs, method(a, "java.net." + dualStackPlainSocketImpl, "initIDs")); a.registerReachabilityHandler(JNIRegistrationJavaNet::registerDualStackPlainSocketImplLocalAddress, @@ -192,7 +194,7 @@ static void registerInitInetAddressIDs(DuringAnalysisAccess a) { /* Java_java_net_Inet6Address_init */ JNIRuntimeAccess.register(constructor(a, "java.net.Inet6Address")); JNIRuntimeAccess.register(fields(a, "java.net.Inet6Address", "holder6")); - if (JavaVersionUtil.JAVA_SPEC < 13) { // JDK-8216417 + if (JavaVersionUtil.JAVA_SPEC <= 11) { // JDK-8216417 Class c = clazz(a, "java.net.Inet6Address"); boolean optional = JavaVersionUtil.JAVA_SPEC == 11; // JDK-8269385 Field f = ReflectionUtil.lookupField(optional, c, "cached_scope_id"); diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JNIRegistrationJavaNio.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JNIRegistrationJavaNio.java index cde3bd53cf0f..3de0a1775c45 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JNIRegistrationJavaNio.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JNIRegistrationJavaNio.java @@ -86,9 +86,6 @@ public void beforeAnalysis(BeforeAnalysisAccess a) { if (isPosix()) { a.registerReachabilityHandler(registerServerSocketChannelImplInitIDs, method(a, "sun.nio.ch.UnixAsynchronousServerSocketChannelImpl", "initIDs")); } - } - - if (JavaVersionUtil.JAVA_SPEC < 13) { a.registerReachabilityHandler(JNIRegistrationJavaNio::registerDatagramChannelImplInitIDs, method(a, "sun.nio.ch.DatagramChannelImpl", "initIDs")); } else { // JDK-8220738 @@ -111,15 +108,17 @@ public void beforeAnalysis(BeforeAnalysisAccess a) { a.registerReachabilityHandler(JNIRegistrationJavaNio::registerConnectionCreateInetSocketAddress, method(a, "com.sun.jndi.ldap.Connection", "createInetSocketAddress", String.class, int.class)); Consumer registerInitInetAddressIDs = JNIRegistrationJavaNet::registerInitInetAddressIDs; - if (JavaVersionUtil.JAVA_SPEC < 9) { + if (JavaVersionUtil.JAVA_SPEC <= 8) { a.registerReachabilityHandler(registerInitInetAddressIDs, method(a, "sun.nio.ch.IOUtil", "initIDs")); } else { a.registerReachabilityHandler(registerInitInetAddressIDs, method(a, "sun.nio.ch.Net", "initIDs")); } - // In JDK 14, all of the Buffer classes require MemorySegmentProxy which is accessed via - // reflection - if (JavaVersionUtil.JAVA_SPEC >= 14) { + /* + * Starting with support for JDK 17, all of the Buffer classes require MemorySegmentProxy + * which is accessed via reflection. + */ + if (JavaVersionUtil.JAVA_SPEC >= 17) { RuntimeReflection.register(clazz(a, "jdk.internal.access.foreign.MemorySegmentProxy")); } } @@ -200,7 +199,7 @@ private static void registerWindowsNativeDispatcherInitIDs(DuringAnalysisAccess JNIRuntimeAccess.register(fields(a, "sun.nio.fs.WindowsNativeDispatcher$VolumeInformation", "fileSystemName", "volumeName", "volumeSerialNumber", "flags")); JNIRuntimeAccess.register(clazz(a, "sun.nio.fs.WindowsNativeDispatcher$DiskFreeSpace")); JNIRuntimeAccess.register(fields(a, "sun.nio.fs.WindowsNativeDispatcher$DiskFreeSpace", "freeBytesAvailable", "totalNumberOfBytes", "totalNumberOfFreeBytes")); - if (JavaVersionUtil.JAVA_SPEC >= 10) { + if (JavaVersionUtil.JAVA_SPEC >= 11) { JNIRuntimeAccess.register(fields(a, "sun.nio.fs.WindowsNativeDispatcher$DiskFreeSpace", "bytesPerSector")); } JNIRuntimeAccess.register(clazz(a, "sun.nio.fs.WindowsNativeDispatcher$Account")); diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JNIRegistrationSupport.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JNIRegistrationSupport.java index 69f744d2f4bc..3a464b68ef45 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JNIRegistrationSupport.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JNIRegistrationSupport.java @@ -76,7 +76,7 @@ /** Registration of native JDK libraries. */ @Platforms(InternalPlatform.PLATFORM_JNI.class) @AutomaticFeature -class JNIRegistrationSupport extends JNIRegistrationUtil implements GraalFeature { +public final class JNIRegistrationSupport extends JNIRegistrationUtil implements GraalFeature { private final ConcurrentMap registeredLibraries = new ConcurrentHashMap<>(); private NativeLibraries nativeLibraries = null; @@ -103,7 +103,7 @@ public void registerGraphBuilderPlugins(Providers providers, Plugins plugins, Pa registerLoadLibraryPlugin(plugins, System.class); } - void registerLoadLibraryPlugin(Plugins plugins, Class clazz) { + public void registerLoadLibraryPlugin(Plugins plugins, Class clazz) { Registration r = new Registration(plugins.getInvocationPlugins(), clazz); r.register1("loadLibrary", String.class, new InvocationPlugin() { @Override diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/snippets/SubstrateGraphBuilderPlugins.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/snippets/SubstrateGraphBuilderPlugins.java index 40fac0f35a43..4434796ad51d 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/snippets/SubstrateGraphBuilderPlugins.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/snippets/SubstrateGraphBuilderPlugins.java @@ -667,7 +667,7 @@ private static boolean isValidField(Field targetField, boolean isSunMiscUnsafe) /* A NullPointerException will be thrown at run time for this call. */ return false; } - if (isSunMiscUnsafe && JavaVersionUtil.JAVA_SPEC >= 16 && + if (isSunMiscUnsafe && JavaVersionUtil.JAVA_SPEC >= 17 && (RecordSupport.singleton().isRecord(targetField.getDeclaringClass()) || SubstrateUtil.isHiddenClass(targetField.getDeclaringClass()))) { /* * After JDK 11, sun.misc.Unsafe performs a few more checks than diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/substitute/UnsafeAutomaticSubstitutionProcessor.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/substitute/UnsafeAutomaticSubstitutionProcessor.java index 903a2575b465..996e30b68b2e 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/substitute/UnsafeAutomaticSubstitutionProcessor.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/substitute/UnsafeAutomaticSubstitutionProcessor.java @@ -214,9 +214,9 @@ public void init(ImageClassLoader loader, MetaAccessProvider originalMetaAccess) neverInlineSet.add(unsafeObjectFieldOffsetClassStringMethod); } - if (JavaVersionUtil.JAVA_SPEC >= 15) { + if (JavaVersionUtil.JAVA_SPEC >= 17) { /* - * JDK 15 and later add checks for hidden classes and record classes in + * JDK 17 and later add checks for hidden classes and record classes in * sun.misc.Unsafe before delegating to jdk.internal.misc.Unsafe. When inlined, the * checks make control flow too complex to detect offset field assignments. */ @@ -426,7 +426,7 @@ private boolean isValidField(Invoke invoke, Field field, List unsuccessf } boolean valid = true; - if (JavaVersionUtil.JAVA_SPEC >= 15 && isInvokeTo(invoke, sunMiscUnsafeObjectFieldOffsetMethod)) { + if (JavaVersionUtil.JAVA_SPEC >= 17 && isInvokeTo(invoke, sunMiscUnsafeObjectFieldOffsetMethod)) { Class declaringClass = field.getDeclaringClass(); if (RecordSupport.singleton().isRecord(declaringClass)) { unsuccessfulReasons.add("The argument to sun.misc.Unsafe.objectFieldOffset(Field) is a field of a record."); diff --git a/substratevm/src/com.oracle.svm.jfr/src/com/oracle/svm/jfr/JfrEnabled.java b/substratevm/src/com.oracle.svm.jfr/src/com/oracle/svm/jfr/JfrEnabled.java index 35101f3a104b..e491abd834d1 100644 --- a/substratevm/src/com.oracle.svm.jfr/src/com/oracle/svm/jfr/JfrEnabled.java +++ b/substratevm/src/com.oracle.svm.jfr/src/com/oracle/svm/jfr/JfrEnabled.java @@ -45,7 +45,7 @@ public static boolean get() { } private static boolean jvmVersionSupported() { - return JavaVersionUtil.JAVA_SPEC == 11 || JavaVersionUtil.JAVA_SPEC == 16 || JavaVersionUtil.JAVA_SPEC == 17; + return JavaVersionUtil.JAVA_SPEC >= 11; } private static boolean osSupported() { diff --git a/substratevm/src/com.oracle.svm.jfr/src/com/oracle/svm/jfr/JfrTypeRepository.java b/substratevm/src/com.oracle.svm.jfr/src/com/oracle/svm/jfr/JfrTypeRepository.java index 17ee27da460a..81221bc959ed 100644 --- a/substratevm/src/com.oracle.svm.jfr/src/com/oracle/svm/jfr/JfrTypeRepository.java +++ b/substratevm/src/com.oracle.svm.jfr/src/com/oracle/svm/jfr/JfrTypeRepository.java @@ -29,12 +29,13 @@ import java.util.Map; import java.util.Set; +import org.graalvm.compiler.serviceprovider.JavaVersionUtil; import org.graalvm.nativeimage.Platform; import org.graalvm.nativeimage.Platforms; +import com.oracle.svm.core.SubstrateUtil; import com.oracle.svm.core.annotate.Uninterruptible; import com.oracle.svm.core.heap.Heap; -import com.oracle.svm.core.jdk.HiddenClassSupport; import com.oracle.svm.jfr.traceid.JfrTraceId; /** @@ -121,8 +122,8 @@ private static void writeClass(JfrChunkWriter writer, TypeInfo typeInfo, Class= 17) { + writer.writeBoolean(SubstrateUtil.isHiddenClass(clazz)); } } diff --git a/substratevm/src/com.oracle.svm.jfr/src/com/oracle/svm/jfr/Target_jdk_jfr_internal_JVM.java b/substratevm/src/com.oracle.svm.jfr/src/com/oracle/svm/jfr/Target_jdk_jfr_internal_JVM.java index b8f25658f94f..48d3bbcb4d27 100644 --- a/substratevm/src/com.oracle.svm.jfr/src/com/oracle/svm/jfr/Target_jdk_jfr_internal_JVM.java +++ b/substratevm/src/com.oracle.svm.jfr/src/com/oracle/svm/jfr/Target_jdk_jfr_internal_JVM.java @@ -35,10 +35,7 @@ import com.oracle.svm.core.annotate.TargetClass; import com.oracle.svm.core.annotate.TargetElement; import com.oracle.svm.core.jdk.JDK11OrEarlier; -import com.oracle.svm.core.jdk.JDK14OrEarlier; -import com.oracle.svm.core.jdk.JDK14OrLater; -import com.oracle.svm.core.jdk.JDK15OrLater; -import com.oracle.svm.core.jdk.JDK16OrEarlier; +import com.oracle.svm.core.jdk.JDK17OrLater; import com.oracle.svm.core.util.VMError; import com.oracle.svm.jfr.traceid.JfrTraceId; @@ -94,7 +91,7 @@ public void endRecording() { /** See {@link JVM#isRecording}. */ @Substitute - @TargetElement(onlyWith = JDK14OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) public boolean isRecording() { return SubstrateJVM.get().unsafeIsRecording(); } @@ -119,7 +116,7 @@ public static long getClassId(Class clazz) { /** See JVM.getClassIdNonIntrinsic(Class). */ @Substitute - @TargetElement(onlyWith = JDK16OrEarlier.class) + @TargetElement(onlyWith = JDK11OrEarlier.class) public static long getClassIdNonIntrinsic(Class clazz) { return getClassId(clazz); } @@ -288,13 +285,13 @@ public double getTimeConversionFactor() { /** See {@link SubstrateJVM#getChunkStartNanos}. */ @Substitute - @TargetElement(onlyWith = JDK14OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) public long getChunkStartNanos() { return SubstrateJVM.get().getChunkStartNanos(); } @Substitute - @TargetElement(onlyWith = JDK15OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) public boolean setHandler(Class eventClass, EventHandler handler) { // eventHandler fields should all be set at compile time so this method // should never be reached at runtime @@ -303,7 +300,7 @@ public boolean setHandler(Class eventClass, /** See {@link SubstrateJVM#getHandler}. */ @Substitute - @TargetElement(onlyWith = JDK15OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) public Object getHandler(Class eventClass) { return SubstrateJVM.getHandler(eventClass); } @@ -359,14 +356,14 @@ public boolean setCutoff(long eventTypeId, long cutoffTicks) { /** See {@link JVM#emitOldObjectSamples}. */ @Substitute - @TargetElement(onlyWith = JDK14OrEarlier.class) // + @TargetElement(onlyWith = JDK11OrEarlier.class) // public void emitOldObjectSamples(long cutoff, boolean emitAll) { // Not supported but this method is called during JFR shutdown, so we can't throw an error. } /** See {@link JVM#emitOldObjectSamples}. */ @Substitute - @TargetElement(onlyWith = JDK15OrLater.class) // + @TargetElement(onlyWith = JDK17OrLater.class) // public void emitOldObjectSamples(long cutoff, boolean emitAll, boolean skipBFS) { // Not supported but this method is called during JFR shutdown, so we can't throw an error. } @@ -379,32 +376,32 @@ public boolean shouldRotateDisk() { /** See {@link JVM#flush}. */ @Substitute - @TargetElement(onlyWith = JDK14OrLater.class) // + @TargetElement(onlyWith = JDK17OrLater.class) // public void flush() { // Temporarily do nothing. This is used for JFR streaming. } @Substitute - @TargetElement(onlyWith = JDK14OrLater.class) // + @TargetElement(onlyWith = JDK17OrLater.class) // public void include(Thread thread) { // Temporarily do nothing. This is used for JFR streaming. } @Substitute - @TargetElement(onlyWith = JDK14OrLater.class) // + @TargetElement(onlyWith = JDK17OrLater.class) // public void exclude(Thread thread) { // Temporarily do nothing. This is used for JFR streaming. } @Substitute - @TargetElement(onlyWith = JDK14OrLater.class) // + @TargetElement(onlyWith = JDK17OrLater.class) // public boolean isExcluded(Thread thread) { // Temporarily do nothing. This is used for JFR streaming. return false; } @Substitute - @TargetElement(onlyWith = JDK14OrLater.class) // + @TargetElement(onlyWith = JDK17OrLater.class) // public void markChunkFinal() { // Temporarily do nothing. This is used for JFR streaming. } diff --git a/substratevm/src/com.oracle.svm.jfr/src/com/oracle/svm/jfr/logging/JfrLogConfiguration.java b/substratevm/src/com.oracle.svm.jfr/src/com/oracle/svm/jfr/logging/JfrLogConfiguration.java index 836ef94d2494..46efae8dcc33 100644 --- a/substratevm/src/com.oracle.svm.jfr/src/com/oracle/svm/jfr/logging/JfrLogConfiguration.java +++ b/substratevm/src/com.oracle.svm.jfr/src/com/oracle/svm/jfr/logging/JfrLogConfiguration.java @@ -112,21 +112,13 @@ private static Map> createLogTagSets() { result.put(LogTag.JFR_SETTING, EnumSet.of(JfrLogTag.JFR, JfrLogTag.SETTING)); result.put(LogTag.JFR_DCMD, EnumSet.of(JfrLogTag.JFR, JfrLogTag.DCMD)); - // JDK16 support - if (JavaVersionUtil.JAVA_SPEC >= 16) { + // JDK17 support + if (JavaVersionUtil.JAVA_SPEC >= 17) { try { LogTag jfrSystemStreaming = Enum.valueOf(LogTag.class, "JFR_SYSTEM_STREAMING"); LogTag jfrSystemThrottle = Enum.valueOf(LogTag.class, "JFR_SYSTEM_THROTTLE"); result.put(jfrSystemStreaming, EnumSet.of(JfrLogTag.JFR, JfrLogTag.SYSTEM, JfrLogTag.STREAMING)); result.put(jfrSystemThrottle, EnumSet.of(JfrLogTag.JFR, JfrLogTag.SYSTEM, JfrLogTag.THROTTLE)); - } catch (IllegalArgumentException | NullPointerException e) { - throw VMError.shouldNotReachHere("Should be defined", e); - } - } - - // JDK17 support - if (JavaVersionUtil.JAVA_SPEC >= 17) { - try { LogTag jfrStart = Enum.valueOf(LogTag.class, "JFR_START"); result.put(jfrStart, EnumSet.of(JfrLogTag.JFR, JfrLogTag.START)); } catch (IllegalArgumentException | NullPointerException e) { diff --git a/substratevm/src/com.oracle.svm.methodhandles/src/com/oracle/svm/methodhandles/MethodHandleFeature.java b/substratevm/src/com.oracle.svm.methodhandles/src/com/oracle/svm/methodhandles/MethodHandleFeature.java index f2537e0e2ffc..5089c3b4dfcf 100644 --- a/substratevm/src/com.oracle.svm.methodhandles/src/com/oracle/svm/methodhandles/MethodHandleFeature.java +++ b/substratevm/src/com.oracle.svm.methodhandles/src/com/oracle/svm/methodhandles/MethodHandleFeature.java @@ -189,7 +189,7 @@ private static void registerMHImplFunctionsForReflection(DuringAnalysisAccess ac private static void registerMHImplConstantHandlesForReflection(DuringAnalysisAccess access) { Class mhImplClazz = access.findClassByName("java.lang.invoke.MethodHandleImpl"); - if (JavaVersionUtil.JAVA_SPEC <= 16) { + if (JavaVersionUtil.JAVA_SPEC <= 11) { RuntimeReflection.register(ReflectionUtil.lookupMethod(mhImplClazz, "copyAsPrimitiveArray", access.findClassByName("sun.invoke.util.Wrapper"), Object[].class)); RuntimeReflection.register(ReflectionUtil.lookupMethod(mhImplClazz, "identity", Object[].class)); RuntimeReflection.register(ReflectionUtil.lookupMethod(mhImplClazz, "fillNewArray", Integer.class, Object[].class)); diff --git a/substratevm/src/com.oracle.svm.methodhandles/src/com/oracle/svm/methodhandles/Target_java_lang_invoke_MethodHandleNatives.java b/substratevm/src/com.oracle.svm.methodhandles/src/com/oracle/svm/methodhandles/Target_java_lang_invoke_MethodHandleNatives.java index 71754cac83f6..2dc0fdb0ffa7 100644 --- a/substratevm/src/com.oracle.svm.methodhandles/src/com/oracle/svm/methodhandles/Target_java_lang_invoke_MethodHandleNatives.java +++ b/substratevm/src/com.oracle.svm.methodhandles/src/com/oracle/svm/methodhandles/Target_java_lang_invoke_MethodHandleNatives.java @@ -54,9 +54,9 @@ import com.oracle.svm.core.invoke.MethodHandleUtils.MethodHandlesNotSupported; import com.oracle.svm.core.invoke.MethodHandleUtils.MethodHandlesSupported; import com.oracle.svm.core.invoke.Target_java_lang_invoke_MemberName; +import com.oracle.svm.core.jdk.JDK11OrEarlier; import com.oracle.svm.core.jdk.JDK11OrLater; -import com.oracle.svm.core.jdk.JDK15OrEarlier; -import com.oracle.svm.core.jdk.JDK16OrLater; +import com.oracle.svm.core.jdk.JDK17OrLater; import com.oracle.svm.core.jdk.JDK8OrEarlier; import com.oracle.svm.reflect.target.Target_java_lang_reflect_Field; @@ -209,7 +209,7 @@ private static Object getMemberVMInfo(Target_java_lang_invoke_MemberName self) { // JDK 11 @Substitute - @TargetElement(onlyWith = {JDK11OrLater.class, JDK15OrEarlier.class}) + @TargetElement(onlyWith = {JDK11OrLater.class, JDK11OrEarlier.class}) static Target_java_lang_invoke_MemberName resolve(Target_java_lang_invoke_MemberName self, Class caller, boolean speculativeResolve) throws LinkageError, ClassNotFoundException { return Util_java_lang_invoke_MethodHandleNatives.resolve(self, caller, speculativeResolve); } @@ -230,9 +230,10 @@ private static void clearCallSiteContext(Target_java_lang_invoke_MethodHandleNat @AnnotateOriginal static native String refKindName(byte refKind); - // JDK 16 + // JDK 17 + @Substitute - @TargetElement(onlyWith = JDK16OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) static Target_java_lang_invoke_MemberName resolve(Target_java_lang_invoke_MemberName self, Class caller, int lookupMode, boolean speculativeResolve) throws LinkageError, ClassNotFoundException { Class declaringClass = self.getDeclaringClass(); @@ -353,7 +354,7 @@ public static Target_java_lang_invoke_MemberName resolve(Target_java_lang_invoke private static Method verifyAccess; static boolean verifyAccess(Class refc, Class defc, int mods, Class lookupClass, int allowedModes) { - assert JavaVersionUtil.JAVA_SPEC >= 16; + assert JavaVersionUtil.JAVA_SPEC >= 17; if (verifyAccess == null) { try { verifyAccess = VerifyAccess.class.getDeclaredMethod("isMemberAccessible", Class.class, Class.class, int.class, Class.class, Class.class, int.class); @@ -458,7 +459,7 @@ final class Target_java_lang_invoke_MethodHandleNatives_NotSupported { // JDK 11 @Delete - @TargetElement(onlyWith = {JDK11OrLater.class, JDK15OrEarlier.class}) + @TargetElement(onlyWith = {JDK11OrLater.class, JDK11OrEarlier.class}) private static native Target_java_lang_invoke_MemberName_NotSupported resolve(Target_java_lang_invoke_MemberName_NotSupported self, Class caller, boolean speculativeResolve) throws LinkageError, ClassNotFoundException; @@ -470,10 +471,10 @@ private static native Target_java_lang_invoke_MemberName_NotSupported resolve(Ta @TargetElement(onlyWith = JDK11OrLater.class) private static native void clearCallSiteContext(Target_java_lang_invoke_MethodHandleNatives_CallSiteContext context); - // JDK 16 + // JDK 17 @Delete - @TargetElement(onlyWith = JDK16OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) private static native Target_java_lang_invoke_MemberName_NotSupported resolve(Target_java_lang_invoke_MemberName_NotSupported self, Class caller, int lookupMode, boolean speculativeResolve) throws LinkageError, ClassNotFoundException; } diff --git a/substratevm/src/com.oracle.svm.methodhandles/src/com/oracle/svm/methodhandles/Target_java_lang_invoke_MethodHandles_Lookup.java b/substratevm/src/com.oracle.svm.methodhandles/src/com/oracle/svm/methodhandles/Target_java_lang_invoke_MethodHandles_Lookup.java index 2e5f4b55e697..81fc6211d2e7 100644 --- a/substratevm/src/com.oracle.svm.methodhandles/src/com/oracle/svm/methodhandles/Target_java_lang_invoke_MethodHandles_Lookup.java +++ b/substratevm/src/com.oracle.svm.methodhandles/src/com/oracle/svm/methodhandles/Target_java_lang_invoke_MethodHandles_Lookup.java @@ -37,9 +37,9 @@ import com.oracle.svm.core.hub.DynamicHub; import com.oracle.svm.core.invoke.MethodHandleUtils.MethodHandlesSupported; import com.oracle.svm.core.invoke.Target_java_lang_invoke_MemberName; -import com.oracle.svm.core.jdk.JDK11_0_10OrEarlier; -import com.oracle.svm.core.jdk.JDK11_0_11OrLater; -import com.oracle.svm.core.jdk.JDK15OrLater; +import com.oracle.svm.core.jdk.JDK11OrLater; +import com.oracle.svm.core.jdk.JDK17OrLater; +import com.oracle.svm.core.jdk.JDK8OrEarlier; @TargetClass(value = MethodHandles.class, innerClass = "Lookup", onlyWith = MethodHandlesSupported.class) final class Target_java_lang_invoke_MethodHandles_Lookup { @@ -51,7 +51,7 @@ public Class defineClass(@SuppressWarnings("unused") byte[] bytes) { @SuppressWarnings({"static-method", "unused"}) @Substitute - @TargetElement(onlyWith = JDK11_0_10OrEarlier.class) + @TargetElement(onlyWith = JDK8OrEarlier.class) private MethodHandle maybeBindCaller(Target_java_lang_invoke_MemberName method, MethodHandle mh, Class boundCallerClass) throws IllegalAccessException { @@ -61,7 +61,7 @@ private MethodHandle maybeBindCaller(Target_java_lang_invoke_MemberName method, @SuppressWarnings({"static-method", "unused"}) @Substitute - @TargetElement(onlyWith = JDK11_0_11OrLater.class) + @TargetElement(onlyWith = JDK11OrLater.class) private MethodHandle maybeBindCaller(Target_java_lang_invoke_MemberName method, MethodHandle mh, Target_java_lang_invoke_MethodHandles_Lookup boundCaller) throws IllegalAccessException { @@ -70,19 +70,19 @@ private MethodHandle maybeBindCaller(Target_java_lang_invoke_MemberName method, } @Alias // - @TargetElement(onlyWith = JDK15OrLater.class) // + @TargetElement(onlyWith = JDK17OrLater.class) // private Class lookupClass; @Alias // - @TargetElement(onlyWith = JDK15OrLater.class) // + @TargetElement(onlyWith = JDK17OrLater.class) // private Class prevLookupClass; @Alias // - @TargetElement(onlyWith = JDK15OrLater.class) // + @TargetElement(onlyWith = JDK17OrLater.class) // private int allowedModes; @Substitute - @TargetElement(onlyWith = JDK15OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) private IllegalAccessException makeAccessException(Class targetClass) { String message = "access violation: " + targetClass; if (this == SubstrateUtil.cast(MethodHandles.publicLookup(), Target_java_lang_invoke_MethodHandles_Lookup.class)) { @@ -101,7 +101,7 @@ private IllegalAccessException makeAccessException(Class targetClass) { /** This call is a noop without the security manager. */ @SuppressWarnings("unused") @Substitute - @TargetElement(onlyWith = JDK15OrLater.class) + @TargetElement(onlyWith = JDK17OrLater.class) void checkSecurityManager(Class refc) { } } diff --git a/substratevm/src/com.oracle.svm.reflect/src/com/oracle/svm/reflect/target/Target_java_lang_reflect_AccessibleObject.java b/substratevm/src/com.oracle.svm.reflect/src/com/oracle/svm/reflect/target/Target_java_lang_reflect_AccessibleObject.java index ddb9b80dbb93..44c24aefd6e9 100644 --- a/substratevm/src/com.oracle.svm.reflect/src/com/oracle/svm/reflect/target/Target_java_lang_reflect_AccessibleObject.java +++ b/substratevm/src/com.oracle.svm.reflect/src/com/oracle/svm/reflect/target/Target_java_lang_reflect_AccessibleObject.java @@ -34,7 +34,7 @@ import com.oracle.svm.core.annotate.TargetElement; import com.oracle.svm.core.jdk.JDK11OrEarlier; import com.oracle.svm.core.jdk.JDK11OrLater; -import com.oracle.svm.core.jdk.JDK16OrLater; +import com.oracle.svm.core.jdk.JDK17OrLater; @TargetClass(value = AccessibleObject.class) public final class Target_java_lang_reflect_AccessibleObject { @@ -46,7 +46,7 @@ public final class Target_java_lang_reflect_AccessibleObject { volatile Object securityCheckCache; @Alias @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset) // - @TargetElement(onlyWith = JDK16OrLater.class) // + @TargetElement(onlyWith = JDK17OrLater.class) // volatile Object accessCheckCache; @Alias // diff --git a/substratevm/src/com.oracle.svm.test/src/com/oracle/svm/test/GitHub1398.java b/substratevm/src/com.oracle.svm.test/src/com/oracle/svm/test/GitHub1398.java index 94e970d10946..dbec84589cc0 100644 --- a/substratevm/src/com.oracle.svm.test/src/com/oracle/svm/test/GitHub1398.java +++ b/substratevm/src/com.oracle.svm.test/src/com/oracle/svm/test/GitHub1398.java @@ -38,7 +38,7 @@ public class GitHub1398 { public static final int PORT = 6789; - @SuppressWarnings("deprecation") // joinGroup deprecated since JDK 14 + @SuppressWarnings("deprecation") // joinGroup is deprecated after JDK 11 @Test public void testMulticast() { try {