Commit b648d8fb authored by Eric Bruneton's avatar Eric Bruneton

Add failing test showing the issue.

parent 68b7c0a8
...@@ -60,6 +60,7 @@ import org.objectweb.asm.tree.MethodNode; ...@@ -60,6 +60,7 @@ import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.MultiANewArrayInsnNode; import org.objectweb.asm.tree.MultiANewArrayInsnNode;
import org.objectweb.asm.tree.TryCatchBlockNode; import org.objectweb.asm.tree.TryCatchBlockNode;
import org.objectweb.asm.tree.TypeInsnNode; import org.objectweb.asm.tree.TypeInsnNode;
import org.objectweb.asm.util.CheckMethodAdapter;
public class ClassRemapperTest extends AsmTest implements Opcodes { public class ClassRemapperTest extends AsmTest implements Opcodes {
...@@ -313,6 +314,20 @@ public class ClassRemapperTest extends AsmTest implements Opcodes { ...@@ -313,6 +314,20 @@ public class ClassRemapperTest extends AsmTest implements Opcodes {
return remappedInternalClassName.replace('/', '.'); return remappedInternalClassName.replace('/', '.');
} }
@Override
public String mapDesc(final String descriptor) {
checkDescriptor(descriptor);
return super.mapDesc(descriptor);
}
@Override
public String mapType(final String type) {
if (type != null && !type.equals("module-info")) {
checkInternalName(type);
}
return super.mapType(type);
}
@Override @Override
public String mapMethodName(final String owner, final String name, final String descriptor) { public String mapMethodName(final String owner, final String name, final String descriptor) {
if (name.equals("<init>") || name.equals("<clinit>")) { if (name.equals("<init>") || name.equals("<clinit>")) {
...@@ -336,4 +351,16 @@ public class ClassRemapperTest extends AsmTest implements Opcodes { ...@@ -336,4 +351,16 @@ public class ClassRemapperTest extends AsmTest implements Opcodes {
return typeName.equals(internalClassName) ? remappedInternalClassName : typeName; return typeName.equals(internalClassName) ? remappedInternalClassName : typeName;
} }
} }
private static void checkDescriptor(final String descriptor) {
CheckMethodAdapter checkMethodAdapter = new CheckMethodAdapter(null);
checkMethodAdapter.visitCode();
checkMethodAdapter.visitFieldInsn(Opcodes.GETFIELD, "Owner", "name", descriptor);
}
private static void checkInternalName(final String internalName) {
CheckMethodAdapter checkMethodAdapter = new CheckMethodAdapter(null);
checkMethodAdapter.visitCode();
checkMethodAdapter.visitFieldInsn(Opcodes.GETFIELD, internalName, "name", "I");
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment