Skip to content

Commit 1f70504

Browse files
committed
svm: replace JDK23OrLater with JDKLatest
1 parent e39c7cc commit 1f70504

17 files changed

+113
-109
lines changed

substratevm/src/com.oracle.svm.core.foreign/src/com/oracle/svm/core/foreign/Target_jdk_internal_misc_ScopedMemoryAccess.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import com.oracle.svm.core.annotate.TargetClass;
3131
import com.oracle.svm.core.annotate.TargetElement;
3232
import com.oracle.svm.core.jdk.JDK21OrEarlier;
33-
import com.oracle.svm.core.jdk.JDK23OrLater;
33+
import com.oracle.svm.core.jdk.JDKLatest;
3434

3535
import jdk.internal.foreign.MemorySessionImpl;
3636

@@ -68,7 +68,7 @@ static void registerNatives() {
6868
* As one might notice, what is not supported is not creating shared arenas, but closing them.
6969
*/
7070
@Substitute
71-
@TargetElement(onlyWith = JDK23OrLater.class)
71+
@TargetElement(onlyWith = JDKLatest.class)
7272
void closeScope0(MemorySessionImpl session, Target_jdk_internal_misc_ScopedMemoryAccess_ScopedAccessError error) {
7373
throw unsupportedFeature("GR-52276: Arena.ofShared not supported");
7474
}
@@ -80,6 +80,6 @@ boolean closeScope0(MemorySessionImpl session) {
8080
}
8181
}
8282

83-
@TargetClass(className = "jdk.internal.misc.ScopedMemoryAccess$ScopedAccessError", onlyWith = {JDK23OrLater.class, ForeignFunctionsEnabled.class})
83+
@TargetClass(className = "jdk.internal.misc.ScopedMemoryAccess$ScopedAccessError", onlyWith = {JDKLatest.class, ForeignFunctionsEnabled.class})
8484
final class Target_jdk_internal_misc_ScopedMemoryAccess_ScopedAccessError {
8585
}

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHub.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
import com.oracle.svm.core.heap.UnknownObjectField;
105105
import com.oracle.svm.core.heap.UnknownPrimitiveField;
106106
import com.oracle.svm.core.jdk.JDK21OrEarlier;
107-
import com.oracle.svm.core.jdk.JDK23OrLater;
107+
import com.oracle.svm.core.jdk.JDKLatest;
108108
import com.oracle.svm.core.jdk.Resources;
109109
import com.oracle.svm.core.meta.SharedType;
110110
import com.oracle.svm.core.reflect.MissingReflectionRegistrationUtils;
@@ -1494,7 +1494,7 @@ private static Class<?> forName(String name, boolean initialize, ClassLoader loa
14941494
}
14951495

14961496
@KeepOriginal
1497-
@TargetElement(onlyWith = JDK23OrLater.class)
1497+
@TargetElement(onlyWith = JDKLatest.class)
14981498
public static native Class<?> forPrimitiveName(String primitiveName);
14991499

