in asm-util/src/main/java/org/objectweb/asm/util/ASMifier.java [187:256]
public void visit(
final int version,
final int access,
final String name,
final String signature,
final String superName,
final String[] interfaces) {
String simpleName;
if (name == null) {
simpleName = "module-info";
} else {
int lastSlashIndex = name.lastIndexOf('/');
if (lastSlashIndex == -1) {
simpleName = name;
} else {
text.add("package asm." + name.substring(0, lastSlashIndex).replace('/', '.') + ";\n");
simpleName = name.substring(lastSlashIndex + 1).replaceAll("[-\\(\\)]", "_");
}
}
text.add("import org.objectweb.asm.AnnotationVisitor;\n");
text.add("import org.objectweb.asm.Attribute;\n");
text.add("import org.objectweb.asm.ClassReader;\n");
text.add("import org.objectweb.asm.ClassWriter;\n");
text.add("import org.objectweb.asm.ConstantDynamic;\n");
text.add("import org.objectweb.asm.FieldVisitor;\n");
text.add("import org.objectweb.asm.Handle;\n");
text.add("import org.objectweb.asm.Label;\n");
text.add("import org.objectweb.asm.MethodVisitor;\n");
text.add("import org.objectweb.asm.Opcodes;\n");
text.add("import org.objectweb.asm.RecordComponentVisitor;\n");
text.add("import org.objectweb.asm.Type;\n");
text.add("import org.objectweb.asm.TypePath;\n");
text.add("public class " + simpleName + "Dump implements Opcodes {\n\n");
text.add("public static byte[] dump () throws Exception {\n\n");
text.add("ClassWriter classWriter = new ClassWriter(0);\n");
text.add("FieldVisitor fieldVisitor;\n");
text.add("RecordComponentVisitor recordComponentVisitor;\n");
text.add("MethodVisitor methodVisitor;\n");
text.add("AnnotationVisitor annotationVisitor0;\n\n");
stringBuilder.setLength(0);
stringBuilder.append("classWriter.visit(");
String versionString = CLASS_VERSIONS.get(version);
if (versionString != null) {
stringBuilder.append(versionString);
} else {
stringBuilder.append(version);
}
stringBuilder.append(", ");
appendAccessFlags(access | ACCESS_CLASS);
stringBuilder.append(", ");
appendConstant(name);
stringBuilder.append(", ");
appendConstant(signature);
stringBuilder.append(", ");
appendConstant(superName);
stringBuilder.append(", ");
if (interfaces != null && interfaces.length > 0) {
stringBuilder.append("new String[] {");
for (int i = 0; i < interfaces.length; ++i) {
stringBuilder.append(i == 0 ? " " : ", ");
appendConstant(interfaces[i]);
}
stringBuilder.append(" }");
} else {
stringBuilder.append("null");
}
stringBuilder.append(END_PARAMETERS);
text.add(stringBuilder.toString());
}