Java Code Examples for jdk.internal.org.objectweb.asm.Opcodes#V1_6

The following examples show how to use jdk.internal.org.objectweb.asm.Opcodes#V1_6 . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ASMifier.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(final int version, final int access, final String name,
        final String signature, final String superName,
        final String[] interfaces) {
    String simpleName;
    int n = name.lastIndexOf('/');
    if (n == -1) {
        simpleName = name;
    } else {
        text.add("package asm." + name.substring(0, n).replace('/', '.')
                + ";\n");
        simpleName = name.substring(n + 1);
    }
    text.add("import java.util.*;\n");
    text.add("import jdk.internal.org.objectweb.asm.*;\n");
    text.add("public class " + simpleName + "Dump implements Opcodes {\n\n");
    text.add("public static byte[] dump () throws Exception {\n\n");
    text.add("ClassWriter cw = new ClassWriter(0);\n");
    text.add("FieldVisitor fv;\n");
    text.add("MethodVisitor mv;\n");
    text.add("AnnotationVisitor av0;\n\n");

    buf.setLength(0);
    buf.append("cw.visit(");
    switch (version) {
    case Opcodes.V1_1:
        buf.append("V1_1");
        break;
    case Opcodes.V1_2:
        buf.append("V1_2");
        break;
    case Opcodes.V1_3:
        buf.append("V1_3");
        break;
    case Opcodes.V1_4:
        buf.append("V1_4");
        break;
    case Opcodes.V1_5:
        buf.append("V1_5");
        break;
    case Opcodes.V1_6:
        buf.append("V1_6");
        break;
    case Opcodes.V1_7:
        buf.append("V1_7");
        break;
    default:
        buf.append(version);
        break;
    }
    buf.append(", ");
    appendAccess(access | ACCESS_CLASS);
    buf.append(", ");
    appendConstant(name);
    buf.append(", ");
    appendConstant(signature);
    buf.append(", ");
    appendConstant(superName);
    buf.append(", ");
    if (interfaces != null && interfaces.length > 0) {
        buf.append("new String[] {");
        for (int i = 0; i < interfaces.length; ++i) {
            buf.append(i == 0 ? " " : ", ");
            appendConstant(interfaces[i]);
        }
        buf.append(" }");
    } else {
        buf.append("null");
    }
    buf.append(");\n\n");
    text.add(buf.toString());
}
 
Example 2
Source File: ASMifier.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(final int version, final int access, final String name,
        final String signature, final String superName,
        final String[] interfaces) {
    String simpleName;
    int n = name.lastIndexOf('/');
    if (n == -1) {
        simpleName = name;
    } else {
        text.add("package asm." + name.substring(0, n).replace('/', '.')
                + ";\n");
        simpleName = name.substring(n + 1);
    }
    text.add("import java.util.*;\n");
    text.add("import jdk.internal.org.objectweb.asm.*;\n");
    text.add("public class " + simpleName + "Dump implements Opcodes {\n\n");
    text.add("public static byte[] dump () throws Exception {\n\n");
    text.add("ClassWriter cw = new ClassWriter(0);\n");
    text.add("FieldVisitor fv;\n");
    text.add("MethodVisitor mv;\n");
    text.add("AnnotationVisitor av0;\n\n");

    buf.setLength(0);
    buf.append("cw.visit(");
    switch (version) {
    case Opcodes.V1_1:
        buf.append("V1_1");
        break;
    case Opcodes.V1_2:
        buf.append("V1_2");
        break;
    case Opcodes.V1_3:
        buf.append("V1_3");
        break;
    case Opcodes.V1_4:
        buf.append("V1_4");
        break;
    case Opcodes.V1_5:
        buf.append("V1_5");
        break;
    case Opcodes.V1_6:
        buf.append("V1_6");
        break;
    case Opcodes.V1_7:
        buf.append("V1_7");
        break;
    default:
        buf.append(version);
        break;
    }
    buf.append(", ");
    appendAccess(access | ACCESS_CLASS);
    buf.append(", ");
    appendConstant(name);
    buf.append(", ");
    appendConstant(signature);
    buf.append(", ");
    appendConstant(superName);
    buf.append(", ");
    if (interfaces != null && interfaces.length > 0) {
        buf.append("new String[] {");
        for (int i = 0; i < interfaces.length; ++i) {
            buf.append(i == 0 ? " " : ", ");
            appendConstant(interfaces[i]);
        }
        buf.append(" }");
    } else {
        buf.append("null");
    }
    buf.append(");\n\n");
    text.add(buf.toString());
}
 
Example 3
Source File: ASMifier.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(final int version, final int access, final String name,
        final String signature, final String superName,
        final String[] interfaces) {
    String simpleName;
    int n = name.lastIndexOf('/');
    if (n == -1) {
        simpleName = name;
    } else {
        text.add("package asm." + name.substring(0, n).replace('/', '.')
                + ";\n");
        simpleName = name.substring(n + 1);
    }
    text.add("import java.util.*;\n");
    text.add("import jdk.internal.org.objectweb.asm.*;\n");
    text.add("public class " + simpleName + "Dump implements Opcodes {\n\n");
    text.add("public static byte[] dump () throws Exception {\n\n");
    text.add("ClassWriter cw = new ClassWriter(0);\n");
    text.add("FieldVisitor fv;\n");
    text.add("MethodVisitor mv;\n");
    text.add("AnnotationVisitor av0;\n\n");

    buf.setLength(0);
    buf.append("cw.visit(");
    switch (version) {
    case Opcodes.V1_1:
        buf.append("V1_1");
        break;
    case Opcodes.V1_2:
        buf.append("V1_2");
        break;
    case Opcodes.V1_3:
        buf.append("V1_3");
        break;
    case Opcodes.V1_4:
        buf.append("V1_4");
        break;
    case Opcodes.V1_5:
        buf.append("V1_5");
        break;
    case Opcodes.V1_6:
        buf.append("V1_6");
        break;
    case Opcodes.V1_7:
        buf.append("V1_7");
        break;
    default:
        buf.append(version);
        break;
    }
    buf.append(", ");
    appendAccess(access | ACCESS_CLASS);
    buf.append(", ");
    appendConstant(name);
    buf.append(", ");
    appendConstant(signature);
    buf.append(", ");
    appendConstant(superName);
    buf.append(", ");
    if (interfaces != null && interfaces.length > 0) {
        buf.append("new String[] {");
        for (int i = 0; i < interfaces.length; ++i) {
            buf.append(i == 0 ? " " : ", ");
            appendConstant(interfaces[i]);
        }
        buf.append(" }");
    } else {
        buf.append("null");
    }
    buf.append(");\n\n");
    text.add(buf.toString());
}
 
Example 4
Source File: ASMifier.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(final int version, final int access, final String name,
        final String signature, final String superName,
        final String[] interfaces) {
    String simpleName;
    int n = name.lastIndexOf('/');
    if (n == -1) {
        simpleName = name;
    } else {
        text.add("package asm." + name.substring(0, n).replace('/', '.')
                + ";\n");
        simpleName = name.substring(n + 1);
    }
    text.add("import java.util.*;\n");
    text.add("import jdk.internal.org.objectweb.asm.*;\n");
    text.add("public class " + simpleName + "Dump implements Opcodes {\n\n");
    text.add("public static byte[] dump () throws Exception {\n\n");
    text.add("ClassWriter cw = new ClassWriter(0);\n");
    text.add("FieldVisitor fv;\n");
    text.add("MethodVisitor mv;\n");
    text.add("AnnotationVisitor av0;\n\n");

    buf.setLength(0);
    buf.append("cw.visit(");
    switch (version) {
    case Opcodes.V1_1:
        buf.append("V1_1");
        break;
    case Opcodes.V1_2:
        buf.append("V1_2");
        break;
    case Opcodes.V1_3:
        buf.append("V1_3");
        break;
    case Opcodes.V1_4:
        buf.append("V1_4");
        break;
    case Opcodes.V1_5:
        buf.append("V1_5");
        break;
    case Opcodes.V1_6:
        buf.append("V1_6");
        break;
    case Opcodes.V1_7:
        buf.append("V1_7");
        break;
    default:
        buf.append(version);
        break;
    }
    buf.append(", ");
    appendAccess(access | ACCESS_CLASS);
    buf.append(", ");
    appendConstant(name);
    buf.append(", ");
    appendConstant(signature);
    buf.append(", ");
    appendConstant(superName);
    buf.append(", ");
    if (interfaces != null && interfaces.length > 0) {
        buf.append("new String[] {");
        for (int i = 0; i < interfaces.length; ++i) {
            buf.append(i == 0 ? " " : ", ");
            appendConstant(interfaces[i]);
        }
        buf.append(" }");
    } else {
        buf.append("null");
    }
    buf.append(");\n\n");
    text.add(buf.toString());
}
 
Example 5
Source File: ASMifier.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(final int version, final int access, final String name,
        final String signature, final String superName,
        final String[] interfaces) {
    String simpleName;
    int n = name.lastIndexOf('/');
    if (n == -1) {
        simpleName = name;
    } else {
        text.add("package asm." + name.substring(0, n).replace('/', '.')
                + ";\n");
        simpleName = name.substring(n + 1);
    }
    text.add("import java.util.*;\n");
    text.add("import jdk.internal.org.objectweb.asm.*;\n");
    text.add("public class " + simpleName + "Dump implements Opcodes {\n\n");
    text.add("public static byte[] dump () throws Exception {\n\n");
    text.add("ClassWriter cw = new ClassWriter(0);\n");
    text.add("FieldVisitor fv;\n");
    text.add("MethodVisitor mv;\n");
    text.add("AnnotationVisitor av0;\n\n");

    buf.setLength(0);
    buf.append("cw.visit(");
    switch (version) {
    case Opcodes.V1_1:
        buf.append("V1_1");
        break;
    case Opcodes.V1_2:
        buf.append("V1_2");
        break;
    case Opcodes.V1_3:
        buf.append("V1_3");
        break;
    case Opcodes.V1_4:
        buf.append("V1_4");
        break;
    case Opcodes.V1_5:
        buf.append("V1_5");
        break;
    case Opcodes.V1_6:
        buf.append("V1_6");
        break;
    case Opcodes.V1_7:
        buf.append("V1_7");
        break;
    default:
        buf.append(version);
        break;
    }
    buf.append(", ");
    appendAccess(access | ACCESS_CLASS);
    buf.append(", ");
    appendConstant(name);
    buf.append(", ");
    appendConstant(signature);
    buf.append(", ");
    appendConstant(superName);
    buf.append(", ");
    if (interfaces != null && interfaces.length > 0) {
        buf.append("new String[] {");
        for (int i = 0; i < interfaces.length; ++i) {
            buf.append(i == 0 ? " " : ", ");
            appendConstant(interfaces[i]);
        }
        buf.append(" }");
    } else {
        buf.append("null");
    }
    buf.append(");\n\n");
    text.add(buf.toString());
}
 
Example 6
Source File: ASMifier.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(final int version, final int access, final String name,
        final String signature, final String superName,
        final String[] interfaces) {
    String simpleName;
    int n = name.lastIndexOf('/');
    if (n == -1) {
        simpleName = name;
    } else {
        text.add("package asm." + name.substring(0, n).replace('/', '.')
                + ";\n");
        simpleName = name.substring(n + 1);
    }
    text.add("import java.util.*;\n");
    text.add("import jdk.internal.org.objectweb.asm.*;\n");
    text.add("public class " + simpleName + "Dump implements Opcodes {\n\n");
    text.add("public static byte[] dump () throws Exception {\n\n");
    text.add("ClassWriter cw = new ClassWriter(0);\n");
    text.add("FieldVisitor fv;\n");
    text.add("MethodVisitor mv;\n");
    text.add("AnnotationVisitor av0;\n\n");

    buf.setLength(0);
    buf.append("cw.visit(");
    switch (version) {
    case Opcodes.V1_1:
        buf.append("V1_1");
        break;
    case Opcodes.V1_2:
        buf.append("V1_2");
        break;
    case Opcodes.V1_3:
        buf.append("V1_3");
        break;
    case Opcodes.V1_4:
        buf.append("V1_4");
        break;
    case Opcodes.V1_5:
        buf.append("V1_5");
        break;
    case Opcodes.V1_6:
        buf.append("V1_6");
        break;
    case Opcodes.V1_7:
        buf.append("V1_7");
        break;
    default:
        buf.append(version);
        break;
    }
    buf.append(", ");
    appendAccess(access | ACCESS_CLASS);
    buf.append(", ");
    appendConstant(name);
    buf.append(", ");
    appendConstant(signature);
    buf.append(", ");
    appendConstant(superName);
    buf.append(", ");
    if (interfaces != null && interfaces.length > 0) {
        buf.append("new String[] {");
        for (int i = 0; i < interfaces.length; ++i) {
            buf.append(i == 0 ? " " : ", ");
            appendConstant(interfaces[i]);
        }
        buf.append(" }");
    } else {
        buf.append("null");
    }
    buf.append(");\n\n");
    text.add(buf.toString());
}
 
Example 7
Source File: ASMifier.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(final int version, final int access, final String name,
        final String signature, final String superName,
        final String[] interfaces) {
    String simpleName;
    int n = name.lastIndexOf('/');
    if (n == -1) {
        simpleName = name;
    } else {
        text.add("package asm." + name.substring(0, n).replace('/', '.')
                + ";\n");
        simpleName = name.substring(n + 1);
    }
    text.add("import java.util.*;\n");
    text.add("import jdk.internal.org.objectweb.asm.*;\n");
    text.add("public class " + simpleName + "Dump implements Opcodes {\n\n");
    text.add("public static byte[] dump () throws Exception {\n\n");
    text.add("ClassWriter cw = new ClassWriter(0);\n");
    text.add("FieldVisitor fv;\n");
    text.add("MethodVisitor mv;\n");
    text.add("AnnotationVisitor av0;\n\n");

    buf.setLength(0);
    buf.append("cw.visit(");
    switch (version) {
    case Opcodes.V1_1:
        buf.append("V1_1");
        break;
    case Opcodes.V1_2:
        buf.append("V1_2");
        break;
    case Opcodes.V1_3:
        buf.append("V1_3");
        break;
    case Opcodes.V1_4:
        buf.append("V1_4");
        break;
    case Opcodes.V1_5:
        buf.append("V1_5");
        break;
    case Opcodes.V1_6:
        buf.append("V1_6");
        break;
    case Opcodes.V1_7:
        buf.append("V1_7");
        break;
    default:
        buf.append(version);
        break;
    }
    buf.append(", ");
    appendAccess(access | ACCESS_CLASS);
    buf.append(", ");
    appendConstant(name);
    buf.append(", ");
    appendConstant(signature);
    buf.append(", ");
    appendConstant(superName);
    buf.append(", ");
    if (interfaces != null && interfaces.length > 0) {
        buf.append("new String[] {");
        for (int i = 0; i < interfaces.length; ++i) {
            buf.append(i == 0 ? " " : ", ");
            appendConstant(interfaces[i]);
        }
        buf.append(" }");
    } else {
        buf.append("null");
    }
    buf.append(");\n\n");
    text.add(buf.toString());
}
 
