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

Missing sub-int value validation in the Class-File API

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 25
    • core-libs
    • None

      In the class file format, many values are u1 and u2, which are consistently represented in the Class-File API as int. However, such representation omitted that the actual values have a more narrow range, and performs no value restriction when users create API models via factories.

      Since for these values, almost all usages of unrepresentable values indicate a user error, I propose to eagerly check for them and throw IllegalArgumentException. For some common aliases, such as using -1 for "all bits set" class file minor version, we can have exceptions.

      Note that some values are illegal but representable - this proposal does not intend to restrict those values.

            liach Chen Liang
            liach Chen Liang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: