@@ -73,9 +73,7 @@ public void visit(int version, int access, String name, String signature, String
73
73
if (kind == MappedElementKind .CLASS ) {
74
74
String dstName = ((Function <String , String >)getDstName ).apply (name );
75
75
if (dstName != null ) {
76
- if (mappingTree .visitClass (name )) {
77
- mappingTree .visitDstName (MappedElementKind .CLASS , 0 , dstName );
78
- }
76
+ modifyClass (mappingTree , name , dstName );
79
77
}
80
78
}
81
79
super .visit (version , access , name , signature , superName , interfaces );
@@ -86,10 +84,7 @@ public FieldVisitor visitField(int access, String name, String descriptor, Strin
86
84
if (kind == MappedElementKind .FIELD ) {
87
85
String dstName = ((TriFunction <String , String , String , String >)getDstName ).apply (currentClass , name , descriptor );
88
86
if (dstName != null ) {
89
- mappingTree .visitClass (currentClass );
90
- if (mappingTree .visitField (name , descriptor )) {
91
- mappingTree .visitDstName (MappedElementKind .FIELD , 0 , dstName );
92
- }
87
+ modifyField (mappingTree , currentClass , name , descriptor , dstName );
93
88
}
94
89
}
95
90
return super .visitField (access , name , descriptor , signature , value );
@@ -100,10 +95,7 @@ public MethodVisitor visitMethod(int access, String name, String descriptor, Str
100
95
if (kind == MappedElementKind .METHOD ) {
101
96
String dstName = ((TriFunction <String , String , String , String >)getDstName ).apply (currentClass , name , descriptor );
102
97
if (dstName != null ) {
103
- mappingTree .visitClass (currentClass );
104
- if (mappingTree .visitMethod (name , descriptor )) {
105
- mappingTree .visitDstName (MappedElementKind .METHOD , 0 , dstName );
106
- }
98
+ modifyMethod (mappingTree , currentClass , name , descriptor , dstName );
107
99
}
108
100
}
109
101
return super .visitMethod (access , name , descriptor , signature , exceptions );
@@ -119,6 +111,26 @@ public MethodVisitor visitMethod(int access, String name, String descriptor, Str
119
111
} while (!mappingTree .visitEnd ());
120
112
}
121
113
114
+ public static void modifyClass (MemoryMappingTree mappingTree , String name , String dstName ) {
115
+ if (mappingTree .visitClass (name )) {
116
+ mappingTree .visitDstName (MappedElementKind .CLASS , 0 , dstName );
117
+ }
118
+ }
119
+
120
+ public static void modifyMethod (MemoryMappingTree mappingTree , String className , String name , String descriptor , String dstName ) {
121
+ if (mappingTree .visitClass (className ))
122
+ if (mappingTree .visitMethod (name , descriptor )) {
123
+ mappingTree .visitDstName (MappedElementKind .METHOD , 0 , dstName );
124
+ }
125
+ }
126
+
127
+ public static void modifyField (MemoryMappingTree mappingTree , String className , String name , String descriptor , String dstName ) {
128
+ if (mappingTree .visitClass (className ))
129
+ if (mappingTree .visitField (name , descriptor )) {
130
+ mappingTree .visitDstName (MappedElementKind .FIELD , 0 , dstName );
131
+ }
132
+ }
133
+
122
134
public static void remap (Path mappings , Path input , Path output , Path [] cp , String srcNamespace , String dstNamespace ) throws IOException {
123
135
TinyRemapper remapper = null ;
124
136
0 commit comments