@@ -73,9 +73,7 @@ public void visit(int version, int access, String name, String signature, String
7373 if (kind == MappedElementKind .CLASS ) {
7474 String dstName = ((Function <String , String >)getDstName ).apply (name );
7575 if (dstName != null ) {
76- if (mappingTree .visitClass (name )) {
77- mappingTree .visitDstName (MappedElementKind .CLASS , 0 , dstName );
78- }
76+ modifyClass (mappingTree , name , dstName );
7977 }
8078 }
8179 super .visit (version , access , name , signature , superName , interfaces );
@@ -86,10 +84,7 @@ public FieldVisitor visitField(int access, String name, String descriptor, Strin
8684 if (kind == MappedElementKind .FIELD ) {
8785 String dstName = ((TriFunction <String , String , String , String >)getDstName ).apply (currentClass , name , descriptor );
8886 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 );
9388 }
9489 }
9590 return super .visitField (access , name , descriptor , signature , value );
@@ -100,10 +95,7 @@ public MethodVisitor visitMethod(int access, String name, String descriptor, Str
10095 if (kind == MappedElementKind .METHOD ) {
10196 String dstName = ((TriFunction <String , String , String , String >)getDstName ).apply (currentClass , name , descriptor );
10297 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 );
10799 }
108100 }
109101 return super .visitMethod (access , name , descriptor , signature , exceptions );
@@ -119,6 +111,26 @@ public MethodVisitor visitMethod(int access, String name, String descriptor, Str
119111 } while (!mappingTree .visitEnd ());
120112 }
121113
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+
122134 public static void remap (Path mappings , Path input , Path output , Path [] cp , String srcNamespace , String dstNamespace ) throws IOException {
123135 TinyRemapper remapper = null ;
124136
0 commit comments