@@ -2408,7 +2408,10 @@ private InvokeQuickNode dispatchQuickened(int top, int curBCI, char cpi, int opc
2408
2408
// instruction throws an IncompatibleClassChangeError.
2409
2409
if (!resolved .isStatic ()) {
2410
2410
enterLinkageExceptionProfile ();
2411
- throw throwBoundary (getMethod ().getMeta ().java_lang_IncompatibleClassChangeError );
2411
+ throw throwBoundary (getMethod ().getMeta ().java_lang_IncompatibleClassChangeError , "Expected static method '%s.%s%s'" ,
2412
+ resolved .getDeclaringKlass ().getName (),
2413
+ resolved .getName (),
2414
+ resolved .getRawSignature ());
2412
2415
}
2413
2416
break ;
2414
2417
case INVOKEINTERFACE :
@@ -2417,7 +2420,10 @@ private InvokeQuickNode dispatchQuickened(int top, int curBCI, char cpi, int opc
2417
2420
if (resolved .isStatic () ||
2418
2421
(getMethod ().getContext ().getJavaVersion ().java8OrEarlier () && resolved .isPrivate ())) {
2419
2422
enterLinkageExceptionProfile ();
2420
- throw throwBoundary (getMethod ().getMeta ().java_lang_IncompatibleClassChangeError );
2423
+ throw throwBoundary (getMethod ().getMeta ().java_lang_IncompatibleClassChangeError , "Expected instance method '%s.%s%s'" ,
2424
+ resolved .getDeclaringKlass ().getName (),
2425
+ resolved .getName (),
2426
+ resolved .getRawSignature ());
2421
2427
}
2422
2428
if (resolved .getITableIndex () < 0 ) {
2423
2429
if (resolved .isPrivate ()) {
@@ -2435,7 +2441,10 @@ private InvokeQuickNode dispatchQuickened(int top, int curBCI, char cpi, int opc
2435
2441
// instruction throws an IncompatibleClassChangeError.
2436
2442
if (resolved .isStatic ()) {
2437
2443
enterLinkageExceptionProfile ();
2438
- throw throwBoundary (getMethod ().getMeta ().java_lang_IncompatibleClassChangeError );
2444
+ throw throwBoundary (getMethod ().getMeta ().java_lang_IncompatibleClassChangeError , "Expected instance not static method '%s.%s%s'" ,
2445
+ resolved .getDeclaringKlass ().getName (),
2446
+ resolved .getName (),
2447
+ resolved .getRawSignature ());
2439
2448
}
2440
2449
if (resolved .isFinalFlagSet () || resolved .getDeclaringKlass ().isFinalFlagSet () || resolved .isPrivate ()) {
2441
2450
resolvedOpCode = INVOKESPECIAL ;
@@ -2450,16 +2459,19 @@ private InvokeQuickNode dispatchQuickened(int top, int curBCI, char cpi, int opc
2450
2459
enterLinkageExceptionProfile ();
2451
2460
throw throwBoundary (getMethod ().getMeta ().java_lang_NoSuchMethodError ,
2452
2461
"%s.%s%s" ,
2453
- resolved .getDeclaringKlass ().getNameAsString (),
2454
- resolved .getNameAsString (),
2455
- resolved .getSignatureAsString ());
2462
+ resolved .getDeclaringKlass ().getName (),
2463
+ resolved .getName (),
2464
+ resolved .getRawSignature ());
2456
2465
}
2457
2466
}
2458
2467
// Otherwise, if the resolved method is a class (static) method, the invokespecial
2459
2468
// instruction throws an IncompatibleClassChangeError.
2460
2469
if (resolved .isStatic ()) {
2461
2470
enterLinkageExceptionProfile ();
2462
- throw throwBoundary (getMethod ().getMeta ().java_lang_IncompatibleClassChangeError );
2471
+ throw throwBoundary (getMethod ().getMeta ().java_lang_IncompatibleClassChangeError , "Expected instance not static method '%s.%s%s'" ,
2472
+ resolved .getDeclaringKlass ().getName (),
2473
+ resolved .getName (),
2474
+ resolved .getRawSignature ());
2463
2475
}
2464
2476
// If all of the following are true, let C be the direct superclass of the current
2465
2477
// class:
@@ -2536,8 +2548,8 @@ private RuntimeException throwBoundary(ObjectKlass exceptionKlass, String messag
2536
2548
}
2537
2549
2538
2550
@ TruffleBoundary
2539
- private RuntimeException throwBoundary (ObjectKlass exceptionKlass , String messageFormat , String ... args ) {
2540
- throw getMeta ().throwExceptionWithMessage (exceptionKlass , String .format (Locale .ENGLISH , messageFormat , ( Object []) args ));
2551
+ private RuntimeException throwBoundary (ObjectKlass exceptionKlass , String messageFormat , Object ... args ) {
2552
+ throw getMeta ().throwExceptionWithMessage (exceptionKlass , String .format (Locale .ENGLISH , messageFormat , args ));
2541
2553
}
2542
2554
2543
2555
private int quickenInvokeDynamic (final VirtualFrame frame , int top , int curBCI , int opcode ) {
@@ -2794,8 +2806,8 @@ private int putField(VirtualFrame frame, int top, Field field, int curBCI, int o
2794
2806
throw throwBoundary (getMethod ().getMeta ().java_lang_IncompatibleClassChangeError ,
2795
2807
"Expected %s field %s.%s" ,
2796
2808
(opcode == PUTSTATIC ) ? "static" : "non-static" ,
2797
- field .getDeclaringKlass ().getNameAsString (),
2798
- field .getNameAsString ());
2809
+ field .getDeclaringKlass ().getName (),
2810
+ field .getName ());
2799
2811
}
2800
2812
2801
2813
/*
@@ -2813,9 +2825,9 @@ private int putField(VirtualFrame frame, int top, Field field, int curBCI, int o
2813
2825
throw throwBoundary (getMethod ().getMeta ().java_lang_IllegalAccessError ,
2814
2826
"Update to %s final field %s.%s attempted from a different class (%s) than the field's declaring class" ,
2815
2827
(opcode == PUTSTATIC ) ? "static" : "non-static" ,
2816
- field .getDeclaringKlass ().getNameAsString (),
2817
- field .getNameAsString (),
2818
- getDeclaringKlass ().getNameAsString ());
2828
+ field .getDeclaringKlass ().getName (),
2829
+ field .getName (),
2830
+ getDeclaringKlass ().getName ());
2819
2831
}
2820
2832
2821
2833
boolean enforceInitializerCheck = (getLanguage ().getSpecComplianceMode () == STRICT ) ||
@@ -2829,9 +2841,9 @@ private int putField(VirtualFrame frame, int top, Field field, int curBCI, int o
2829
2841
throw throwBoundary (getMethod ().getMeta ().java_lang_IllegalAccessError ,
2830
2842
"Update to %s final field %s.%s attempted from a different method (%s) than the initializer method %s " ,
2831
2843
(opcode == PUTSTATIC ) ? "static" : "non-static" ,
2832
- field .getDeclaringKlass ().getNameAsString (),
2833
- field .getNameAsString (),
2834
- getMethod ().getNameAsString (),
2844
+ field .getDeclaringKlass ().getName (),
2845
+ field .getName (),
2846
+ getMethod ().getName (),
2835
2847
(opcode == PUTSTATIC ) ? "<clinit>" : "<init>" );
2836
2848
}
2837
2849
}
0 commit comments