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


Java TraceClassVisitor.visitField方法代码示例

本文整理汇总了Java中org.objectweb.asm.util.TraceClassVisitor.visitField方法的典型用法代码示例。如果您正苦于以下问题:Java TraceClassVisitor.visitField方法的具体用法?Java TraceClassVisitor.visitField怎么用?Java TraceClassVisitor.visitField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.objectweb.asm.util.TraceClassVisitor的用法示例。


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

示例1: generate

import org.objectweb.asm.util.TraceClassVisitor; //导入方法依赖的package包/类
@Override
protected void generate(TraceClassVisitor cw) {
	MethodVisitor mv;
	FieldVisitor fv;

	cw.visit(V1_1, ACC_SUPER, "soot/asm/backend/targets/InnerClass$1", null, "java/lang/Object",
			new String[] { "soot/asm/backend/targets/Measurable" });
	
	cw.visitSource("InnerClass.java", null);

	cw.visitOuterClass("soot/asm/backend/targets/InnerClass", "doInner", "()V");

	cw.visitInnerClass("soot/asm/backend/targets/InnerClass$1", null, null, 0);

	{
		fv = cw.visitField(ACC_FINAL + ACC_SYNTHETIC, "this$0",
				"Lsoot/asm/backend/targets/InnerClass;", null, null);
		fv.visitEnd();
	}
	{
		mv = cw.visitMethod(0, "<init>", "(Lsoot/asm/backend/targets/InnerClass;)V", null, null);
		mv.visitCode();
		mv.visitVarInsn(ALOAD, 0);
		mv.visitVarInsn(ALOAD, 1);
		mv.visitFieldInsn(PUTFIELD, "soot/asm/backend/targets/InnerClass$1", "this$0",
				"Lsoot/asm/backend/targets/InnerClass;");
		mv.visitVarInsn(ALOAD, 0);
		mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>",
				"()V", false);
		mv.visitInsn(RETURN);
		mv.visitMaxs(0, 0);
		mv.visitEnd();
	}
	cw.visitEnd();

}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:37,代码来源:InnerClass2Test.java

示例2: generate

import org.objectweb.asm.util.TraceClassVisitor; //导入方法依赖的package包/类
@Override
protected void generate(TraceClassVisitor cw) {
	FieldVisitor fv;
	MethodVisitor mv;

	cw.visit(V1_1, ACC_PUBLIC + ACC_SUPER, "soot/asm/backend/targets/Monitor", null, "java/lang/Object", null);
	cw.visitSource("Monitor.java", null);

	{
	fv = cw.visitField(0, "o", "Ljava/lang/Object;", null, null);
	fv.visitEnd();
	}
	{
	mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
	mv.visitCode();
	mv.visitVarInsn(ALOAD, 0);
	mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
	mv.visitInsn(RETURN);
	mv.visitMaxs(0, 0);
	mv.visitEnd();
	}
	if (targetCompiler == TargetCompiler.eclipse) {
	mv = cw.visitMethod(ACC_PUBLIC, "doSth", "()V", null, null);
	mv.visitCode();
	mv.visitVarInsn(ALOAD, 0);
	mv.visitFieldInsn(GETFIELD, "soot/asm/backend/targets/Monitor", "o", "Ljava/lang/Object;");
	mv.visitInsn(DUP);
	mv.visitInsn(MONITORENTER);
	mv.visitInsn(MONITOREXIT);
	mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;");
	mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "()V", false);
	mv.visitInsn(RETURN);
	mv.visitMaxs(0, 0);
	mv.visitEnd();
	}
	else {
		mv = cw.visitMethod(ACC_PUBLIC, "doSth", "()V", null, null);
		mv.visitCode();
		Label l0 = new Label();
		Label l1 = new Label();
		Label l2 = new Label();
		mv.visitTryCatchBlock(l0, l1, l2, "java/lang/Throwable");
		Label l3 = new Label();
		mv.visitTryCatchBlock(l2, l3, l2, "java/lang/Throwable");
		mv.visitVarInsn(ALOAD, 0);
		mv.visitFieldInsn(GETFIELD, "soot/asm/backend/targets/Monitor", "o", "Ljava/lang/Object;");
		mv.visitInsn(DUP);
		mv.visitVarInsn(ASTORE, 0);
		mv.visitInsn(MONITORENTER);
		mv.visitLabel(l0);
		mv.visitVarInsn(ALOAD, 0);
		mv.visitInsn(MONITOREXIT);
		mv.visitLabel(l1);
		Label l4 = new Label();
		mv.visitJumpInsn(GOTO, l4);
		mv.visitLabel(l2);
		mv.visitVarInsn(ASTORE, 1);
		mv.visitVarInsn(ALOAD, 0);
		mv.visitInsn(MONITOREXIT);
		mv.visitLabel(l3);
		mv.visitVarInsn(ALOAD, 1);
		mv.visitInsn(ATHROW);
		mv.visitLabel(l4);
		mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;");
		mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "()V", false);
		mv.visitInsn(RETURN);
		mv.visitMaxs(0, 0);
		mv.visitEnd();
	}
	cw.visitEnd();
	
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:73,代码来源:MonitorTest.java

示例3: generate

import org.objectweb.asm.util.TraceClassVisitor; //导入方法依赖的package包/类
@Override
protected void generate(TraceClassVisitor visitor) {
	FieldVisitor fv;
	MethodVisitor mv;

	visitor.visit(Opcodes.V1_1, Opcodes.ACC_PUBLIC + Opcodes.ACC_SUPER,
			"soot/asm/backend/targets/Bean", null, "java/lang/Object", null);
	visitor.visitSource("Bean.java", null);
	{
	fv = visitor.visitField(Opcodes.ACC_PRIVATE, "f", "I", null, null);
	fv.visitEnd();
	}
	{
	mv = visitor.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "()V", null, null);
	mv.visitCode();
	mv.visitVarInsn(Opcodes.ALOAD, 0);
	mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
	mv.visitInsn(Opcodes.RETURN);
	mv.visitMaxs(0, 0);
	mv.visitEnd();
	}
	{
	mv = visitor.visitMethod(Opcodes.ACC_PUBLIC, "checkAndSetF", "(I)V", null, null);
	mv.visitCode();
	mv.visitVarInsn(Opcodes.ILOAD, 1);
	Label l0 = new Label();
	mv.visitJumpInsn(Opcodes.IFLT, l0);
	mv.visitVarInsn(Opcodes.ALOAD, 0);
	mv.visitVarInsn(Opcodes.ILOAD, 1);
	mv.visitFieldInsn(Opcodes.PUTFIELD, "soot/asm/backend/targets/Bean", "f", "I");
	Label l1 = new Label();
	mv.visitJumpInsn(Opcodes.GOTO, l1);
	mv.visitLabel(l0);
	mv.visitTypeInsn(Opcodes.NEW, "java/lang/IllegalArgumentException");
	mv.visitInsn(Opcodes.DUP);
	mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/IllegalArgumentException", "<init>", "()V", false);
	mv.visitInsn(Opcodes.ATHROW);
	mv.visitLabel(l1);
	mv.visitInsn(Opcodes.RETURN);
	mv.visitMaxs(0, 0);
	mv.visitEnd();
	}
	{
	mv = visitor.visitMethod(Opcodes.ACC_PUBLIC, "getF", "()I", null, null);
	mv.visitCode();
	mv.visitVarInsn(Opcodes.ALOAD, 0);
	mv.visitFieldInsn(Opcodes.GETFIELD, "soot/asm/backend/targets/Bean", "f", "I");
	mv.visitInsn(Opcodes.IRETURN);
	mv.visitMaxs(0, 0);
	mv.visitEnd();
	}
	{
	mv = visitor.visitMethod(Opcodes.ACC_PUBLIC, "setF", "(I)V", null, null);
	mv.visitCode();
	mv.visitVarInsn(Opcodes.ALOAD, 0);
	mv.visitVarInsn(Opcodes.ILOAD, 1);
	mv.visitFieldInsn(Opcodes.PUTFIELD, "soot/asm/backend/targets/Bean", "f", "I");
	mv.visitInsn(Opcodes.RETURN);
	mv.visitMaxs(0, 0);
	mv.visitEnd();
	}
	visitor.visitEnd();

}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:65,代码来源:MethodExampleTest.java

示例4: generate

import org.objectweb.asm.util.TraceClassVisitor; //导入方法依赖的package包/类
@Override
protected void generate(TraceClassVisitor cw) {

	FieldVisitor fv;
	MethodVisitor mv;
	AnnotationVisitor av0;

	cw.visit(V1_8, ACC_PUBLIC + ACC_SUPER, "soot/asm/backend/targets/AnnotatedField",
			null, "java/lang/Object", null);
	cw.visitSource("AnnotatedField.java", null);
	
	{
	fv = cw.visitField(0, "a", "Ljava/lang/String;", null, null);
	{
	av0 = fv.visitAnnotation("Lsoot/asm/backend/targets/MyTestAnnotation;", true);
	av0.visit("iVal", new Integer(124));
	av0.visit("fVal", new Float("5132.0"));
	av0.visit("lVal", new Long(5123L));
	av0.visit("dVal", new Double("745.0"));
	av0.visit("zVal", Boolean.TRUE);
	av0.visit("bVal", new Byte((byte)1));
	av0.visit("sVal", new Short((short)123));
	av0.visit("strVal", "435243");
	av0.visit("rVal", Type.getType("Lsoot/asm/backend/targets/AnnotatedClass;"));
	av0.visit("iAVal", new int[] {123,234,345,456});
	{
	AnnotationVisitor av1 = av0.visitArray("sAVal");
	av1.visit(null, "A");
	av1.visit(null, "B");
	av1.visit(null, "C");
	av1.visitEnd();
	}
	av0.visitEnd();
	}
	fv.visitEnd();
	}
	{
	mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
	mv.visitCode();
	mv.visitVarInsn(ALOAD, 0);
	mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
	mv.visitInsn(RETURN);
	mv.visitMaxs(0, 0);
	mv.visitEnd();
	}
	cw.visitEnd();


}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:50,代码来源:AnnotatedFieldTest.java

示例5: generate

import org.objectweb.asm.util.TraceClassVisitor; //导入方法依赖的package包/类
@Override
protected void generate(TraceClassVisitor visitor) {
	MethodVisitor mv;
	FieldVisitor fv;

	visitor.visit(V1_1, ACC_SUPER, "soot/asm/backend/targets/InnerClass$Inner", null,
			"java/lang/Object", null);
	
	visitor.visitSource("InnerClass.java", null);

	visitor.visitInnerClass("soot/asm/backend/targets/InnerClass$Inner", "soot/asm/backend/targets/InnerClass",
			"Inner", ACC_PRIVATE);

	{
		fv = visitor.visitField(ACC_FINAL + ACC_STATIC, "a", "I", null,
				new Integer(3));
		fv.visitEnd();
	}
	{
		fv = visitor.visitField(ACC_FINAL + ACC_SYNTHETIC, "this$0",
				"Lsoot/asm/backend/targets/InnerClass;", null, null);
		fv.visitEnd();
	}
	{
		mv = visitor.visitMethod(ACC_PRIVATE, "<init>",
				"(Lsoot/asm/backend/targets/InnerClass;)V", null, null);
		mv.visitCode();
		mv.visitVarInsn(ALOAD, 0);
		mv.visitVarInsn(ALOAD, 1);
		mv.visitFieldInsn(PUTFIELD, "soot/asm/backend/targets/InnerClass$Inner", "this$0",
				"Lsoot/asm/backend/targets/InnerClass;");
		mv.visitVarInsn(ALOAD, 0);
		mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>",
				"()V", false);
		mv.visitInsn(RETURN);
		mv.visitMaxs(0, 0);
		mv.visitEnd();
	}
	visitor.visitEnd();

}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:42,代码来源:InnerClassTest.java


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