• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TraceSignatureVisitor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中jdk.internal.org.objectweb.asm.util.TraceSignatureVisitor的典型用法代码示例。如果您正苦于以下问题:Java TraceSignatureVisitor类的具体用法?Java TraceSignatureVisitor怎么用?Java TraceSignatureVisitor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TraceSignatureVisitor类属于jdk.internal.org.objectweb.asm.util包,在下文中一共展示了TraceSignatureVisitor类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: visit

import jdk.internal.org.objectweb.asm.util.TraceSignatureVisitor; //导入依赖的package包/类
@Override
public void visit(final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) {
    final int major = version & 0xFFFF;
    final int minor = version >>> 16;

    currentClassName = name;

    final StringBuilder sb = new StringBuilder();
    sb.append("// class version ").
        append(major).
        append('.').
        append(minor).append(" (").
        append(version).
        append(")\n");

    if ((access & Opcodes.ACC_DEPRECATED) != 0) {
        sb.append("// DEPRECATED\n");
    }

    sb.append("// access flags 0x"). //TODO TRANSLATE TO WHAT THEY MEAN
        append(Integer.toHexString(access).toUpperCase()).
        append('\n');

    appendDescriptor(sb, CLASS_SIGNATURE, signature);
    if (signature != null) {
        final TraceSignatureVisitor sv = new TraceSignatureVisitor(access);
        final SignatureReader r = new SignatureReader(signature);
        r.accept(sv);
        sb.append("// declaration: ").
            append(name).
            append(sv.getDeclaration()).
            append('\n');
    }

    appendAccess(sb, access & ~Opcodes.ACC_SUPER);
    if ((access & Opcodes.ACC_ANNOTATION) != 0) {
        sb.append("@interface ");
    } else if ((access & Opcodes.ACC_INTERFACE) != 0) {
        sb.append("interface ");
    } else if ((access & Opcodes.ACC_ENUM) == 0) {
        sb.append("class ");
    }
    appendDescriptor(sb, INTERNAL_NAME, name);

    if (superName != null && !"java/lang/Object".equals(superName)) {
        sb.append(" extends ");
        appendDescriptor(sb, INTERNAL_NAME, superName);
        sb.append(' ');
    }
    if (interfaces != null && interfaces.length > 0) {
        sb.append(" implements ");
        for (final String interface1 : interfaces) {
            appendDescriptor(sb, INTERNAL_NAME, interface1);
            sb.append(' ');
        }
    }
    sb.append(" {\n");

    addText(sb);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:61,代码来源:NashornTextifier.java


示例2: visitField

import jdk.internal.org.objectweb.asm.util.TraceSignatureVisitor; //导入依赖的package包/类
@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;
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:51,代码来源:NashornTextifier.java


示例3: visitMethod

import jdk.internal.org.objectweb.asm.util.TraceSignatureVisitor; //导入依赖的package包/类
@Override
public NashornTextifier visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) {

    graph = new Graph(name);

    final List<Label> extraLabels = cr.getExtraLabels(currentClassName, name, desc);
    this.labelIter = extraLabels == null ? null : extraLabels.iterator();

    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, METHOD_SIGNATURE, signature);

        final TraceSignatureVisitor v = new TraceSignatureVisitor(0);
        final SignatureReader r = new SignatureReader(signature);
        r.accept(v);
        final String genericDecl = v.getDeclaration();
        final String genericReturn = v.getReturnType();
        final String genericExceptions = v.getExceptions();

        sb.append(tab).
            append("// declaration: ").
            append(genericReturn).
            append(' ').
            append(name).
            append(genericDecl);

        if (genericExceptions != null) {
            sb.append(" throws ").append(genericExceptions);
        }
        sb.append('\n');
    }

    sb.append(tab);
    appendAccess(sb, access);
    if ((access & Opcodes.ACC_NATIVE) != 0) {
        sb.append("native ");
    }
    if ((access & Opcodes.ACC_VARARGS) != 0) {
        sb.append("varargs ");
    }
    if ((access & Opcodes.ACC_BRIDGE) != 0) {
        sb.append("bridge ");
    }

    sb.append(name);
    appendDescriptor(sb, METHOD_DESCRIPTOR, desc);
    if (exceptions != null && exceptions.length > 0) {
        sb.append(" throws ");
        for (final String exception : exceptions) {
            appendDescriptor(sb, INTERNAL_NAME, exception);
            sb.append(' ');
        }
    }

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

    final NashornTextifier t = createNashornTextifier();
    addText(t.getText());
    return t;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:75,代码来源:NashornTextifier.java


示例4: visitLocalVariable

import jdk.internal.org.objectweb.asm.util.TraceSignatureVisitor; //导入依赖的package包/类
@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());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:45,代码来源:NashornTextifier.java



注:本文中的jdk.internal.org.objectweb.asm.util.TraceSignatureVisitor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TWSDLExtensible类代码示例发布时间:2022-05-23
下一篇:
Java AstIdentifier类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap