[lworld] RFR: 8332243: Value classes implementing Cloneable

David Simms dsimms at openjdk.org
Mon Jun 17 07:55:30 UTC 2024


On Fri, 14 Jun 2024 18:00:42 GMT, Frederic Parain <fparain at openjdk.org> wrote:

> Allow value classes to implement the Cloneable interface.

A tiny spelling thing, but LGTM

src/hotspot/share/prims/jvm.cpp line 731:

> 729:   if (klass->is_inline_klass()) {
> 730:     // Value instances have no identity, so return the current instance instead of allocating a new one
> 731:     // Value classes cannot have finalizers, so the method can return immediately

Nice

test/hotspot/jtreg/runtime/valhalla/inlinetypes/TestCloneableValue.java line 51:

> 49:       @Override
> 50:       public Object clone() throws CloneNotSupportedException {
> 51:         return super.clone(); // deleguate to Object's method performing a shallow copy

"delegate"

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

Marked as reviewed by dsimms (Committer).

PR Review: https://git.openjdk.org/valhalla/pull/1131#pullrequestreview-2122140407
PR Review Comment: https://git.openjdk.org/valhalla/pull/1131#discussion_r1642346392
PR Review Comment: https://git.openjdk.org/valhalla/pull/1131#discussion_r1642348640


More information about the valhalla-dev mailing list