@@ -55,7 +55,10 @@ final class FieldInfo extends DynamicObjectFieldLocation implements Comparable<F
55
55
private static final boolean JDK21 = Runtime .version ().feature () == 21 ;
56
56
private static final int UNUSED_OFFSET = 0 ;
57
57
58
- /** Field offset. Used by AtomicFieldUpdaterOffset recomputation. Do not rename! */
58
+ /**
59
+ * Field offset. Used by AtomicFieldUpdaterOffset recomputation. Do not rename! On JDK21 this is
60
+ * 0, so always use {@link #offset()} instead of this field directly.
61
+ */
59
62
private final long offset ;
60
63
/** Declaring class. Used by AtomicFieldUpdaterOffset recomputation. Do not rename! */
61
64
private final Class <? extends DynamicObject > tclass ;
@@ -116,19 +119,19 @@ public String name() {
116
119
117
120
@ Override
118
121
public String toString () {
119
- return name + ":" + offset ;
122
+ return name + ":" + offset () ;
120
123
}
121
124
122
125
@ Override
123
126
public int compareTo (FieldInfo other ) {
124
- return Long .compare (this .offset , other .offset );
127
+ return Long .compare (this .offset () , other .offset () );
125
128
}
126
129
127
130
@ Override
128
131
public int hashCode () {
129
132
final int prime = 31 ;
130
133
int result = 1 ;
131
- result = prime * result + Long .hashCode (offset );
134
+ result = prime * result + Long .hashCode (offset () );
132
135
result = prime * result + tclass .hashCode ();
133
136
return result ;
134
137
}
@@ -141,7 +144,7 @@ public boolean equals(Object obj) {
141
144
if (!(obj instanceof FieldInfo other )) {
142
145
return false ;
143
146
}
144
- return this .offset == other .offset && this .tclass == other .tclass ;
147
+ return this .offset () == other .offset () && this .tclass == other .tclass ;
145
148
}
146
149
147
150
void receiverCheck (DynamicObject store ) {
0 commit comments