本文整理汇总了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) {
}
}
示例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) {
}
}
示例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()));
}
示例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()));
}
示例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();
}
示例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();
}
示例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();
}