Java Code Examples for jdk.internal.org.objectweb.asm.signature.SignatureReader#acceptType()

The following examples show how to use jdk.internal.org.objectweb.asm.signature.SignatureReader#acceptType() . 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: Textifier.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void visitLocalVariable(final String name, final String desc,
        final String signature, final Label start, final Label end,
        final int index) {
    buf.setLength(0);
    buf.append(tab2).append("LOCALVARIABLE ").append(name).append(' ');
    appendDescriptor(FIELD_DESCRIPTOR, desc);
    buf.append(' ');
    appendLabel(start);
    buf.append(' ');
    appendLabel(end);
    buf.append(' ').append(index).append('\n');

    if (signature != null) {
        buf.append(tab2);
        appendDescriptor(FIELD_SIGNATURE, signature);

        TraceSignatureVisitor sv = new TraceSignatureVisitor(0);
        SignatureReader r = new SignatureReader(signature);
        r.acceptType(sv);
        buf.append(tab2).append("// declaration: ")
                .append(sv.getDeclaration()).append('\n');
    }
    text.add(buf.toString());
}
 
Example 2
Source File: Textifier.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void visitLocalVariable(final String name, final String desc,
        final String signature, final Label start, final Label end,
        final int index) {
    buf.setLength(0);
    buf.append(tab2).append("LOCALVARIABLE ").append(name).append(' ');
    appendDescriptor(FIELD_DESCRIPTOR, desc);
    buf.append(' ');
    appendLabel(start);
    buf.append(' ');
    appendLabel(end);
    buf.append(' ').append(index).append('\n');

    if (signature != null) {
        buf.append(tab2);
        appendDescriptor(FIELD_SIGNATURE, signature);

        TraceSignatureVisitor sv = new TraceSignatureVisitor(0);
        SignatureReader r = new SignatureReader(signature);
        r.acceptType(sv);
        buf.append(tab2).append("// declaration: ")
                .append(sv.getDeclaration()).append('\n');
    }
    text.add(buf.toString());
}
 
Example 3
Source File: Remapper.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 * @param typeSignature
 *            true if signature is a FieldTypeSignature, such as the
 *            signature parameter of the ClassVisitor.visitField or
 *            MethodVisitor.visitLocalVariable methods
 */
public String mapSignature(String signature, boolean typeSignature) {
    if (signature == null) {
        return null;
    }
    SignatureReader r = new SignatureReader(signature);
    SignatureWriter w = new SignatureWriter();
    SignatureVisitor a = createRemappingSignatureAdapter(w);
    if (typeSignature) {
        r.acceptType(a);
    } else {
        r.accept(a);
    }
    return w.toString();
}
 
Example 4
Source File: Remapper.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 * @param typeSignature
 *            true if signature is a FieldTypeSignature, such as the
 *            signature parameter of the ClassVisitor.visitField or
 *            MethodVisitor.visitLocalVariable methods
 */
public String mapSignature(String signature, boolean typeSignature) {
    if (signature == null) {
        return null;
    }
    SignatureReader r = new SignatureReader(signature);
    SignatureWriter w = new SignatureWriter();
    SignatureVisitor a = createRemappingSignatureAdapter(w);
    if (typeSignature) {
        r.acceptType(a);
    } else {
        r.accept(a);
    }
    return w.toString();
}
 
Example 5
Source File: Remapper.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 * @param typeSignature
 *            true if signature is a FieldTypeSignature, such as the
 *            signature parameter of the ClassVisitor.visitField or
 *            MethodVisitor.visitLocalVariable methods
 */
public String mapSignature(String signature, boolean typeSignature) {
    if (signature == null) {
        return null;
    }
    SignatureReader r = new SignatureReader(signature);
    SignatureWriter w = new SignatureWriter();
    SignatureVisitor a = createRemappingSignatureAdapter(w);
    if (typeSignature) {
        r.acceptType(a);
    } else {
        r.accept(a);
    }
    return w.toString();
}
 
Example 6
Source File: Remapper.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param signature
 *            signature for mapper
 * @param typeSignature
 *            true if signature is a FieldTypeSignature, such as the
 *            signature parameter of the ClassVisitor.visitField or
 *            MethodVisitor.visitLocalVariable methods
 * @return signature rewritten as a string
 */
public String mapSignature(String signature, boolean typeSignature) {
    if (signature == null) {
        return null;
    }
    SignatureReader r = new SignatureReader(signature);
    SignatureWriter w = new SignatureWriter();
    SignatureVisitor a = createSignatureRemapper(w);
    if (typeSignature) {
        r.acceptType(a);
    } else {
        r.accept(a);
    }
    return w.toString();
}
 
Example 7
Source File: Remapper.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 * @param typeSignature
 *            true if signature is a FieldTypeSignature, such as the
 *            signature parameter of the ClassVisitor.visitField or
 *            MethodVisitor.visitLocalVariable methods
 */
public String mapSignature(String signature, boolean typeSignature) {
    if (signature == null) {
        return null;
    }
    SignatureReader r = new SignatureReader(signature);
    SignatureWriter w = new SignatureWriter();
    SignatureVisitor a = createRemappingSignatureAdapter(w);
    if (typeSignature) {
        r.acceptType(a);
    } else {
        r.accept(a);
    }
    return w.toString();
}
 
Example 8
Source File: Remapper.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 * @param typeSignature
 *            true if signature is a FieldTypeSignature, such as the
 *            signature parameter of the ClassVisitor.visitField or
 *            MethodVisitor.visitLocalVariable methods
 */
public String mapSignature(String signature, boolean typeSignature) {
    if (signature == null) {
        return null;
    }
    SignatureReader r = new SignatureReader(signature);
    SignatureWriter w = new SignatureWriter();
    SignatureVisitor a = createRemappingSignatureAdapter(w);
    if (typeSignature) {
        r.acceptType(a);
    } else {
        r.accept(a);
    }
    return w.toString();
}
 
Example 9
Source File: Textifier.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Textifier visitField(final int access, final String name,
        final String desc, final String signature, final Object value) {
    buf.setLength(0);
    buf.append('\n');
    if ((access & Opcodes.ACC_DEPRECATED) != 0) {
        buf.append(tab).append("// DEPRECATED\n");
    }
    buf.append(tab).append("// access flags 0x")
            .append(Integer.toHexString(access).toUpperCase()).append('\n');
    if (signature != null) {
        buf.append(tab);
        appendDescriptor(FIELD_SIGNATURE, signature);

        TraceSignatureVisitor sv = new TraceSignatureVisitor(0);
        SignatureReader r = new SignatureReader(signature);
        r.acceptType(sv);
        buf.append(tab).append("// declaration: ")
                .append(sv.getDeclaration()).append('\n');
    }

    buf.append(tab);
    appendAccess(access);

    appendDescriptor(FIELD_DESCRIPTOR, desc);
    buf.append(' ').append(name);
    if (value != null) {
        buf.append(" = ");
        if (value instanceof String) {
            buf.append('\"').append(value).append('\"');
        } else {
            buf.append(value);
        }
    }

    buf.append('\n');
    text.add(buf.toString());

    Textifier t = createTextifier();
    text.add(t.getText());
    return t;
}
 
Example 10
Source File: NashornTextifier.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visitLocalVariable(final String name, final String desc,final String signature, final Label start, final Label end, final int index) {

    final StringBuilder sb = new StringBuilder();
    if (!localVarsStarted) {
        text.add("\n");
        localVarsStarted = true;
        graph.addNode("vars");
        currentBlock = "vars";
    }

    sb.append(tab2).append("local ").append(name).append(' ');
    final int len = sb.length();
    for (int i = 0; i < 25 - len; i++) {
        sb.append(' ');
    }
    String label;

    label = appendLabel(sb, start);
    for (int i = 0; i < 5 - label.length(); i++) {
        sb.append(' ');
    }
    label = appendLabel(sb, end);
    for (int i = 0; i < 5 - label.length(); i++) {
        sb.append(' ');
    }

    sb.append(index).append(tab2);

    appendDescriptor(sb, FIELD_DESCRIPTOR, desc);
    sb.append('\n');

    if (signature != null) {
        sb.append(tab2);
        appendDescriptor(sb, FIELD_SIGNATURE, signature);

        final TraceSignatureVisitor sv = new TraceSignatureVisitor(0);
        final SignatureReader r = new SignatureReader(signature);
        r.acceptType(sv);
        sb.append(tab2).append("// declaration: ")
                .append(sv.getDeclaration()).append('\n');
    }
    addText(sb.toString());
}
 
Example 11
Source File: NashornTextifier.java    From jdk8u_nashorn with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visitLocalVariable(final String name, final String desc,final String signature, final Label start, final Label end, final int index) {

    final StringBuilder sb = new StringBuilder();
    if (!localVarsStarted) {
        text.add("\n");
        localVarsStarted = true;
        graph.addNode("vars");
        currentBlock = "vars";
    }

    sb.append(tab2).append("local ").append(name).append(' ');
    final int len = sb.length();
    for (int i = 0; i < 25 - len; i++) {
        sb.append(' ');
    }
    String label;

    label = appendLabel(sb, start);
    for (int i = 0; i < 5 - label.length(); i++) {
        sb.append(' ');
    }
    label = appendLabel(sb, end);
    for (int i = 0; i < 5 - label.length(); i++) {
        sb.append(' ');
    }

    sb.append(index).append(tab2);

    appendDescriptor(sb, FIELD_DESCRIPTOR, desc);
    sb.append('\n');

    if (signature != null) {
        sb.append(tab2);
        appendDescriptor(sb, FIELD_SIGNATURE, signature);

        final TraceSignatureVisitor sv = new TraceSignatureVisitor(0);
        final SignatureReader r = new SignatureReader(signature);
        r.acceptType(sv);
        sb.append(tab2).append("// declaration: ")
                .append(sv.getDeclaration()).append('\n');
    }
    addText(sb.toString());
}
 
Example 12
Source File: NashornTextifier.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
    public NashornTextifier visitField(final int access, final String name, final String desc, final String signature, final Object value) {
        final StringBuilder sb = new StringBuilder();
//        sb.append('\n');
        if ((access & Opcodes.ACC_DEPRECATED) != 0) {
            sb.append(tab).append("// DEPRECATED\n");
        }

/*        sb.append(tab).
            append("// access flags 0x").
            append(Integer.toHexString(access).toUpperCase()).
            append('\n');
*/

        if (signature != null) {
            sb.append(tab);
            appendDescriptor(sb, FIELD_SIGNATURE, signature);

            final TraceSignatureVisitor sv = new TraceSignatureVisitor(0);
            final SignatureReader r = new SignatureReader(signature);
            r.acceptType(sv);
            sb.append(tab).
                append("// declaration: ").
                append(sv.getDeclaration()).
                append('\n');
        }

        sb.append(tab);
        appendAccess(sb, access);

        final String prunedDesc = desc.endsWith(";") ? desc.substring(0, desc.length() - 1) : desc;
        appendDescriptor(sb, FIELD_DESCRIPTOR, prunedDesc);
        sb.append(' ').append(name);
        if (value != null) {
            sb.append(" = ");
            if (value instanceof String) {
                sb.append('\"').append(value).append('\"');
            } else {
                sb.append(value);
            }
        }

        sb.append(";\n");
        addText(sb);

        final NashornTextifier t = createNashornTextifier();
        addText(t.getText());

        return t;
    }
 
Example 13
Source File: NashornTextifier.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
    public NashornTextifier visitField(final int access, final String name, final String desc, final String signature, final Object value) {
        final StringBuilder sb = new StringBuilder();
//        sb.append('\n');
        if ((access & Opcodes.ACC_DEPRECATED) != 0) {
            sb.append(tab).append("// DEPRECATED\n");
        }

/*        sb.append(tab).
            append("// access flags 0x").
            append(Integer.toHexString(access).toUpperCase()).
            append('\n');
*/

        if (signature != null) {
            sb.append(tab);
            appendDescriptor(sb, FIELD_SIGNATURE, signature);

            final TraceSignatureVisitor sv = new TraceSignatureVisitor(0);
            final SignatureReader r = new SignatureReader(signature);
            r.acceptType(sv);
            sb.append(tab).
                append("// declaration: ").
                append(sv.getDeclaration()).
                append('\n');
        }

        sb.append(tab);
        appendAccess(sb, access);

        final String prunedDesc = desc.endsWith(";") ? desc.substring(0, desc.length() - 1) : desc;
        appendDescriptor(sb, FIELD_DESCRIPTOR, prunedDesc);
        sb.append(' ').append(name);
        if (value != null) {
            sb.append(" = ");
            if (value instanceof String) {
                sb.append('\"').append(value).append('\"');
            } else {
                sb.append(value);
            }
        }

        sb.append(";\n");
        addText(sb);

        final NashornTextifier t = createNashornTextifier();
        addText(t.getText());

        return t;
    }
 
Example 14
Source File: NashornTextifier.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visitLocalVariable(final String name, final String desc,final String signature, final Label start, final Label end, final int index) {

    final StringBuilder sb = new StringBuilder();
    if (!localVarsStarted) {
        text.add("\n");
        localVarsStarted = true;
        graph.addNode("vars");
        currentBlock = "vars";
    }

    sb.append(tab2).append("local ").append(name).append(' ');
    final int len = sb.length();
    for (int i = 0; i < 25 - len; i++) {
        sb.append(' ');
    }
    String label;

    label = appendLabel(sb, start);
    for (int i = 0; i < 5 - label.length(); i++) {
        sb.append(' ');
    }
    label = appendLabel(sb, end);
    for (int i = 0; i < 5 - label.length(); i++) {
        sb.append(' ');
    }

    sb.append(index).append(tab2);

    appendDescriptor(sb, FIELD_DESCRIPTOR, desc);
    sb.append('\n');

    if (signature != null) {
        sb.append(tab2);
        appendDescriptor(sb, FIELD_SIGNATURE, signature);

        final TraceSignatureVisitor sv = new TraceSignatureVisitor(0);
        final SignatureReader r = new SignatureReader(signature);
        r.acceptType(sv);
        sb.append(tab2).append("// declaration: ")
                .append(sv.getDeclaration()).append('\n');
    }
    addText(sb.toString());
}
 
Example 15
Source File: NashornTextifier.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visitLocalVariable(final String name, final String desc,final String signature, final Label start, final Label end, final int index) {

    final StringBuilder sb = new StringBuilder();
    if (!localVarsStarted) {
        text.add("\n");
        localVarsStarted = true;
        graph.addNode("vars");
        currentBlock = "vars";
    }

    sb.append(tab2).append("local ").append(name).append(' ');
    final int len = sb.length();
    for (int i = 0; i < 25 - len; i++) {
        sb.append(' ');
    }
    String label;

    label = appendLabel(sb, start);
    for (int i = 0; i < 5 - label.length(); i++) {
        sb.append(' ');
    }
    label = appendLabel(sb, end);
    for (int i = 0; i < 5 - label.length(); i++) {
        sb.append(' ');
    }

    sb.append(index).append(tab2);

    appendDescriptor(sb, FIELD_DESCRIPTOR, desc);
    sb.append('\n');

    if (signature != null) {
        sb.append(tab2);
        appendDescriptor(sb, FIELD_SIGNATURE, signature);

        final TraceSignatureVisitor sv = new TraceSignatureVisitor(0);
        final SignatureReader r = new SignatureReader(signature);
        r.acceptType(sv);
        sb.append(tab2).append("// declaration: ")
                .append(sv.getDeclaration()).append('\n');
    }
    addText(sb.toString());
}
 
Example 16
Source File: NashornTextifier.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
    public NashornTextifier visitField(final int access, final String name, final String desc, final String signature, final Object value) {
        final StringBuilder sb = new StringBuilder();
//        sb.append('\n');
        if ((access & Opcodes.ACC_DEPRECATED) != 0) {
            sb.append(tab).append("// DEPRECATED\n");
        }

/*        sb.append(tab).
            append("// access flags 0x").
            append(Integer.toHexString(access).toUpperCase()).
            append('\n');
*/

        if (signature != null) {
            sb.append(tab);
            appendDescriptor(sb, FIELD_SIGNATURE, signature);

            final TraceSignatureVisitor sv = new TraceSignatureVisitor(0);
            final SignatureReader r = new SignatureReader(signature);
            r.acceptType(sv);
            sb.append(tab).
                append("// declaration: ").
                append(sv.getDeclaration()).
                append('\n');
        }

        sb.append(tab);
        appendAccess(sb, access);

        final String prunedDesc = desc.endsWith(";") ? desc.substring(0, desc.length() - 1) : desc;
        appendDescriptor(sb, FIELD_DESCRIPTOR, prunedDesc);
        sb.append(' ').append(name);
        if (value != null) {
            sb.append(" = ");
            if (value instanceof String) {
                sb.append('\"').append(value).append('\"');
            } else {
                sb.append(value);
            }
        }

        sb.append(";\n");
        addText(sb);

        final NashornTextifier t = createNashornTextifier();
        addText(t.getText());

        return t;
    }
 
Example 17
Source File: Textifier.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Textifier visitField(final int access, final String name,
        final String desc, final String signature, final Object value) {
    buf.setLength(0);
    buf.append('\n');
    if ((access & Opcodes.ACC_DEPRECATED) != 0) {
        buf.append(tab).append("// DEPRECATED\n");
    }
    buf.append(tab).append("// access flags 0x")
            .append(Integer.toHexString(access).toUpperCase()).append('\n');
    if (signature != null) {
        buf.append(tab);
        appendDescriptor(FIELD_SIGNATURE, signature);

        TraceSignatureVisitor sv = new TraceSignatureVisitor(0);
        SignatureReader r = new SignatureReader(signature);
        r.acceptType(sv);
        buf.append(tab).append("// declaration: ")
                .append(sv.getDeclaration()).append('\n');
    }

    buf.append(tab);
    appendAccess(access);

    appendDescriptor(FIELD_DESCRIPTOR, desc);
    buf.append(' ').append(name);
    if (value != null) {
        buf.append(" = ");
        if (value instanceof String) {
            buf.append('\"').append(value).append('\"');
        } else {
            buf.append(value);
        }
    }

    buf.append('\n');
    text.add(buf.toString());

    Textifier t = createTextifier();
    text.add(t.getText());
    return t;
}
 
Example 18
Source File: Textifier.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Textifier visitField(final int access, final String name,
        final String desc, final String signature, final Object value) {
    buf.setLength(0);
    buf.append('\n');
    if ((access & Opcodes.ACC_DEPRECATED) != 0) {
        buf.append(tab).append("// DEPRECATED\n");
    }
    buf.append(tab).append("// access flags 0x")
            .append(Integer.toHexString(access).toUpperCase()).append('\n');
    if (signature != null) {
        buf.append(tab);
        appendDescriptor(FIELD_SIGNATURE, signature);

        TraceSignatureVisitor sv = new TraceSignatureVisitor(0);
        SignatureReader r = new SignatureReader(signature);
        r.acceptType(sv);
        buf.append(tab).append("// declaration: ")
                .append(sv.getDeclaration()).append('\n');
    }

    buf.append(tab);
    appendAccess(access);

    appendDescriptor(FIELD_DESCRIPTOR, desc);
    buf.append(' ').append(name);
    if (value != null) {
        buf.append(" = ");
        if (value instanceof String) {
            buf.append('\"').append(value).append('\"');
        } else {
            buf.append(value);
        }
    }

    buf.append('\n');
    text.add(buf.toString());

    Textifier t = createTextifier();
    text.add(t.getText());
    return t;
}
 
Example 19
Source File: NashornTextifier.java    From jdk8u_nashorn with GNU General Public License v2.0 4 votes vote down vote up
@Override
    public NashornTextifier visitField(final int access, final String name, final String desc, final String signature, final Object value) {
        final StringBuilder sb = new StringBuilder();
//        sb.append('\n');
        if ((access & Opcodes.ACC_DEPRECATED) != 0) {
            sb.append(tab).append("// DEPRECATED\n");
        }

/*        sb.append(tab).
            append("// access flags 0x").
            append(Integer.toHexString(access).toUpperCase()).
            append('\n');
*/

        if (signature != null) {
            sb.append(tab);
            appendDescriptor(sb, FIELD_SIGNATURE, signature);

            final TraceSignatureVisitor sv = new TraceSignatureVisitor(0);
            final SignatureReader r = new SignatureReader(signature);
            r.acceptType(sv);
            sb.append(tab).
                append("// declaration: ").
                append(sv.getDeclaration()).
                append('\n');
        }

        sb.append(tab);
        appendAccess(sb, access);

        final String prunedDesc = desc.endsWith(";") ? desc.substring(0, desc.length() - 1) : desc;
        appendDescriptor(sb, FIELD_DESCRIPTOR, prunedDesc);
        sb.append(' ').append(name);
        if (value != null) {
            sb.append(" = ");
            if (value instanceof String) {
                sb.append('\"').append(value).append('\"');
            } else {
                sb.append(value);
            }
        }

        sb.append(";\n");
        addText(sb);

        final NashornTextifier t = createNashornTextifier();
        addText(t.getText());

        return t;
    }
 
Example 20
Source File: Textifier.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Textifier visitField(final int access, final String name,
        final String desc, final String signature, final Object value) {
    buf.setLength(0);
    buf.append('\n');
    if ((access & Opcodes.ACC_DEPRECATED) != 0) {
        buf.append(tab).append("// DEPRECATED\n");
    }
    buf.append(tab).append("// access flags 0x")
            .append(Integer.toHexString(access).toUpperCase()).append('\n');
    if (signature != null) {
        buf.append(tab);
        appendDescriptor(FIELD_SIGNATURE, signature);

        TraceSignatureVisitor sv = new TraceSignatureVisitor(0);
        SignatureReader r = new SignatureReader(signature);
        r.acceptType(sv);
        buf.append(tab).append("// declaration: ")
                .append(sv.getDeclaration()).append('\n');
    }

    buf.append(tab);
    appendAccess(access);

    appendDescriptor(FIELD_DESCRIPTOR, desc);
    buf.append(' ').append(name);
    if (value != null) {
        buf.append(" = ");
        if (value instanceof String) {
            buf.append('\"').append(value).append('\"');
        } else {
            buf.append(value);
        }
    }

    buf.append('\n');
    text.add(buf.toString());

    Textifier t = createTextifier();
    text.add(t.getText());
    return t;
}