RFR: 8333748: javap crash - Fatal error: Unmatched bit position 0x2 for location CLASS [v3]
Adam Sotona
asotona at openjdk.org
Mon Jun 17 15:59:22 UTC 2024
On Mon, 17 Jun 2024 13:55:41 GMT, Chen Liang <liach at openjdk.org> wrote:
>> Currently, javap crashes for class files that have set non-zero values for undefined access flag bits, as `java.lang.reflect.AccessFlag.maskToAccessFlag` and `java.lang.classfile.AccessFlags.flags` fail. In contrast, the JVMS, though asking for these bits to be set to 0, requires VM to proceed and ignore these bits. javap should emulate the VM behavior and proceed rendering, ignoring these undefined bits.
>>
>> In addition, a few bytecode generation utilities in the JDK set unused bits, such as in `java.lang.invoke.MethodHandleImpl.BindCaller#generateInvokerTemplate` and `java.lang.invoke.GenerateJLIClassesHelper#generateCodeBytesForLFs`. Those can be updated in a later cleanup.
>
> Chen Liang has updated the pull request incrementally with two additional commits since the last revision:
>
> - Improve tests to check unmatched bit position and failure for non-inner-classes
> - Report error for flag problems
src/jdk.jdeps/share/classes/com/sun/tools/javap/BasicWriter.java line 84:
> 82: } catch (IllegalArgumentException ex) {
> 83: mask &= LOCATION_MASKS.get(location);
> 84: report(ex);
Unfortunately the original exception message is missing any info that it is related to access flags and it is not very clear what "Error: Unmatched bit position 0x2 for location CLASS" means.
I would add at least a message prefix, for example "Error: Access Flags: Unmatched bit position 0x2 for location CLASS".
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19708#discussion_r1643041633
More information about the core-libs-dev
mailing list