JDK-8273407 : Hotspot failed to throw the IncompatibleClassChangeError
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 8u301
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2021-09-02
  • Updated: 2021-09-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8-poolUnresolved
Related Reports
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
Microsoft Windows 10
10.0.19042 N/A Build 19042
Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz   1.80 GHz
Memory 8.00 GB

A DESCRIPTION OF THE PROBLEM :
We found that OpenJDK 11.0.11 and 16.0.2 versions of  Hotspot can throw the IncompatibleClassChangeError, while that OpenJDK 8u282 version of Hotspot can not detect IncompatibleClassChangeError (throw the output "anystring"). We think it is a bug in OpenJDK 8u282 version of Hotspot implementation.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Follow the commands in readme, the source codes are as follows:
https://drive.google.com/drive/folders/1ZKRZanhfliw8kBW-8D8HqvDzHB3EEBD-?usp=sharing

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
[Exception in thread "main" java.lang.IncompatibleClassChangeError: Method 'java.lang.String A.get()' must be InterfaceMethodref constant, 	at Test.main(Test.jasm)]
ACTUAL -
anystring

---------- BEGIN SOURCE ----------
https://drive.google.com/drive/folders/1ZKRZanhfliw8kBW-8D8HqvDzHB3EEBD-?usp=sharing
---------- END SOURCE ----------


Comments
I think the original class A looked something like: interface A { public static String get() { return "anystring"; } } Class Test tries to invokestatic A.get() but finds a MethodRef in its constant pool for A.get() instead of an InterfaceMethodRef. So, in later JDK's, it throws ICCE. The ICCE message is text that was added as part of the fix for JDK-8145148. JDK-8145148 needs to be backported to JDK-8u to fix this.
08-09-2021

I can't tell from the test sources exactly how class A has been defined so I'm not 100% sure which rule is now being enforced from 9+ that wasn't in 8. I suspect this is JDK-8145148.
07-09-2021

Issue is reproduced , java.lang.IncompatibleClassChangeError exception is not thrown for jdk 8u301 and the test case passes from JDK 9 onwards. OS: Windows 10 JDK 8u301 : Fail Output: anystring JDK 9 : Pass Output: [Exception in thread "main" java.lang.IncompatibleClassChangeError: Method 'java.lang.String A.get()' must be InterfaceMethodref constant, at Test.main(Test.jasm)] JDK 11.0.12: Pass JDK 17ea35: Pass JDK 18ea13:Pass Moving it to dev team for further analysis.
07-09-2021