Example 8
Source File: ASMifier.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(final int version, final int access, final String name,
        final String signature, final String superName,
        final String[] interfaces) {
    String simpleName;
    int n = name.lastIndexOf('/');
    if (n == -1) {
        simpleName = name;
    } else {
        text.add("package asm." + name.substring(0, n).replace('/', '.')
                + ";\n");
        simpleName = name.substring(n + 1);
    }
    text.add("import java.util.*;\n");
    text.add("import jdk.internal.org.objectweb.asm.*;\n");
    text.add("public class " + simpleName + "Dump implements Opcodes {\n\n");
    text.add("public static byte[] dump () throws Exception {\n\n");
    text.add("ClassWriter cw = new ClassWriter(0);\n");
    text.add("FieldVisitor fv;\n");
    text.add("MethodVisitor mv;\n");
    text.add("AnnotationVisitor av0;\n\n");

    buf.setLength(0);
    buf.append("cw.visit(");
    switch (version) {
    case Opcodes.V1_1:
        buf.append("V1_1");
        break;
    case Opcodes.V1_2:
        buf.append("V1_2");
        break;
    case Opcodes.V1_3:
        buf.append("V1_3");
        break;
    case Opcodes.V1_4:
        buf.append("V1_4");
        break;
    case Opcodes.V1_5:
        buf.append("V1_5");
        break;
    case Opcodes.V1_6:
        buf.append("V1_6");
        break;
    case Opcodes.V1_7:
        buf.append("V1_7");
        break;
    default:
        buf.append(version);
        break;
    }
    buf.append(", ");
    appendAccess(access | ACCESS_CLASS);
    buf.append(", ");
    appendConstant(name);
    buf.append(", ");
    appendConstant(signature);
    buf.append(", ");
    appendConstant(superName);
    buf.append(", ");
    if (interfaces != null && interfaces.length > 0) {
        buf.append("new String[] {");
        for (int i = 0; i < interfaces.length; ++i) {
            buf.append(i == 0 ? " " : ", ");
            appendConstant(interfaces[i]);
        }
        buf.append(" }");
    } else {
        buf.append("null");
    }
    buf.append(");\n\n");
    text.add(buf.toString());
}
 
Example 9
Source File: ASMifier.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(final int version, final int access, final String name,
        final String signature, final String superName,
        final String[] interfaces) {
    String simpleName;
    int n = name.lastIndexOf('/');
    if (n == -1) {
        simpleName = name;
    } else {
        text.add("package asm." + name.substring(0, n).replace('/', '.')
                + ";\n");
        simpleName = name.substring(n + 1);
    }
    text.add("import java.util.*;\n");
    text.add("import jdk.internal.org.objectweb.asm.*;\n");
    text.add("import jdk.internal.org.objectweb.asm.attrs.*;\n");
    text.add("public class " + simpleName + "Dump implements Opcodes {\n\n");
    text.add("public static byte[] dump () throws Exception {\n\n");
    text.add("ClassWriter cw = new ClassWriter(0);\n");
    text.add("FieldVisitor fv;\n");
    text.add("MethodVisitor mv;\n");
    text.add("AnnotationVisitor av0;\n\n");

    buf.setLength(0);
    buf.append("cw.visit(");
    switch (version) {
    case Opcodes.V1_1:
        buf.append("V1_1");
        break;
    case Opcodes.V1_2:
        buf.append("V1_2");
        break;
    case Opcodes.V1_3:
        buf.append("V1_3");
        break;
    case Opcodes.V1_4:
        buf.append("V1_4");
        break;
    case Opcodes.V1_5:
        buf.append("V1_5");
        break;
    case Opcodes.V1_6:
        buf.append("V1_6");
        break;
    case Opcodes.V1_7:
        buf.append("V1_7");
        break;
    default:
        buf.append(version);
        break;
    }
    buf.append(", ");
    appendAccess(access | ACCESS_CLASS);
    buf.append(", ");
    appendConstant(name);
    buf.append(", ");
    appendConstant(signature);
    buf.append(", ");
    appendConstant(superName);
    buf.append(", ");
    if (interfaces != null && interfaces.length > 0) {
        buf.append("new String[] {");
        for (int i = 0; i < interfaces.length; ++i) {
            buf.append(i == 0 ? " " : ", ");
            appendConstant(interfaces[i]);
        }
        buf.append(" }");
    } else {
        buf.append("null");
    }
    buf.append(");\n\n");
    text.add(buf.toString());
}
 
Example 10
Source File: ASMifier.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(final int version, final int access, final String name,
        final String signature, final String superName,
        final String[] interfaces) {
    String simpleName;
    int n = name.lastIndexOf('/');
    if (n == -1) {
        simpleName = name;
    } else {
        text.add("package asm." + name.substring(0, n).replace('/', '.')
                + ";\n");
        simpleName = name.substring(n + 1);
    }
    text.add("import java.util.*;\n");
    text.add("import jdk.internal.org.objectweb.asm.*;\n");
    text.add("import jdk.internal.org.objectweb.asm.attrs.*;\n");
    text.add("public class " + simpleName + "Dump implements Opcodes {\n\n");
    text.add("public static byte[] dump () throws Exception {\n\n");
    text.add("ClassWriter cw = new ClassWriter(0);\n");
    text.add("FieldVisitor fv;\n");
    text.add("MethodVisitor mv;\n");
    text.add("AnnotationVisitor av0;\n\n");

    buf.setLength(0);
    buf.append("cw.visit(");
    switch (version) {
    case Opcodes.V1_1:
        buf.append("V1_1");
        break;
    case Opcodes.V1_2:
        buf.append("V1_2");
        break;
    case Opcodes.V1_3:
        buf.append("V1_3");
        break;
    case Opcodes.V1_4:
        buf.append("V1_4");
        break;
    case Opcodes.V1_5:
        buf.append("V1_5");
        break;
    case Opcodes.V1_6:
        buf.append("V1_6");
        break;
    case Opcodes.V1_7:
        buf.append("V1_7");
        break;
    default:
        buf.append(version);
        break;
    }
    buf.append(", ");
    appendAccess(access | ACCESS_CLASS);
    buf.append(", ");
    appendConstant(name);
    buf.append(", ");
    appendConstant(signature);
    buf.append(", ");
    appendConstant(superName);
    buf.append(", ");
    if (interfaces != null && interfaces.length > 0) {
        buf.append("new String[] {");
        for (int i = 0; i < interfaces.length; ++i) {
            buf.append(i == 0 ? " " : ", ");
            appendConstant(interfaces[i]);
        }
        buf.append(" }");
    } else {
        buf.append("null");
    }
    buf.append(");\n\n");
    text.add(buf.toString());
}
 
Example 11
Source File: ASMifier.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(final int version, final int access, final String name,
        final String signature, final String superName,
        final String[] interfaces) {
    String simpleName;
    int n = name.lastIndexOf('/');
    if (n == -1) {
        simpleName = name;
    } else {
        text.add("package asm." + name.substring(0, n).replace('/', '.')
                + ";\n");
        simpleName = name.substring(n + 1);
    }
    text.add("import java.util.*;\n");
    text.add("import jdk.internal.org.objectweb.asm.*;\n");
    text.add("public class " + simpleName + "Dump implements Opcodes {\n\n");
    text.add("public static byte[] dump () throws Exception {\n\n");
    text.add("ClassWriter cw = new ClassWriter(0);\n");
    text.add("FieldVisitor fv;\n");
    text.add("MethodVisitor mv;\n");
    text.add("AnnotationVisitor av0;\n\n");

    buf.setLength(0);
    buf.append("cw.visit(");
    switch (version) {
    case Opcodes.V1_1:
        buf.append("V1_1");
        break;
    case Opcodes.V1_2:
        buf.append("V1_2");
        break;
    case Opcodes.V1_3:
        buf.append("V1_3");
        break;
    case Opcodes.V1_4:
        buf.append("V1_4");
        break;
    case Opcodes.V1_5:
        buf.append("V1_5");
        break;
    case Opcodes.V1_6:
        buf.append("V1_6");
        break;
    case Opcodes.V1_7:
        buf.append("V1_7");
        break;
    default:
        buf.append(version);
        break;
    }
    buf.append(", ");
    appendAccess(access | ACCESS_CLASS);
    buf.append(", ");
    appendConstant(name);
    buf.append(", ");
    appendConstant(signature);
    buf.append(", ");
    appendConstant(superName);
    buf.append(", ");
    if (interfaces != null && interfaces.length > 0) {
        buf.append("new String[] {");
        for (int i = 0; i < interfaces.length; ++i) {
            buf.append(i == 0 ? " " : ", ");
            appendConstant(interfaces[i]);
        }
        buf.append(" }");
    } else {
        buf.append("null");
    }
    buf.append(");\n\n");
    text.add(buf.toString());
}
 
Example 12
Source File: ASMifier.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(final int version, final int access, final String name,
        final String signature, final String superName,
        final String[] interfaces) {
    String simpleName;
    int n = name.lastIndexOf('/');
    if (n == -1) {
        simpleName = name;
    } else {
        text.add("package asm." + name.substring(0, n).replace('/', '.')
                + ";\n");
        simpleName = name.substring(n + 1);
    }
    text.add("import java.util.*;\n");
    text.add("import jdk.internal.org.objectweb.asm.*;\n");
    text.add("public class " + simpleName + "Dump implements Opcodes {\n\n");
    text.add("public static byte[] dump () throws Exception {\n\n");
    text.add("ClassWriter cw = new ClassWriter(0);\n");
    text.add("FieldVisitor fv;\n");
    text.add("MethodVisitor mv;\n");
    text.add("AnnotationVisitor av0;\n\n");

    buf.setLength(0);
    buf.append("cw.visit(");
    switch (version) {
    case Opcodes.V1_1:
        buf.append("V1_1");
        break;
    case Opcodes.V1_2:
        buf.append("V1_2");
        break;
    case Opcodes.V1_3:
        buf.append("V1_3");
        break;
    case Opcodes.V1_4:
        buf.append("V1_4");
        break;
    case Opcodes.V1_5:
        buf.append("V1_5");
        break;
    case Opcodes.V1_6:
        buf.append("V1_6");
        break;
    case Opcodes.V1_7:
        buf.append("V1_7");
        break;
    default:
        buf.append(version);
        break;
    }
    buf.append(", ");
    appendAccess(access | ACCESS_CLASS);
    buf.append(", ");
    appendConstant(name);
    buf.append(", ");
    appendConstant(signature);
    buf.append(", ");
    appendConstant(superName);
    buf.append(", ");
    if (interfaces != null && interfaces.length > 0) {
        buf.append("new String[] {");
        for (int i = 0; i < interfaces.length; ++i) {
            buf.append(i == 0 ? " " : ", ");
            appendConstant(interfaces[i]);
        }
        buf.append(" }");
    } else {
        buf.append("null");
    }
    buf.append(");\n\n");
    text.add(buf.toString());
}
 
