List of usage examples for org.objectweb.asm Opcodes ACC_STATIC
int ACC_STATIC
To view the source code for org.objectweb.asm Opcodes ACC_STATIC.
Click Source Link
From source file:org.jacoco.core.internal.instr.ProbeInserter.java
License:Open Source License
/** * Creates a new {@link ProbeInserter}.// w w w . j a v a2 s. c o m * * @param access * access flags of the adapted method. * @param desc * the method's descriptor * @param mv * the method visitor to which this adapter delegates calls * @param arrayStrategy * callback to create the code that retrieves the reference to * the probe array */ ProbeInserter(final int access, final String desc, final MethodVisitor mv, final IProbeArrayStrategy arrayStrategy) { super(Opcodes.ASM4, mv); this.arrayStrategy = arrayStrategy; int pos = (Opcodes.ACC_STATIC & access) == 0 ? 1 : 0; for (final Type t : Type.getArgumentTypes(desc)) { pos += t.getSize(); } variable = pos; }
From source file:org.jacoco.core.internal.instr.ProbeInserterTest.java
License:Open Source License
@Test public void testVariableStatic() { ProbeInserter pi = new ProbeInserter(Opcodes.ACC_STATIC, "()V", actualVisitor, arrayStrategy); pi.insertProbe(0);/*from w w w . j a va 2 s.c o m*/ expectedVisitor.visitVarInsn(Opcodes.ALOAD, 0); expectedVisitor.visitInsn(Opcodes.ICONST_0); expectedVisitor.visitInsn(Opcodes.ICONST_1); expectedVisitor.visitInsn(Opcodes.BASTORE); }
From source file:org.jacoco.core.internal.instr.ProbeInserterTest.java
License:Open Source License
@Test public void testVisitFrameNoLocals() { ProbeInserter pi = new ProbeInserter(Opcodes.ACC_STATIC, "()V", actualVisitor, arrayStrategy); pi.visitFrame(Opcodes.F_NEW, 0, new Object[] {}, 0, new Object[0]); expectedVisitor.visitFrame(Opcodes.F_NEW, 1, new Object[] { "[Z" }, 0, new Object[0]); }
From source file:org.jacoco.core.internal.instr.ProbeInserterTest.java
License:Open Source License
@Test public void testVisitFrameProbeAt0() { ProbeInserter pi = new ProbeInserter(Opcodes.ACC_STATIC, "()V", actualVisitor, arrayStrategy); pi.visitFrame(Opcodes.F_NEW, 2, new Object[] { Opcodes.DOUBLE, "Foo" }, 0, new Object[0]); expectedVisitor.visitFrame(Opcodes.F_NEW, 3, new Object[] { "[Z", Opcodes.DOUBLE, "Foo" }, 0, new Object[0]); }
From source file:org.jacoco.core.internal.instr.ProbeInserterTest.java
License:Open Source License
@Test public void testFillOneWord() { ProbeInserter pi = new ProbeInserter(Opcodes.ACC_STATIC, "(I)V", actualVisitor, arrayStrategy); pi.visitFrame(Opcodes.F_NEW, 0, new Object[] {}, 0, new Object[] {}); // The locals in this frame are filled with TOP up to the probe variable expectedVisitor.visitFrame(Opcodes.F_NEW, 2, new Object[] { Opcodes.TOP, "[Z", }, 0, new Object[] {}); }
From source file:org.jacoco.core.internal.instr.ProbeInserterTest.java
License:Open Source License
@Test public void testFillTwoWord() { ProbeInserter pi = new ProbeInserter(Opcodes.ACC_STATIC, "(J)V", actualVisitor, arrayStrategy); pi.visitFrame(Opcodes.F_NEW, 0, new Object[] {}, 0, new Object[] {}); // The locals in this frame are filled with TOP up to the probe variable expectedVisitor.visitFrame(Opcodes.F_NEW, 3, new Object[] { Opcodes.TOP, Opcodes.TOP, "[Z", }, 0, new Object[] {}); }
From source file:org.jacoco.core.internal.instr.ProbeInserterTest.java
License:Open Source License
@Test public void testFillPartly() { ProbeInserter pi = new ProbeInserter(Opcodes.ACC_STATIC, "(DIJ)V", actualVisitor, arrayStrategy); pi.visitFrame(Opcodes.F_NEW, 1, new Object[] { Opcodes.DOUBLE }, 0, new Object[] {}); // The locals in this frame are filled with TOP up to the probe variable expectedVisitor.visitFrame(Opcodes.F_NEW, 5, new Object[] { Opcodes.DOUBLE, Opcodes.TOP, Opcodes.TOP, Opcodes.TOP, "[Z", }, 0, new Object[] {}); }
From source file:org.jacoco.core.internal.instr.ProbeVariableInserter.java
License:Open Source License
/** * Creates a new {@link ProbeVariableInserter}. * //www .ja v a 2 s.c o m * @param access * access flags of the adapted method. * @param desc * the method's descriptor * @param mv * the method visitor to which this adapter delegates calls */ ProbeVariableInserter(final int access, final String desc, final MethodVisitor mv) { super(mv); int idx = (Opcodes.ACC_STATIC & access) == 0 ? 1 : 0; int pos = idx; for (final Type t : Type.getArgumentTypes(desc)) { idx++; pos += t.getSize(); } variableIdx = idx; variable = pos; lastLabel = null; }
From source file:org.jacoco.core.internal.instr.ProbeVariableInserterTest.java
License:Open Source License
@Test public void testVariableStatic() { ProbeVariableInserter i = new ProbeVariableInserter(Opcodes.ACC_STATIC, "()V", delegate); assertEquals(0, i.variable);/*w w w . j a v a 2 s .co m*/ }
From source file:org.jacoco.core.runtime.InjectedClassRuntime.java
License:Open Source License
private static byte[] createClass(final String name) { final ClassWriter cw = new ClassWriter(0); cw.visit(Opcodes.V9, Opcodes.ACC_SYNTHETIC | Opcodes.ACC_PUBLIC, name.replace('.', '/'), null, "java/lang/Object", null); cw.visitField(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, FIELD_NAME, FIELD_TYPE, null, null); cw.visitEnd();// ww w .j av a2s. co m return cw.toByteArray(); }