List of usage examples for org.objectweb.asm Opcodes V1_8
int V1_8
To view the source code for org.objectweb.asm Opcodes V1_8.
Click Source Link
From source file:org.jacoco.core.internal.instr.ProbeArrayStrategyFactoryTest.java
License:Open Source License
@Test public void testClinitAndAbstractMethodsInterface8() { final IProbeArrayStrategy strategy = test(Opcodes.V1_8, Opcodes.ACC_INTERFACE, true, false, true); assertEquals(LocalProbeArrayStrategy.class, strategy.getClass()); assertNoDataField();/*from ww w .j av a2s.c o m*/ assertNoInitMethod(); strategy.storeInstance(cv.visitMethod(0, null, null, null, null), false, 0); }
From source file:org.jacoco.core.internal.instr.ProbeArrayStrategyFactoryTest.java
License:Open Source License
@Test public void testClinitInterface8() { final IProbeArrayStrategy strategy = test(Opcodes.V1_8, Opcodes.ACC_INTERFACE, true, false, false); assertEquals(LocalProbeArrayStrategy.class, strategy.getClass()); assertNoDataField();// ww w .ja va 2 s. co m assertNoInitMethod(); }
From source file:org.jacoco.core.internal.instr.ProbeArrayStrategyFactoryTest.java
License:Open Source License
@Test public void testClinitAndMethodsInterface8() { cv.isInterface = true;// ww w .ja v a2 s . c om final IProbeArrayStrategy strategy = test(Opcodes.V1_8, Opcodes.ACC_INTERFACE, true, true, true); assertEquals(InterfaceFieldProbeArrayStrategy.class, strategy.getClass()); assertDataField(InstrSupport.DATAFIELD_INTF_ACC); assertInitAndClinitMethods(); strategy.storeInstance(cv.visitMethod(0, "<clinit>", null, null, null), true, 0); }
From source file:org.jacoco.core.internal.Java9Support.java
License:Open Source License
/** * Replaces version in the definition of class on {@link Opcodes#V1_8}. * * @param b/* w w w. ja va 2 s .com*/ * definition of the class * @return new definition of the class */ public static byte[] downgrade(byte[] b) { byte[] result = new byte[b.length]; System.arraycopy(b, 0, result, 0, b.length); putShort(result, 6, Opcodes.V1_8); return result; }
From source file:org.lanternpowered.server.data.manipulator.gen.DataManipulatorGenerator.java
License:MIT License
@SuppressWarnings("unchecked") private <M extends DataManipulator<M, I>, I extends ImmutableDataManipulator<I, M>> Base<M, I> generateBase( TypeGenerator typeGenerator, PluginContainer pluginContainer, String id, String name, Class<M> manipulatorType, Class<I> immutableManipulatorType, @Nullable Class<? extends M> mutableExpansion, @Nullable Class<? extends I> immutableExpansion, @Nullable List<Method> methods, @Nullable List<Method> immutableMethods) { final ClassWriter cwM = new ClassWriter(Opcodes.V1_8); final ClassWriter cwI = new ClassWriter(Opcodes.V1_8); final String mutableImplTypeName = newInternalName(manipulatorType); final String immutableImplTypeName = newInternalName(immutableManipulatorType); final String mutableImplClassName = mutableImplTypeName.replace('/', '.'); final String immutableImplClassName = immutableImplTypeName.replace('/', '.'); typeGenerator.generateClasses(cwM, cwI, mutableImplTypeName, immutableImplTypeName, manipulatorType, immutableManipulatorType, mutableExpansion, immutableExpansion, methods, immutableMethods); cwM.visitEnd();// www .j a v a 2 s . co m cwI.visitEnd(); byte[] bytes = cwM.toByteArray(); final Class<?> manipulatorTypeImpl = this.classLoader.defineClass(mutableImplClassName, bytes); bytes = cwI.toByteArray(); final Class<?> immutableManipulatorTypeImpl = this.classLoader.defineClass(immutableImplClassName, bytes); final ClassWriter cw = new ClassWriter(Opcodes.V1_8); final String className = this.registrationGenerator.generate(cw, (Class) manipulatorType, (Class) manipulatorTypeImpl, (Class) immutableManipulatorType, (Class) immutableManipulatorTypeImpl); bytes = cw.toByteArray(); final Class<?> registrationClass = this.classLoader.defineClass(className, bytes); return new Base(() -> { try { return registrationClass.getConstructor(PluginContainer.class, String.class, String.class) .newInstance(pluginContainer, id, name); } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { throw new RuntimeException(e); } }, manipulatorTypeImpl, immutableManipulatorTypeImpl); }
From source file:org.teavm.flavour.regex.bytecode.MatcherClassBuilder.java
License:Apache License
public byte[] build(String className, Dfa dfa) { dfa = reorder(dfa, getOrdering(dfa)); className = className.replace('.', '/'); this.className = className; ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES); ClassVisitor cv = writer;/* w w w.j a va2 s. c o m*/ cv.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC, className, null, "java/lang/Object", new String[] { Type.getInternalName(Matcher.class) }); cv.visitField(Opcodes.ACC_PRIVATE, "state", "I", null, null).visitEnd(); cv.visitField(Opcodes.ACC_PRIVATE, "domain", "I", null, null).visitEnd(); cv.visitField(Opcodes.ACC_PRIVATE, "index", "I", null, null).visitEnd(); buildConstructor(cv, className); buildValidMethod(cv, className); buildDomainMethod(cv, className); buildIndexMethod(cv, className); buildRestartMethod(cv, className); buildForkMethod(cv, className); buildEndMethod(cv, className, dfa); buildWorkerMethod(cv, className, dfa); cv.visitEnd(); byte[] result = writer.toByteArray(); return result; }
From source file:se.eris.asm.AsmUtilsTest.java
License:Apache License
@Test void asmOpcodeToJavaVersion() { assertEquals(1, AsmUtils.asmOpcodeToJavaVersion(Opcodes.V1_1)); assertEquals(5, AsmUtils.asmOpcodeToJavaVersion(Opcodes.V1_5)); assertEquals(6, AsmUtils.asmOpcodeToJavaVersion(Opcodes.V1_6)); assertEquals(7, AsmUtils.asmOpcodeToJavaVersion(Opcodes.V1_7)); assertEquals(8, AsmUtils.asmOpcodeToJavaVersion(Opcodes.V1_8)); assertEquals(9, AsmUtils.asmOpcodeToJavaVersion(Opcodes.V9)); assertEquals(10, AsmUtils.asmOpcodeToJavaVersion(Opcodes.V10)); assertEquals(11, AsmUtils.asmOpcodeToJavaVersion(Opcodes.V11)); }