15001500
@KeepOriginal
@@ -1539,11 +1539,11 @@ public String toString() {
15391539
public native String toGenericString();
15401540

15411541
@KeepOriginal
1542-
@TargetElement(onlyWith = JDK23OrLater.class)
1542+
@TargetElement(onlyWith = JDKLatest.class)
15431543
private native void addSealingInfo(int modifiersParam, StringBuilder sb);
15441544

15451545
@KeepOriginal
1546-
@TargetElement(onlyWith = JDK23OrLater.class)
1546+
@TargetElement(onlyWith = JDKLatest.class)
15471547
private native boolean hasSealedAncestor(Class<?> clazz);
15481548

15491549
@KeepOriginal
@@ -1869,7 +1869,7 @@ private Class<?>[] getPermittedSubclasses0() {
18691869
private native GenericsFactory getFactory();
18701870

18711871
@KeepOriginal
1872-
@TargetElement(onlyWith = JDK23OrLater.class)
1872+
@TargetElement(onlyWith = JDKLatest.class)
18731873
native Method findMethod(boolean publicOnly, String nameParam, Class<?>... parameterTypes);
18741874

18751875
@KeepOriginal
@@ -1883,7 +1883,7 @@ private Class<?>[] getPermittedSubclasses0() {
18831883
private native Target_java_lang_PublicMethods_MethodList getMethodsRecursive(String methodName, Class<?>[] parameterTypes, boolean includeStatic);
18841884

18851885
@KeepOriginal
1886-
@TargetElement(onlyWith = JDK23OrLater.class)
1886+
@TargetElement(onlyWith = JDKLatest.class)
18871887
private native Target_java_lang_PublicMethods_MethodList getMethodsRecursive(String methodName, Class<?>[] parameterTypes, boolean includeStatic, boolean publicOnly);
18881888

18891889
@KeepOriginal
@@ -2136,7 +2136,7 @@ public FieldAccessor newFieldAccessor(Field field0, boolean override) {
21362136
* @see Target_jdk_internal_reflect_DirectConstructorHandleAccessor
21372137
*/
21382138
@Substitute
2139-
@TargetElement(onlyWith = JDK23OrLater.class)
2139+
@TargetElement(onlyWith = JDKLatest.class)
21402140
@Fold // cut off the alternative branch, already during analysis
21412141
static boolean useOldSerializableConstructor() {
21422142
return true;

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/ForeignDisabledSubstitutions.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ final class Target_jdk_internal_foreign_FunctionDescriptorImpl {
117117
final class Target_java_lang_foreign_FunctionDescriptor {
118118
}
119119

120-
@TargetClass(className = "jdk.internal.foreign.SegmentFactories", onlyWith = {ForeignDisabled.class, JDK23OrLater.class})
120+
@TargetClass(className = "jdk.internal.foreign.SegmentFactories", onlyWith = {ForeignDisabled.class, JDKLatest.class})
121121
final class Target_jdk_internal_foreign_SegmentFactories {
122122
@Substitute
123123
@AlwaysInline("Make remaining code in callers unreachable.")
@@ -143,7 +143,7 @@ final class Target_jdk_internal_foreign_LayoutPath {
143143
final class Target_java_lang_foreign_MemoryLayout_PathElement {
144144
}
145145

146-
@TargetClass(className = "jdk.internal.foreign.layout.AbstractLayout", onlyWith = {ForeignDisabled.class, JDK23OrLater.class})
146+
@TargetClass(className = "jdk.internal.foreign.layout.AbstractLayout", onlyWith = {ForeignDisabled.class, JDKLatest.class})
147147
final class Target_jdk_internal_foreign_layout_AbstractLayout {
148148
@Substitute
149149
@AlwaysInline("Make remaining code in callers unreachable.")
@@ -153,7 +153,7 @@ VarHandle varHandle(Target_java_lang_foreign_MemoryLayout_PathElement... element
153153
}
154154

155155
@Substitute
156-
@TargetElement(onlyWith = JDK23OrLater.class)
156+
@TargetElement(onlyWith = JDKLatest.class)
157157
@SuppressWarnings({"unused", "static-method"})
158158
VarHandle varHandleInternal(Target_java_lang_foreign_MemoryLayout_PathElement... elements) {
159159
throw ForeignDisabledSubstitutions.fail();

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK23OrLater.java renamed to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDKLatest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,13 @@
2828

2929
import jdk.graal.compiler.serviceprovider.JavaVersionUtil;
3030

31-
public class JDK23OrLater implements BooleanSupplier {
31+
/**
32+
* Denotes the latest supported JDK version. It corresponds to the highest key in the
33+
* {@code JVMCI_MIN_VERSIONS} map in {@link jdk.graal.compiler.hotspot.JVMCIVersionCheck}.
34+
*/
35+
public class JDKLatest implements BooleanSupplier {
3236
@Override
3337
public boolean getAsBoolean() {
34-
return JavaVersionUtil.JAVA_SPEC >= 23;
38+
return JavaVersionUtil.JAVA_SPEC > 21;
3539
}
3640
}

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JavaLangSubstitutions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ final class Target_java_lang_StringUTF16 {
219219
final class Target_java_lang_Throwable {
220220

221221
@Alias //
222-
@TargetElement(onlyWith = JDK23OrLater.class) //
222+
@TargetElement(onlyWith = JDKLatest.class) //
223223
@RecomputeFieldValue(kind = Kind.FromAlias, isFinal = true) //
224224
static boolean jfrTracing = false;
225225

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/RecomputedFields.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ private static synchronized ForkJoinPool initializeCommonPool() {
311311
}
312312
}
313313

314-
@TargetClass(value = java.util.concurrent.ForkJoinPool.class, innerClass = "DefaultForkJoinWorkerThreadFactory", onlyWith = JDK23OrLater.class)
314+
@TargetClass(value = java.util.concurrent.ForkJoinPool.class, innerClass = "DefaultForkJoinWorkerThreadFactory", onlyWith = JDKLatest.class)
315315
@SuppressWarnings("removal")
316316
final class Target_java_util_concurrent_ForkJoinPool_DefaultForkJoinWorkerThreadFactory {
317317
@Alias @RecomputeFieldValue(kind = Reset) //

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_java_lang_Module.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public boolean isNativeAccessEnabled() {
5252
public native void ensureNativeAccess(Class<?> owner, String methodName);
5353

5454
@Alias
55-
@TargetElement(onlyWith = JDK23OrLater.class)
55+
@TargetElement(onlyWith = JDKLatest.class)
5656
public native void ensureNativeAccess(Class<?> owner, String methodName, Class<?> currentClass);
5757

5858
@Substitute

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/VarHandleSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ final class Target_java_lang_invoke_DirectMethodHandle_StaticAccessor {
372372
long staticOffset;
373373
}
374374

375-
@TargetClass(className = "java.lang.invoke.LazyInitializingVarHandle", onlyWith = JDK23OrLater.class)
375+
@TargetClass(className = "java.lang.invoke.LazyInitializingVarHandle", onlyWith = JDKLatest.class)
376376
final class Target_java_lang_invoke_LazyInitializingVarHandle {
377377
@Alias @RecomputeFieldValue(isFinal = true, kind = RecomputeFieldValue.Kind.None) //
378378
Class<?> refc;

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/xml/Target_jdk_xml_internal_JdkCatalog.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import com.oracle.svm.core.annotate.RecomputeFieldValue;
3333
import com.oracle.svm.core.annotate.Substitute;
3434
import com.oracle.svm.core.annotate.TargetClass;
35-
import com.oracle.svm.core.jdk.JDK23OrLater;
35+
import com.oracle.svm.core.jdk.JDKLatest;
3636
import com.oracle.svm.util.ReflectionUtil;
3737

3838
/**
@@ -46,7 +46,7 @@
4646
* Ideally, we would initialize all of {@code jdk.xml} at run time, but that is too intrusive at the
4747
* current point in time (GR-50683).
4848
*/
49-
@TargetClass(className = "jdk.xml.internal.JdkCatalog", onlyWith = JDK23OrLater.class)
49+
@TargetClass(className = "jdk.xml.internal.JdkCatalog", onlyWith = JDKLatest.class)
5050
public final class Target_jdk_xml_internal_JdkCatalog {
5151
@Alias //
5252
@RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Custom, declClass = JdkCatalogSupplier.class, isFinal = true) //
@@ -59,7 +59,7 @@ public static void init(String resolve) {
5959
}
6060
}
6161

62-
@TargetClass(className = "javax.xml.catalog.Catalog", onlyWith = JDK23OrLater.class)
62+
@TargetClass(className = "javax.xml.catalog.Catalog", onlyWith = JDKLatest.class)
6363
final class Target_javax_xml_catalog_Catalog {
6464
}
6565

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jfr/JfrJdkCompatibility.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import com.oracle.svm.core.annotate.TargetClass;
3737
import com.oracle.svm.core.annotate.TargetElement;
3838
import com.oracle.svm.core.jdk.JDK21OrEarlier;
39-
import com.oracle.svm.core.jdk.JDK23OrLater;
39+
import com.oracle.svm.core.jdk.JDKLatest;
4040
import com.oracle.svm.core.util.VMError;
4141
import com.oracle.svm.util.ReflectionUtil;
4242

@@ -133,13 +133,13 @@ final class Target_jdk_jfr_internal_Utils {
133133
public static native String formatTimespan(Duration dValue, String separation);
134134
}
135135

136-
@TargetClass(className = "jdk.jfr.internal.JVMSupport", onlyWith = {JDK23OrLater.class, HasJfrSupport.class})
136+
@TargetClass(className = "jdk.jfr.internal.JVMSupport", onlyWith = {JDKLatest.class, HasJfrSupport.class})
137137
final class Target_jdk_jfr_internal_JVMSupport {
138138
@Alias
139139
public static native String makeFilename(Recording recording);
140140
}
141141

142-
@TargetClass(className = "jdk.jfr.internal.util.ValueFormatter", onlyWith = {JDK23OrLater.class, HasJfrSupport.class})
142+
@TargetClass(className = "jdk.jfr.internal.util.ValueFormatter", onlyWith = {JDKLatest.class, HasJfrSupport.class})
143143
final class Target_jdk_jfr_internal_util_ValueFormatter {
144144
@Alias
145145
public static native String formatTimespan(Duration dValue, String separation);
@@ -148,7 +148,7 @@ final class Target_jdk_jfr_internal_util_ValueFormatter {
148148
@TargetClass(className = "jdk.jfr.internal.PlatformRecording")
149149
final class Target_jdk_jfr_internal_PlatformRecording {
150150
@Alias
151-
@TargetElement(onlyWith = JDK23OrLater.class)
151+
@TargetElement(onlyWith = JDKLatest.class)
152152
public native void setDumpDirectory(SecuritySupport.SafePath directory);
153153

154154
@Alias

0 commit comments

Comments
 (0)