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

AsVarargsCollector::asCollectorCache incorrectly marked @Stable

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P5
    • 19
    • 19
    • core-libs
    • None

    Description

      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

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: