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

javap crash - Fatal error: Unmatched bit position 0x2 for location CLASS

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P2
    • 23, 24
    • tools
    • None
    • behavioral
    • low
    • The error code of javap is not changed, as affected scenarios already fail in existing javap; javap is intended for human display output instead of programmatical parsing, so output changes should have low impact.
    • Other
    • Implementation

    Description

      Summary

      Change javap tool's handling for unmatched access flags to continue processing, despite it returning an error code.

      Problem

      The javap tool has been migrated to ClassFile API and uses java.lang.reflect.AccessFlag, which throws an IAE on undefined set access flag bits; such bits are silently accepted by the JVM per JVMS. The IAE causes javap to stop processing and return an error code, which hampers javap's usefulness as a debug tool.

      Solution

      The JVMS says that the undefined access flag bits should be set to 0. Thus, we plan to keep the error code behavior for class, method, and field locations. (Mismatched bits in InnerClasses can happen, but errors in attributes in javap does not lead to an exit code, so we don't change this behavior) In addition, we will continue processing the rest of the class file instead of stopping, and only return the error code in the end.

      Alternative actions not taken include:

      1. Making javap tool not to return an error and just proceed silently like the JVM does;
      2. Print a warning/diagnostic like those for javac when such an unmatched flag is encountered.

      Rationales against them:

      1. The error code indicates that class files should set those bits to 0, as recommended by the JVMS;
      2. javap has an older infrastructure and cannot access diagnostic easily; structural reorganization is too risky for stabilization for release 23, but we can consider an update later in the development of release 24.

      Specification

      No change.

      Attachments

        Issue Links

          Activity

            People

              liach Chen Liang
              cushon Liam Miller-Cushon
              Adam Sotona
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: