AsVarargsCollector::asCollectorCache incorrectly marked @Stable

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P5
    • 19
    • Affects Version/s: 19
    • Component/s: core-libs
    • None

      The AsVarargsCollector::asCollectorCache field is marked as `@Stable` but doesn't follow the contract for Stable fields.

      The contract for Stable, as described in [1], states:
      > A field may be annotated as stable if all of its component variables
      > changes value at most once.
      ...
      > Since all fields begin with a default value of null for references
      > (resp., zero for primitives), it follows that this annotation indicates
      > that the first non-null (resp., non-zero) value stored in the field
      > will never be changed.

      The AsVarargsCollector::asTypeUncached method updates the `asCollectorCache` field.

      This was discovered by the OpenJ9 project while investigating a test issue in the CatchExceptionTest.java [2] test case related to the `getCatcher` method.

      [1] https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/jdk/internal/vm/annotation/Stable.java
      [2] https://github.com/openjdk/jdk/blob/master/test/jdk/java/lang/invoke/MethodHandles/CatchExceptionTest.java

            Assignee:
            Dan Heidinga
            Reporter:
            Dan Heidinga
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: