@@ -115,17 +115,17 @@ public void transform(final @NotNull TransformInvocation transformInvocation) {
115
115
final Path inputPath = Paths .get (directoryInput .getFile ().getAbsolutePath ());
116
116
Files .walk (inputPath )
117
117
.filter (Files ::isRegularFile )
118
- .map (inputPath ::relativize )
119
118
.filter (Lambdas .predicate (path -> {
120
119
if (path .getFileName ().toFile ().getName ().endsWith (".class" )) {
121
120
return true ;
122
121
}
123
- final File file = new File (outputDir , path .toString ());
122
+ final File file = new File (outputDir , inputPath . relativize ( path ) .toString ());
124
123
//noinspection ResultOfMethodCallIgnored
125
124
file .getParentFile ().mkdirs ();
126
125
Files .copy (path , file .toPath ());
127
126
return false ;
128
127
}))
128
+ .map (inputPath ::relativize )
129
129
.map (Path ::toString )
130
130
.map (s -> s .replaceAll ("/" , "." ).replaceAll ("\\ \\ " , "." ))
131
131
.map (s -> s .substring (0 , s .length () - ".class" .length ()))
@@ -187,34 +187,34 @@ private static boolean hasBackport(
187
187
}
188
188
189
189
private static void transformClass (
190
- final @ NotNull ClassPool classPool , final @ NotNull String className , final @ NotNull TypeMap classMap ,
191
- final @ NotNull MethodMap redirectMap , final @ NotNull File outputDir ) throws Exception {
190
+ final @ NotNull ClassPool classPool , final @ NotNull String className , final @ NotNull TypeMap typeMap ,
191
+ final @ NotNull MethodMap methodMap , final @ NotNull File outputDir ) throws Exception {
192
192
193
193
final CtClass ctClass = classPool .get (className );
194
194
195
195
final HashMap <Integer , String > replaceMap = new HashMap <>();
196
196
197
197
ctClass .instrument (Lambdas .methodEditor ((m , c ) -> {
198
198
final String key = m .getMethodName () + " " + m .getSignature ();
199
- MethodMap .Entry redirectEntry = redirectMap .get (key );
200
- while (redirectEntry != null ) {
199
+ MethodMap .Entry methodMapEntry = methodMap .get (key );
200
+ while (methodMapEntry != null ) {
201
201
final CtMethod method = m .getMethod ();
202
202
final CtClass declaringClass = method .getDeclaringClass ();
203
203
final boolean matches ;
204
204
if (Modifier .isStatic (method .getModifiers ())) {
205
- matches = declaringClass .getName ().equals (redirectEntry .type );
205
+ matches = declaringClass .getName ().equals (methodMapEntry .type );
206
206
} else {
207
- matches = declaringClass .subtypeOf (declaringClass .getClassPool ().get (redirectEntry .type ));
207
+ matches = declaringClass .subtypeOf (declaringClass .getClassPool ().get (methodMapEntry .type ));
208
208
}
209
209
if (matches ) {
210
- replaceMap .put (c , redirectEntry .replacement );
210
+ replaceMap .put (c , methodMapEntry .replacement );
211
211
break ;
212
212
}
213
- redirectEntry = redirectEntry .next ;
213
+ methodMapEntry = methodMapEntry .next ;
214
214
}
215
215
}));
216
216
217
- ctClass .getClassFile ().renameClass (classMap );
217
+ ctClass .getClassFile ().renameClass (typeMap );
218
218
219
219
ctClass .instrument (Lambdas .methodEditor ((m , c ) -> {
220
220
final String replacement = replaceMap .get (c );
0 commit comments