Skip to content

Commit b211b3c

Browse files
committed
[GR-54918] Rename JDK23OrLater to JDKLatest and remove obsolete predicates
PullRequest: graal/18162
2 parents d8af8b8 + 1f70504 commit b211b3c

19 files changed

+123
-199
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.JDK22OrLater;
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 = JDK22OrLater.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 = {JDK22OrLater.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 & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +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.JDK22OrLater;
108-
import com.oracle.svm.core.jdk.JDK23OrLater;
107+
import com.oracle.svm.core.jdk.JDKLatest;
109108
import com.oracle.svm.core.jdk.Resources;
110109
import com.oracle.svm.core.meta.SharedType;
111110
import com.oracle.svm.core.reflect.MissingReflectionRegistrationUtils;
@@ -1495,7 +1494,7 @@ private static Class<?> forName(String name, boolean initialize, ClassLoader loa
14951494
}
14961495

14971496
@KeepOriginal
1498-
@TargetElement(onlyWith = JDK22OrLater.class)
1497+
@TargetElement(onlyWith = JDKLatest.class)
14991498
public static native Class<?> forPrimitiveName(String primitiveName);
15001499

15011500
@KeepOriginal
@@ -1540,11 +1539,11 @@ public String toString() {
15401539
public native String toGenericString();
15411540

15421541
@KeepOriginal
1543-
@TargetElement(onlyWith = JDK23OrLater.class)
1542+
@TargetElement(onlyWith = JDKLatest.class)
15441543
private native void addSealingInfo(int modifiersParam, StringBuilder sb);
15451544

15461545
@KeepOriginal
1547-
@TargetElement(onlyWith = JDK23OrLater.class)
1546+
@TargetElement(onlyWith = JDKLatest.class)
15481547
private native boolean hasSealedAncestor(Class<?> clazz);
15491548

15501549
@KeepOriginal
@@ -1870,7 +1869,7 @@ private Class<?>[] getPermittedSubclasses0() {
18701869
private native GenericsFactory getFactory();
18711870

18721871
@KeepOriginal
1873-
@TargetElement(onlyWith = JDK22OrLater.class)
1872+
@TargetElement(onlyWith = JDKLatest.class)
18741873
native Method findMethod(boolean publicOnly, String nameParam, Class<?>... parameterTypes);
18751874

18761875
@KeepOriginal
@@ -1884,7 +1883,7 @@ private Class<?>[] getPermittedSubclasses0() {
18841883
private native Target_java_lang_PublicMethods_MethodList getMethodsRecursive(String methodName, Class<?>[] parameterTypes, boolean includeStatic);
18851884

18861885
@KeepOriginal
1887-
@TargetElement(onlyWith = JDK22OrLater.class)
1886+
@TargetElement(onlyWith = JDKLatest.class)
18881887
private native Target_java_lang_PublicMethods_MethodList getMethodsRecursive(String methodName, Class<?>[] parameterTypes, boolean includeStatic, boolean publicOnly);
18891888

18901889
@KeepOriginal
@@ -2137,7 +2136,7 @@ public FieldAccessor newFieldAccessor(Field field0, boolean override) {
21372136
* @see Target_jdk_internal_reflect_DirectConstructorHandleAccessor
21382137
*/
21392138
@Substitute
2140-
@TargetElement(onlyWith = JDK22OrLater.class)
2139+
@TargetElement(onlyWith = JDKLatest.class)
21412140
@Fold // cut off the alternative branch, already during analysis
21422141
static boolean useOldSerializableConstructor() {
21432142
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, JDK22OrLater.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, JDK22OrLater.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/JDK22OrLater.java

Lines changed: 0 additions & 36 deletions
This file was deleted.

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

Lines changed: 0 additions & 36 deletions
This file was deleted.

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JDK22OrEarlier.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 JDK22OrEarlier 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 <= 22;
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 = JDK22OrLater.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 = JDK22OrLater.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.JDK22OrLater;
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 = JDK22OrLater.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 = JDK22OrLater.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: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +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.JDK22OrEarlier;
40-
import com.oracle.svm.core.jdk.JDK22OrLater;
41-
import com.oracle.svm.core.jdk.JDK23OrLater;
39+
import com.oracle.svm.core.jdk.JDKLatest;
4240
import com.oracle.svm.core.util.VMError;
4341
import com.oracle.svm.util.ReflectionUtil;
4442

@@ -135,13 +133,13 @@ final class Target_jdk_jfr_internal_Utils {
135133
public static native String formatTimespan(Duration dValue, String separation);
136134
}
137135

138-
@TargetClass(className = "jdk.jfr.internal.JVMSupport", onlyWith = {JDK22OrLater.class, HasJfrSupport.class})
136+
@TargetClass(className = "jdk.jfr.internal.JVMSupport", onlyWith = {JDKLatest.class, HasJfrSupport.class})
139137
final class Target_jdk_jfr_internal_JVMSupport {
140138
@Alias
141139
public static native String makeFilename(Recording recording);
142140
}
143141

144-
@TargetClass(className = "jdk.jfr.internal.util.ValueFormatter", onlyWith = {JDK22OrLater.class, HasJfrSupport.class})
142+
@TargetClass(className = "jdk.jfr.internal.util.ValueFormatter", onlyWith = {JDKLatest.class, HasJfrSupport.class})
145143
final class Target_jdk_jfr_internal_util_ValueFormatter {
146144
@Alias
147145
public static native String formatTimespan(Duration dValue, String separation);
@@ -150,10 +148,10 @@ final class Target_jdk_jfr_internal_util_ValueFormatter {
150148
@TargetClass(className = "jdk.jfr.internal.PlatformRecording")
151149
final class Target_jdk_jfr_internal_PlatformRecording {
152150
@Alias
153-
@TargetElement(onlyWith = JDK23OrLater.class)
151+
@TargetElement(onlyWith = JDKLatest.class)
154152
public native void setDumpDirectory(SecuritySupport.SafePath directory);
155153

156154
@Alias
157-
@TargetElement(onlyWith = JDK22OrEarlier.class)
155+
@TargetElement(onlyWith = JDK21OrEarlier.class)
158156
public native void setDumpOnExitDirectory(SecuritySupport.SafePath directory);
159157
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
package com.oracle.svm.core.jfr;
2828

2929
import com.oracle.svm.core.annotate.TargetClass;
30-
import com.oracle.svm.core.jdk.JDK23OrLater;
30+
import com.oracle.svm.core.jdk.JDKLatest;
3131

32-
@TargetClass(className = "jdk.jfr.internal.HiddenWait", onlyWith = {HasJfrSupport.class, JDK23OrLater.class})
32+
@TargetClass(className = "jdk.jfr.internal.HiddenWait", onlyWith = {HasJfrSupport.class, JDKLatest.class})
3333
public final class Target_jdk_jfr_internal_HiddenWait {
3434
}

0 commit comments

Comments
 (0)