RFR: 8285690: CloneableReference subtest should not throw CloneNotSupportedException [v2]

Mandy Chung mchung at openjdk.java.net
Wed Apr 27 16:02:43 UTC 2022


On Wed, 27 Apr 2022 10:11:15 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> Please review this fix to test/jdk/java/lang/ref/ReferenceClone.java.  It was
>> passing if CloneableReference::clone were to throw CloneNotSupportedException.
>> That should be a failure.
>> 
>> Testing:
>> Locally (linux-x64) verified test still passes.  Temporarily changed
>> CloneableReference::clone to throw and verified the expected failure gets
>> reported, unlike before.
>
> Kim Barrett has updated the pull request incrementally with one additional commit since the last revision:
> 
>   update copyright, @bug list

Marked as reviewed by mchung (Reviewer).

test/jdk/java/lang/ref/ReferenceClone.java line 52:

> 50:         } catch (CloneNotSupportedException e) {
> 51:             throw new RuntimeException("CloneableReference::clone should not throw CloneNotSupportedException");
> 52:         }

Alternatively, it could simply let CNSE propagate.


CloneableReference ref = new CloneableReference(o);
ref.clone();


`test()` and `main` will need to declare this checked exception.

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

PR: https://git.openjdk.java.net/jdk/pull/8418


More information about the core-libs-dev mailing list