当前位置: 首页>>代码示例>>Java>>正文


Java Comment类代码示例

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


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

示例1: testIllegalFieldMemberVisitAfterEnd

import org.objectweb.asm.attrs.Comment; //导入依赖的package包/类
public void testIllegalFieldMemberVisitAfterEnd() {
    FieldVisitor fv = new CheckFieldAdapter(null);
    fv.visitEnd();
    try {
        fv.visitAttribute(new Comment());
        fail();
    } catch (Exception e) {
    }
}
 
开发者ID:lrytz,项目名称:asm-legacy-svn-clone,代码行数:10,代码来源:CheckClassAdapterUnitTest.java

示例2: testIllegalMethodMemberVisitAfterEnd

import org.objectweb.asm.attrs.Comment; //导入依赖的package包/类
public void testIllegalMethodMemberVisitAfterEnd() {
    MethodVisitor mv = new CheckMethodAdapter(null);
    mv.visitEnd();
    try {
        mv.visitAttribute(new Comment());
        fail();
    } catch (Exception e) {
    }
}
 
开发者ID:lrytz,项目名称:asm-legacy-svn-clone,代码行数:10,代码来源:CheckClassAdapterUnitTest.java

示例3: test

import org.objectweb.asm.attrs.Comment; //导入依赖的package包/类
@Override
public void test() throws Exception {
    ClassReader cr = new ClassReader(is);
    ClassWriter cw = new ClassWriter(0);
    ClassVisitor cv = new TraceClassVisitor(cw, new PrintWriter(
            new CharArrayWriter()));
    cr.accept(cv, new Attribute[] { new Comment(), new CodeComment() }, 0);
    assertEquals(cr, new ClassReader(cw.toByteArray()));
}
 
开发者ID:lrytz,项目名称:asm-legacy-svn-clone,代码行数:10,代码来源:TraceClassAdapterTest.java

示例4: test

import org.objectweb.asm.attrs.Comment; //导入依赖的package包/类
@Override
public void test() throws Exception {
    ClassReader cr = new ClassReader(is);
    ClassWriter cw = new ClassWriter(0);
    ClassVisitor cv = new TraceClassVisitor(cw,
            new PrintWriter(new CharArrayWriter()));
    cr.accept(cv, new Attribute[] { new Comment(), new CodeComment() }, 0);
    assertEquals(cr, new ClassReader(cw.toByteArray()));
}
 
开发者ID:nxmatic,项目名称:objectweb-asm-4.0,代码行数:10,代码来源:TraceClassAdapterTest.java

示例5: dump

import org.objectweb.asm.attrs.Comment; //导入依赖的package包/类
public byte[] dump() {
    ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
    FieldVisitor fv;
    MethodVisitor mv;

    cw.visit(V1_3, ACC_PUBLIC + ACC_SYNTHETIC, "pkg/Attribute", null,
            "java/lang/Object", null);

    cw.visitAttribute(new Comment());

    fv = cw.visitField(ACC_PUBLIC, "f", "I", null, null);
    fv.visitAttribute(new Comment());
    fv.visitEnd();

    mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
    mv.visitAttribute(new Comment());
    mv.visitCode();
    mv.visitVarInsn(ALOAD, 0);
    mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V",
            false);

    /*
     * the following instructions are designed so that this method will be
     * resized by the method resizing test, in order to cover the code that
     * recomputes the code attribute labels in the resizeInstructions method
     * (see MethodWriter).
     */
    Label l0 = new Label();
    mv.visitInsn(ICONST_0);
    mv.visitJumpInsn(IFEQ, l0);
    // many NOPs will be introduced here by the method resizing test
    mv.visitJumpInsn(GOTO, l0);
    mv.visitLabel(l0);

    mv.visitInsn(RETURN);
    mv.visitMaxs(0, 0);
    mv.visitAttribute(new CodeComment());
    mv.visitEnd();

    cw.visitEnd();
    return cw.toByteArray();
}
 
开发者ID:lrytz,项目名称:asm-legacy-svn-clone,代码行数:43,代码来源:Attribute.java

示例6: dump

import org.objectweb.asm.attrs.Comment; //导入依赖的package包/类
public byte[] dump() {
    ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
    FieldVisitor fv;
    MethodVisitor mv;

    cw.visit(V1_3, ACC_PUBLIC + ACC_SYNTHETIC, "pkg/Attribute", null,
            "java/lang/Object", null);

    cw.visitAttribute(new Comment());

    fv = cw.visitField(ACC_PUBLIC, "f", "I", null, null);
    fv.visitAttribute(new Comment());
    fv.visitEnd();

    mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
    mv.visitAttribute(new Comment());
    mv.visitCode();
    mv.visitVarInsn(ALOAD, 0);
    mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");

    /*
     * the following instructions are designed so that this method will be
     * resized by the method resizing test, in order to cover the code that
     * recomputes the code attribute labels in the resizeInstructions method
     * (see MethodWriter).
     */
    Label l0 = new Label();
    mv.visitInsn(ICONST_0);
    mv.visitJumpInsn(IFEQ, l0);
    // many NOPs will be introduced here by the method resizing test
    mv.visitJumpInsn(GOTO, l0);
    mv.visitLabel(l0);

    mv.visitInsn(RETURN);
    mv.visitMaxs(0, 0);
    mv.visitAttribute(new CodeComment());
    mv.visitEnd();

    cw.visitEnd();
    return cw.toByteArray();
}
 
开发者ID:llbit,项目名称:ow2-asm,代码行数:42,代码来源:Attribute.java

示例7: dump

import org.objectweb.asm.attrs.Comment; //导入依赖的package包/类
public byte[] dump() {
    ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
    FieldVisitor fv;
    MethodVisitor mv;

    cw.visit(V1_3,
            ACC_PUBLIC + ACC_SYNTHETIC,
            "pkg/Attribute",
            null,
            "java/lang/Object",
            null);

    cw.visitAttribute(new Comment());

    fv = cw.visitField(ACC_PUBLIC, "f", "I", null, null);
    fv.visitAttribute(new Comment());
    fv.visitEnd();

    mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
    mv.visitAttribute(new Comment());
    mv.visitCode();
    mv.visitVarInsn(ALOAD, 0);
    mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");

    /*
     * the following instructions are designed so that this method will be
     * resized by the method resizing test, in order to cover the code that
     * recomputes the code attribute labels in the resizeInstructions method
     * (see MethodWriter).
     */
    Label l0 = new Label();
    mv.visitInsn(ICONST_0);
    mv.visitJumpInsn(IFEQ, l0);
    // many NOPs will be introduced here by the method resizing test
    mv.visitJumpInsn(GOTO, l0);
    mv.visitLabel(l0);

    mv.visitInsn(RETURN);
    mv.visitMaxs(0, 0);
    mv.visitAttribute(new CodeComment());
    mv.visitEnd();

    cw.visitEnd();
    return cw.toByteArray();
}
 
开发者ID:nxmatic,项目名称:objectweb-asm-4.0,代码行数:46,代码来源:Attribute.java


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