List of usage examples for org.objectweb.asm Opcodes V9
int V9
To view the source code for org.objectweb.asm Opcodes V9.
Click Source Link
From source file:org.jacoco.core.analysis.AnalyzerTest.java
License:Open Source License
@Test public void should_ignore_module_info() throws Exception { final ClassWriter cw = new ClassWriter(0); cw.visit(Opcodes.V9, Opcodes.ACC_MODULE, "module-info", null, null, null); cw.visitModule("module", 0, null).visitEnd(); cw.visitEnd();//www. j ava 2 s . co m final byte[] bytes = cw.toByteArray(); analyzer.analyzeClass(bytes, ""); assertTrue(classes.isEmpty()); }
From source file:org.jacoco.core.internal.data.CRC64.java
License:Open Source License
/** * Calculates class identifier for the given class bytes. * * @param bytes//from ww w. ja v a2 s . c om * class bytes * @return class identifier */ public static long classId(final byte[] bytes) { if (bytes.length > 7 && bytes[6] == 0x00 && bytes[7] == Opcodes.V9) { // To support early versions of Java 9 we did a trick - change of // Java 9 class files version on Java 8. Unfortunately this also // affected class identifiers. long sum = update(0, bytes, 0, 7); sum = update(sum, (byte) Opcodes.V1_8); return update(sum, bytes, 8, bytes.length); } return update(0, bytes, 0, bytes.length); }
From source file:org.jacoco.core.internal.data.CRC64Test.java
License:Open Source License
@Test public void except_java_9_checksums_should_be_different_for_different_bytecode_versions() { assertEquals(0x589E9080A572741EL, CRC64.classId(createClass(Opcodes.V10))); // should remove workaround for Java 9 // during change of exec file version assertEquals(0x1007, ExecutionDataWriter.FORMAT_VERSION); assertEquals(0xB5284860A572741CL, CRC64.classId(createClass(Opcodes.V9))); assertEquals(0xB5284860A572741CL, CRC64.classId(createClass(Opcodes.V1_8))); assertEquals(0x45284D30A572741AL, CRC64.classId(createClass(Opcodes.V1_7))); }
From source file:org.jacoco.core.internal.instr.ProbeArrayStrategyFactoryTest.java
License:Open Source License
@Test public void test_java9_module() { final IProbeArrayStrategy strategy = createForModule(Opcodes.V9); assertEquals(NoneProbeArrayStrategy.class, strategy.getClass()); }
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();/*from ww w . ja va 2s .c o m*/ return cw.toByteArray(); }
From source file:org.sonar.java.bytecode.loader.SquidClassLoaderTest.java
License:Open Source License
@Test public void test_loading_java9_class() throws Exception { SquidClassLoader classLoader = new SquidClassLoader( Collections.singletonList(new File("src/test/files/bytecode/java9/bin"))); byte[] bytes = classLoader.getBytesForClass("org.test.Hello9"); assertThat(bytes).isNotNull();// ww w . j a v a 2s. c om ClassReader cr = new ClassReader(bytes); ClassNode classNode = new ClassNode(); cr.accept(classNode, 0); assertThat(classNode.version).isEqualTo(Opcodes.V9); classLoader.close(); }
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)); }