58 */
59
60 package jdk.internal.org.objectweb.asm.commons;
61
62 import jdk.internal.org.objectweb.asm.Opcodes;
63 import jdk.internal.org.objectweb.asm.signature.SignatureVisitor;
64
65 /**
66 * A {@link SignatureVisitor} adapter for type mapping.
67 *
68 * @author Eugene Kuleshov
69 */
70 public class RemappingSignatureAdapter extends SignatureVisitor {
71
72 private final SignatureVisitor v;
73
74 private final Remapper remapper;
75
76 private String className;
77
78 public RemappingSignatureAdapter(
79 final SignatureVisitor v,
80 final Remapper remapper)
81 {
82 this(Opcodes.ASM4, v, remapper);
83 }
84
85 protected RemappingSignatureAdapter(
86 final int api,
87 final SignatureVisitor v,
88 final Remapper remapper)
89 {
90 super(api);
91 this.v = v;
92 this.remapper = remapper;
93 }
94
95 @Override
96 public void visitClassType(String name) {
97 className = name;
98 v.visitClassType(remapper.mapType(name));
99 }
100
101 @Override
102 public void visitInnerClassType(String name) {
103 className = className + '$' + name;
104 String remappedName = remapper.mapType(className);
105 v.visitInnerClassType(remappedName.substring(remappedName.lastIndexOf('$') + 1));
106 }
107
108 @Override
109 public void visitFormalTypeParameter(String name) {
110 v.visitFormalTypeParameter(name);
111 }
112
113 @Override
114 public void visitTypeVariable(String name) {
115 v.visitTypeVariable(name);
116 }
117
118 @Override
119 public SignatureVisitor visitArrayType() {
120 v.visitArrayType();
121 return this;
122 }
123
124 @Override
125 public void visitBaseType(char descriptor) {
166 public SignatureVisitor visitSuperclass() {
167 v.visitSuperclass();
168 return this;
169 }
170
171 @Override
172 public void visitTypeArgument() {
173 v.visitTypeArgument();
174 }
175
176 @Override
177 public SignatureVisitor visitTypeArgument(char wildcard) {
178 v.visitTypeArgument(wildcard);
179 return this;
180 }
181
182 @Override
183 public void visitEnd() {
184 v.visitEnd();
185 }
186
187 }
|
58 */
59
60 package jdk.internal.org.objectweb.asm.commons;
61
62 import jdk.internal.org.objectweb.asm.Opcodes;
63 import jdk.internal.org.objectweb.asm.signature.SignatureVisitor;
64
65 /**
66 * A {@link SignatureVisitor} adapter for type mapping.
67 *
68 * @author Eugene Kuleshov
69 */
70 public class RemappingSignatureAdapter extends SignatureVisitor {
71
72 private final SignatureVisitor v;
73
74 private final Remapper remapper;
75
76 private String className;
77
78 public RemappingSignatureAdapter(final SignatureVisitor v,
79 final Remapper remapper) {
80 this(Opcodes.ASM5, v, remapper);
81 }
82
83 protected RemappingSignatureAdapter(final int api,
84 final SignatureVisitor v, final Remapper remapper) {
85 super(api);
86 this.v = v;
87 this.remapper = remapper;
88 }
89
90 @Override
91 public void visitClassType(String name) {
92 className = name;
93 v.visitClassType(remapper.mapType(name));
94 }
95
96 @Override
97 public void visitInnerClassType(String name) {
98 className = className + '$' + name;
99 String remappedName = remapper.mapType(className);
100 v.visitInnerClassType(remappedName.substring(remappedName
101 .lastIndexOf('$') + 1));
102 }
103
104 @Override
105 public void visitFormalTypeParameter(String name) {
106 v.visitFormalTypeParameter(name);
107 }
108
109 @Override
110 public void visitTypeVariable(String name) {
111 v.visitTypeVariable(name);
112 }
113
114 @Override
115 public SignatureVisitor visitArrayType() {
116 v.visitArrayType();
117 return this;
118 }
119
120 @Override
121 public void visitBaseType(char descriptor) {
162 public SignatureVisitor visitSuperclass() {
163 v.visitSuperclass();
164 return this;
165 }
166
167 @Override
168 public void visitTypeArgument() {
169 v.visitTypeArgument();
170 }
171
172 @Override
173 public SignatureVisitor visitTypeArgument(char wildcard) {
174 v.visitTypeArgument(wildcard);
175 return this;
176 }
177
178 @Override
179 public void visitEnd() {
180 v.visitEnd();
181 }
182 }
|