@@ -370,19 +370,21 @@ public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Rec
370
370
private static void registerClassPlugins (Plugins plugins , GraalHotSpotVMConfig config , Replacements replacements ) {
371
371
Registration r = new Registration (plugins .getInvocationPlugins (), Class .class , replacements );
372
372
373
- r .register (new InvocationPlugin ("getModifiers" , Receiver .class ) {
374
- @ Override
375
- public boolean apply (GraphBuilderContext b , ResolvedJavaMethod targetMethod , Receiver receiver ) {
376
- try (HotSpotInvocationPluginHelper helper = new HotSpotInvocationPluginHelper (b , targetMethod , config )) {
377
- ValueNode klass = helper .readKlassFromClass (receiver .get (true ));
378
- // Primitive Class case
379
- ValueNode nonNullKlass = helper .emitNullReturnGuard (klass , ConstantNode .forInt (Modifier .ABSTRACT | Modifier .FINAL | Modifier .PUBLIC ), GraalDirectives .UNLIKELY_PROBABILITY );
380
- // other return Klass::_modifier_flags
381
- helper .emitFinalReturn (JavaKind .Int , helper .readKlassModifierFlags (nonNullKlass ));
373
+ if (JavaVersionUtil .JAVA_SPEC == 21 ) {
374
+ r .register (new InvocationPlugin ("getModifiers" , Receiver .class ) {
375
+ @ Override
376
+ public boolean apply (GraphBuilderContext b , ResolvedJavaMethod targetMethod , Receiver receiver ) {
377
+ try (HotSpotInvocationPluginHelper helper = new HotSpotInvocationPluginHelper (b , targetMethod , config )) {
378
+ ValueNode klass = helper .readKlassFromClass (receiver .get (true ));
379
+ // Primitive Class case
380
+ ValueNode nonNullKlass = helper .emitNullReturnGuard (klass , ConstantNode .forInt (Modifier .ABSTRACT | Modifier .FINAL | Modifier .PUBLIC ), GraalDirectives .UNLIKELY_PROBABILITY );
381
+ // other return Klass::_modifier_flags
382
+ helper .emitFinalReturn (JavaKind .Int , helper .readKlassModifierFlags (nonNullKlass ));
383
+ }
384
+ return true ;
382
385
}
383
- return true ;
384
- }
385
- });
386
+ });
387
+ }
386
388
r .register (new InvocationPlugin ("isInterface" , Receiver .class ) {
387
389
@ Override
388
390
public boolean apply (GraphBuilderContext b , ResolvedJavaMethod targetMethod , Receiver receiver ) {
0 commit comments