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

Remove bad Code attribute parsing code

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 14
    • hotspot
    • None
    • behavioral
    • minimal
    • Class files with versions < 45.3 predate Java. It is doubtful if many such class files still exist that have the unspecified layout of Code attribute fields.
    • Class file construct
    • Implementation

      Summary

      The JVM currently requires that classes with class file version < 45.3 have a Code attribute whose max_stack and max_locals fields are one byte and attribute length is 2 bytes. This violates the JVM Spec.

      Problem

      For old class files, the JVM accepts Code attribute fields that violate the JVM Spec. It does not accept Code attribute fields, for these old class files, that conform to the JVM Spec.

      Solution

      The solution is to remove the code from the JVM that incorrectly handles the Code attribute for the old class file versions.

      Specification

      The JVM's handling of Code attributes for class files with version <= 45.2 should match section 4.7.3 of the Java Virtual Machine Spec, which describes the Code attribute as:

      Code_attribute { u2 attribute_name_index; u4 attribute_length; u2 max_stack; u2 max_locals; ... }

            hseigel Harold Seigel (Inactive)
            hseigel Harold Seigel (Inactive)
            Lois Foltan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: