From 01b961b755bd47164739896d2d9c0960e882fd40 Mon Sep 17 00:00:00 2001 From: "Marc R. Hoffmann" Date: Wed, 3 Oct 2018 21:16:27 +0200 Subject: No need to modify class bytes for Java 10 support (#740) --- .../src/org/jacoco/core/internal/instr/InstrSupportTest.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'org.jacoco.core.test/src/org/jacoco/core/internal/instr') diff --git a/org.jacoco.core.test/src/org/jacoco/core/internal/instr/InstrSupportTest.java b/org.jacoco.core.test/src/org/jacoco/core/internal/instr/InstrSupportTest.java index c1b3044b..dda12bfd 100644 --- a/org.jacoco.core.test/src/org/jacoco/core/internal/instr/InstrSupportTest.java +++ b/org.jacoco.core.test/src/org/jacoco/core/internal/instr/InstrSupportTest.java @@ -15,7 +15,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import org.jacoco.core.internal.BytecodeVersion; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -42,6 +41,13 @@ public class InstrSupportTest { trace = new TraceMethodVisitor(printer); } + @Test + public void getVersionMajor_should_return_major_version_number() { + final byte[] bytes = new byte[] { (byte) 0xCA, (byte) 0xFE, (byte) 0xBA, + (byte) 0xBE, /* minor */ 0x00, 0x03, /* major */ 0x00, 0x2D }; + assertEquals(45, InstrSupport.getVersionMajor(bytes)); + } + @Test public void needFrames_should_return_false_for_versions_less_than_1_6() { assertFalse(InstrSupport.needsFrames(Opcodes.V1_1)); @@ -57,7 +63,7 @@ public class InstrSupportTest { assertTrue(InstrSupport.needsFrames(Opcodes.V1_7)); assertTrue(InstrSupport.needsFrames(Opcodes.V1_8)); assertTrue(InstrSupport.needsFrames(Opcodes.V9)); - assertTrue(InstrSupport.needsFrames(BytecodeVersion.V10)); + assertTrue(InstrSupport.needsFrames(Opcodes.V10)); assertTrue(InstrSupport.needsFrames(Opcodes.V11)); assertTrue(InstrSupport.needsFrames(Opcodes.V12)); } -- cgit v1.2.3