Example 13
Source File: ASMifier.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(final int version, final int access, final String name,
        final String signature, final String superName,
        final String[] interfaces) {
    String simpleName;
    int n = name.lastIndexOf('/');
    if (n == -1) {
        simpleName = name;
    } else {
        text.add("package asm." + name.substring(0, n).replace('/', '.')
                + ";\n");
        simpleName = name.substring(n + 1);
    }
    text.add("import java.util.*;\n");
    text.add("import jdk.internal.org.objectweb.asm.*;\n");
    text.add("public class " + simpleName + "Dump implements Opcodes {\n\n");
    text.add("public static byte[] dump () throws Exception {\n\n");
    text.add("ClassWriter cw = new ClassWriter(0);\n");
    text.add("FieldVisitor fv;\n");
    text.add("MethodVisitor mv;\n");
    text.add("AnnotationVisitor av0;\n\n");

    buf.setLength(0);
    buf.append("cw.visit(");
    switch (version) {
    case Opcodes.V1_1:
        buf.append("V1_1");
        break;
    case Opcodes.V1_2:
        buf.append("V1_2");
        break;
    case Opcodes.V1_3:
        buf.append("V1_3");
        break;
    case Opcodes.V1_4:
        buf.append("V1_4");
        break;
    case Opcodes.V1_5:
        buf.append("V1_5");
        break;
    case Opcodes.V1_6:
        buf.append("V1_6");
        break;
    case Opcodes.V1_7:
        buf.append("V1_7");
        break;
    default:
        buf.append(version);
        break;
    }
    buf.append(", ");
    appendAccess(access | ACCESS_CLASS);
    buf.append(", ");
    appendConstant(name);
    buf.append(", ");
    appendConstant(signature);
    buf.append(", ");
    appendConstant(superName);
    buf.append(", ");
    if (interfaces != null && interfaces.length > 0) {
        buf.append("new String[] {");
        for (int i = 0; i < interfaces.length; ++i) {
            buf.append(i == 0 ? " " : ", ");
            appendConstant(interfaces[i]);
        }
        buf.append(" }");
    } else {
        buf.append("null");
    }
    buf.append(");\n\n");
    text.add(buf.toString());
}
 
Example 14
Source File: ASMifier.java    From nashorn with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visit(
    final int version,
    final int access,
    final String name,
    final String signature,
    final String superName,
    final String[] interfaces)
{
    String simpleName;
    int n = name.lastIndexOf('/');
    if (n == -1) {
        simpleName = name;
    } else {
        text.add("package asm." + name.substring(0, n).replace('/', '.')
                + ";\n");
        simpleName = name.substring(n + 1);
    }
    text.add("import java.util.*;\n");
    text.add("import jdk.internal.org.objectweb.asm.*;\n");
    text.add("import jdk.internal.org.objectweb.asm.attrs.*;\n");
    text.add("public class " + simpleName + "Dump implements Opcodes {\n\n");
    text.add("public static byte[] dump () throws Exception {\n\n");
    text.add("ClassWriter cw = new ClassWriter(0);\n");
    text.add("FieldVisitor fv;\n");
    text.add("MethodVisitor mv;\n");
    text.add("AnnotationVisitor av0;\n\n");

    buf.setLength(0);
    buf.append("cw.visit(");
    switch (version) {
        case Opcodes.V1_1:
            buf.append("V1_1");
            break;
        case Opcodes.V1_2:
            buf.append("V1_2");
            break;
        case Opcodes.V1_3:
            buf.append("V1_3");
            break;
        case Opcodes.V1_4:
            buf.append("V1_4");
            break;
        case Opcodes.V1_5:
            buf.append("V1_5");
            break;
        case Opcodes.V1_6:
            buf.append("V1_6");
            break;
        case Opcodes.V1_7:
            buf.append("V1_7");
            break;
        default:
            buf.append(version);
            break;
    }
    buf.append(", ");
    appendAccess(access | ACCESS_CLASS);
    buf.append(", ");
    appendConstant(name);
    buf.append(", ");
    appendConstant(signature);
    buf.append(", ");
    appendConstant(superName);
    buf.append(", ");
    if (interfaces != null && interfaces.length > 0) {
        buf.append("new String[] {");
        for (int i = 0; i < interfaces.length; ++i) {
            buf.append(i == 0 ? " " : ", ");
            appendConstant(interfaces[i]);
        }
        buf.append(" }");
    } else {
        buf.append("null");
    }
    buf.append(");\n\n");
    text.add(buf.toString());
}