RFR: 8302260: VarHandle.describeConstable() fails to return a nominal descriptor for static public fields

Alan Bateman alanb at openjdk.org
Tue Feb 14 12:40:47 UTC 2023


On Mon, 13 Feb 2023 19:35:52 GMT, Mandy Chung <mchung at openjdk.org> wrote:

> I overlooked in the fix for JDK-8297757 that it should have passed the declaring class of the static fields rather than the reference class passed to `Lookup::findStaticVarHandle`.

Looks right and you've added good test coverage.

test/jdk/java/lang/invoke/VarHandles/describeConstable/DescribeConstableTest.java line 53:

> 51:                 // resolved to the one defined in the direct superinterface of C
> 52:                 Arguments.of(p.C.class, "stringField", String.class, p.I.class, "I"),
> 53:                 Arguments.of(p.C.class, "longField", long.class, p.I.class, 10L),

This looks right - when not declared in p.C, it should look next in the direct superinterfaces before looking in the super classes.

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

Marked as reviewed by alanb (Reviewer).

PR: https://git.openjdk.org/jdk/pull/12543


More information about the core-libs-dev mailing list