1 | |
package org.apache.maven.plugins.shade; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import org.objectweb.asm.AnnotationVisitor; |
23 | |
import org.objectweb.asm.ClassVisitor; |
24 | |
import org.objectweb.asm.FieldVisitor; |
25 | |
import org.objectweb.asm.MethodVisitor; |
26 | |
import org.objectweb.asm.commons.Remapper; |
27 | |
import org.objectweb.asm.commons.RemappingAnnotationAdapter; |
28 | |
import org.objectweb.asm.commons.RemappingClassAdapter; |
29 | |
import org.objectweb.asm.commons.RemappingFieldAdapter; |
30 | |
import org.objectweb.asm.commons.RemappingMethodAdapter; |
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
class TempRemappingClassAdapter |
38 | |
extends RemappingClassAdapter |
39 | |
{ |
40 | |
|
41 | |
private static class MethodRemapVisitor |
42 | |
extends RemappingMethodAdapter |
43 | |
{ |
44 | |
public MethodRemapVisitor( int access, String desc, MethodVisitor mv, Remapper renamer ) |
45 | |
{ |
46 | 5390 | super( access, desc, mv, renamer ); |
47 | 5390 | } |
48 | |
|
49 | |
public AnnotationVisitor visitAnnotation( String desc, boolean visible ) |
50 | |
{ |
51 | |
|
52 | 0 | AnnotationVisitor av = mv.visitAnnotation( remapper.mapDesc( desc ), visible ); |
53 | 0 | return av == null ? av : new RemappingAnnotationAdapter( av, remapper ); |
54 | |
} |
55 | |
} |
56 | |
|
57 | |
private static class FieldRemapVisitor |
58 | |
extends RemappingFieldAdapter |
59 | |
{ |
60 | |
|
61 | |
private final FieldVisitor fv; |
62 | |
|
63 | |
private final Remapper remapper; |
64 | |
|
65 | |
public FieldRemapVisitor( FieldVisitor fv, Remapper remapper ) |
66 | |
{ |
67 | 2008 | super( fv, remapper ); |
68 | 2008 | this.fv = fv; |
69 | 2008 | this.remapper = remapper; |
70 | 2008 | } |
71 | |
|
72 | |
public AnnotationVisitor visitAnnotation( String desc, boolean visible ) |
73 | |
{ |
74 | |
|
75 | 0 | AnnotationVisitor av = fv.visitAnnotation( remapper.mapDesc( desc ), visible ); |
76 | 0 | return av == null ? null : new RemappingAnnotationAdapter( av, remapper ); |
77 | |
} |
78 | |
} |
79 | |
|
80 | |
public TempRemappingClassAdapter( ClassVisitor cv, Remapper remapper ) |
81 | |
{ |
82 | 422 | super( cv, remapper ); |
83 | 422 | } |
84 | |
|
85 | |
protected MethodVisitor createRemappingMethodAdapter( int access, String newDesc, MethodVisitor mv ) |
86 | |
{ |
87 | 5390 | return new MethodRemapVisitor( access, newDesc, mv, remapper ); |
88 | |
} |
89 | |
|
90 | |
protected FieldVisitor createRemappingFieldAdapter( FieldVisitor fv ) |
91 | |
{ |
92 | 2008 | return new FieldRemapVisitor( fv, remapper ); |
93 | |
} |
94 | |
|
95 | |
} |