RFR: JDK-8310913 Move ReferencedKeyMap to jdk.internal so it may be shared [v9]

Jim Laskey jlaskey at openjdk.org
Mon Jul 31 12:21:02 UTC 2023


On Wed, 19 Jul 2023 13:59:00 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Jim Laskey has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 15 commits:
>> 
>>  - Merge branch 'master' into 8310913
>>  - Requested changes.
>>    
>>    Added intern with UnaryOperator<T> interning function to prepare key before adding to set.
>>  - Update test to check for gc.
>>  - Update ReferencedKeyTest.java
>>  - Simple versions of create
>>  - Add flag for reference queue type
>>  - Merge branch 'master' into 8310913
>>  - Update to use VirtualThread friendly stale queue.
>>  - Remove warning tied to String Templates
>>  - unneeded SuppressWarning
>>  - ... and 5 more: https://git.openjdk.org/jdk/compare/028068a6...fbb78778
>
> src/java.base/share/classes/jdk/internal/util/ReferencedKeyMap.java line 344:
> 
>> 342:      * interning values in a set.
>> 343:      *
>> 344:      * @implNote Requires a {@link ReferencedKeyMap} whose {@code V} type
> 
> The type safety is now ensured by the generic declaration on the static method. The `@implNote`s and `@throws ClassCastException`, including ones in other intern methods, are now redundant.

I think it still serves a warning to not use this form of the `intern` method during phase1. I will add a note that they should use an UnaryOperator instance instead of a lambda.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14684#discussion_r1279211620


More information about the core-libs-dev mailing list