JDK-8159470 : Error message for ICCE for MethodHandle constant pool not helpful
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-06-14
  • Updated: 2016-07-14
  • Resolved: 2016-06-20
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 9
9 b127Fixed
Related Reports
Relates :  
Relates :  
Description
This message is not that helpful to users who may newly get this ICCE:

      if ((callee->is_interface() && m_tag.is_method()) ||
          (!callee->is_interface() && m_tag.is_interface_method())) {
        ResourceMark rm(THREAD);
        char buf[200];
        jio_snprintf(buf, sizeof(buf), "Inconsistent constant data for %s.%s%s at index %d",
          callee->name()->as_C_string(), name->as_C_string(), signature->as_C_string(), index);
        THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
      }

This should be more user friendly and tell that the constant pool for class X has InterfaceMethodref at index y that should be Methodref for function f, or vice versa.  The info's there but not really specific enough.
Comments
From [~abuckley] "The JVMS has always avoided deep type checking of these entries when a ClassFile structure is read, and instead deferred it to resolution. If HotSpot has not been performing these long-specified resolution-time checks, then it should start in JDK 9 for all class file versions, no flags, no switches, no backports."
16-06-2016

Exception in thread "main" java.lang.BootstrapMethodError: java.lang.IncompatibleClassChangeError: Inconsistent constant pool data in classfile for class Test$WithConfiguration. Method lambda$autoDetect$0()Ljava/lang/String; at index 26 is JVM_CONSTANT_MethodRef and should be JVM_CONSTANT_InterfaceMethodRef at Test$WithConfiguration.autoDetect(Test.java:12) at Test$ScopedCacheFactoryBuilder.<clinit>(Test.java:21) at Test.main(Test.java:25) Caused by: java.lang.IncompatibleClassChangeError: Inconsistent constant pool data in classfile for class Test$WithConfiguration. Method lambda$autoDetect$0()Ljava/lang/String; at index 26 is JVM_CONSTANT_MethodRef and should be JVM_CONSTANT_InterfaceMethodRef Maybe this is more helpful.
15-06-2016

Also check for classfile versions > 53 to mitigate the incompatibility risk.
15-06-2016