Currently, add is returning intern(e) == null which will always be false. The correct test is intern(e) == e , that is, true when element is newly added.
------------- Commit messages: - Correct test Changes: https://git.openjdk.org/jdk/pull/17732/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17732&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8325255 Stats: 6 lines in 2 files changed: 5 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/17732.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17732/head:pull/17732 PR: https://git.openjdk.org/jdk/pull/17732