Skip to content

Commit

Permalink
Add check to skip registering no-op mappings in the intermediate
Browse files Browse the repository at this point in the history
  • Loading branch information
Col-E committed May 24, 2024
1 parent 687afa4 commit e98f5e4
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class IntermediateMappings implements Mappings {
* Post-mapping name.
*/
public void addClass(String oldName, String newName) {
if (Objects.equals(oldName, newName)) return; // Skip identity mappings
classes.put(oldName, new ClassMapping(oldName, newName));
}

Expand All @@ -42,6 +43,7 @@ public void addClass(String oldName, String newName) {
* Post-mapping field name.
*/
public void addField(String ownerName, String desc, String oldName, String newName) {
if (Objects.equals(oldName, newName)) return; // Skip identity mappings
fields.computeIfAbsent(ownerName, n -> new ArrayList<>())
.add(new FieldMapping(ownerName, oldName, desc, newName));
}
Expand All @@ -57,6 +59,7 @@ public void addField(String ownerName, String desc, String oldName, String newNa
* Post-mapping method name.
*/
public void addMethod(String ownerName, String desc, String oldName, String newName) {
if (Objects.equals(oldName, newName)) return; // Skip identity mappings
methods.computeIfAbsent(ownerName, n -> new ArrayList<>())
.add(new MethodMapping(ownerName, oldName, desc, newName));
}
Expand All @@ -80,6 +83,7 @@ public void addMethod(String ownerName, String desc, String oldName, String newN
public void addVariable(String ownerName, String methodName, String methodDesc,
String desc, String oldName, int index,
String newName) {
if (Objects.equals(oldName, newName)) return; // Skip identity mappings
String key = varKey(ownerName, methodName, methodDesc);
variables.computeIfAbsent(key, n -> new ArrayList<>())
.add(new VariableMapping(ownerName, methodName, methodDesc, desc, oldName, index, newName));
Expand Down

0 comments on commit e98f5e4

Please sign in to comment.