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

Enforce immutability of Lists used by ClassFile API

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 24
    • 24
    • core-libs
    • None

      Here is a list of APIs using List that may use mutable list, by comprehensive search:

      AttributedElement.findAttributes
      ClassFile.verify - mutable for full verified results
      ClassSignature.typeParameters - missing copy on record ctor
      CompoundElement.elementList - mutable for buffered models
      RuntimeInvisibleParameterAnnotationsAttribute(and Visible) - can nest mutable list
      StackMapFrameInfo.locals/stack - public factory missing coppy

      We can check if we want strict null hostility or just immutability (so unmodifiableList is ok).

      unmodifiable vs null-hostile:
      Signature record creation - parsing from string is not null hostile
      BoundAttribute.readAttributes - not null hostile
      CodeImpl.exceptionTable - not null hostile
      TableSwitchInstruction bound cases - not null hostile
      Util.mappedList - not null hostile

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

              Created:
              Updated:
              Resolved: