Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8331655

ClassFile API ClassCastException with verbose output of certain class files

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 23
    • 22.0.1
    • core-libs
    • None

      An out-of-spec classfile can cause a ClassCastException, as when verbose output is requested from the javap tool:

      $ javap -v CCE_javap_minus_v.class
      ....

      Please file a bug report, and include the following information:
      java.lang.ClassCastException: class jdk.internal.classfile.impl.AbstractPoolEntry$DoubleEntryImpl cannot be cast to class jdk.internal.classfile.impl.AbstractPoolEntry$Utf8EntryImpl (jdk.internal.classfile.impl.AbstractPoolEntry$DoubleEntryImpl and jdk.internal.classfile.impl.AbstractPoolEntry$Utf8EntryImpl are in module java.base of loader 'bootstrap')
      at java.base/jdk.internal.classfile.impl.ClassReaderImpl.utf8EntryByIndex(ClassReaderImpl.java:364)
      at java.base/jdk.internal.classfile.impl.ClassReaderImpl.readUtf8Entry(ClassReaderImpl.java:407)
      at java.base/jdk.internal.classfile.impl.ClassReaderImpl.entryByIndex(ClassReaderImpl.java:332)
      at java.base/jdk.internal.classfile.impl.ClassReaderImpl.readEntry(ClassReaderImpl.java:385)
      at java.base/jdk.internal.classfile.impl.ClassReaderImpl.readEntry(ClassReaderImpl.java:390)
      at java.base/jdk.internal.classfile.impl.ClassReaderImpl.readNameAndTypeEntry(ClassReaderImpl.java:436)
      at java.base/jdk.internal.classfile.impl.ClassReaderImpl.entryByIndex(ClassReaderImpl.java:328)
      at java.base/jdk.internal.classfile.impl.ClassReaderImpl.readEntry(ClassReaderImpl.java:385)
      at java.base/jdk.internal.classfile.impl.ClassReaderImpl.readEntry(ClassReaderImpl.java:390)
      at java.base/jdk.internal.classfile.impl.AbstractInstruction$BoundInvokeInstruction.method(AbstractInstruction.java:416)

      ....

            asotona Adam Sotona
            mschoene Marc Schönefeld
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: