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
12281228 return result ;
12291229 }
12301230
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 ());
12321238
12331239 private ResolvedJavaField [] convertFields (ResolvedJavaField [] originals , List <ResolvedJavaField > list , boolean listIncludesSuperClassesFields ) {
12341240 ResolvedJavaField [] localOriginals = originals ;
You can’t perform that action at this time.
0 commit comments