RFR: 8364316: JFR: Incorrect validation of mirror fields

Aleksey Shipilev shade at openjdk.org
Wed Jul 30 08:30:53 UTC 2025


On Tue, 29 Jul 2025 20:50:33 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:

> Could I please have a review of a PR that fixes a bug in the mirror field validation?
> 
> Testing: jdk/jdk/jfr
> 
> Thanks
> Erik

Looks reasonable. 

There might be another quirk in this code: fields of the same name can be hidden, so verification would miss that? See:


jshell> class C1 { int x;}
|  created class C1

jshell> class C2 extends C1 { int x;}
|  created class C2

jshell> Class cMirror = C2.class;
   ...> while (cMirror != Object.class) {
   ...>     System.out.println(cMirror.getDeclaredField("x").getName());
   ...>     cMirror = cMirror.getSuperclass();
   ...> }
cMirror ==> class C2
x
x

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

Marked as reviewed by shade (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/26539#pullrequestreview-3070412524


More information about the hotspot-jfr-dev mailing list