File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -1228,7 +1228,13 @@ private ResolvedJavaField[] initializeInstanceFields(boolean includeSuperclasses
1228
1228
return result ;
1229
1229
}
1230
1230
1231
- static final Comparator <ResolvedJavaField > FIELD_COMPARATOR = Comparator .comparing (ResolvedJavaField ::getJavaKind ).thenComparing (ResolvedJavaField ::getName );
1231
+ /**
1232
+ * Sort fields by the field's name *and* type. Note that sorting by name is not enough as the
1233
+ * class file format doesn't disallow duplicated names with differing types in the same class.
1234
+ * Even though you cannot declare duplicated names in source code the class file can be
1235
+ * manipulated such that two fields will have the same name.
1236
+ */
1237
+ static final Comparator <ResolvedJavaField > FIELD_COMPARATOR = Comparator .comparing (ResolvedJavaField ::getName ).thenComparing (f -> f .getType ().toJavaName ());
1232
1238
1233
1239
private ResolvedJavaField [] convertFields (ResolvedJavaField [] originals , List <ResolvedJavaField > list , boolean listIncludesSuperClassesFields ) {
1234
1240
ResolvedJavaField [] localOriginals = originals ;
You can’t perform that action at this time.
0 commit comments