aboutsummaryrefslogtreecommitdiff
path: root/org.jacoco.core.test/src/org/jacoco/core
diff options
context:
space:
mode:
authorMarc R. Hoffmann <hoffmann@mountainminds.com>2020-06-17 00:24:23 +0200
committerGitHub <noreply@github.com>2020-06-17 00:24:23 +0200
commit1485a4192d6afee7dd5449d4a0e28ca184efd887 (patch)
tree895716eaa859a36174c3ec2db02464e6d3a375f0 /org.jacoco.core.test/src/org/jacoco/core
parentd60a5b23ba6816c134218550c1d27cf4b3055554 (diff)
downloadjacoco-1485a4192d6afee7dd5449d4a0e28ca184efd887.tar.gz
Add experimental support for Java 16 (#1059)
Diffstat (limited to 'org.jacoco.core.test/src/org/jacoco/core')
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/analysis/AnalyzerTest.java10
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/instr/ClassFileVersionsTest.java8
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/instr/InstrumenterTest.java10
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/internal/instr/InstrSupportTest.java15
4 files changed, 25 insertions, 18 deletions
diff --git a/org.jacoco.core.test/src/org/jacoco/core/analysis/AnalyzerTest.java b/org.jacoco.core.test/src/org/jacoco/core/analysis/AnalyzerTest.java
index 9fc20df3..120ddb92 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/analysis/AnalyzerTest.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/analysis/AnalyzerTest.java
@@ -107,7 +107,7 @@ public class AnalyzerTest {
@Test
public void should_not_modify_class_bytes_to_support_next_version()
throws Exception {
- final byte[] originalBytes = createClass(Opcodes.V14 + 1);
+ final byte[] originalBytes = createClass(Opcodes.V15 + 1);
final byte[] bytes = new byte[originalBytes.length];
System.arraycopy(originalBytes, 0, bytes, 0, originalBytes.length);
final long expectedClassId = CRC64.classId(bytes);
@@ -130,14 +130,14 @@ public class AnalyzerTest {
*/
@Test
public void analyzeClass_should_throw_exception_for_unsupported_class_file_version() {
- final byte[] bytes = createClass(Opcodes.V14 + 2);
+ final byte[] bytes = createClass(Opcodes.V15 + 2);
try {
analyzer.analyzeClass(bytes, "UnsupportedVersion");
fail("exception expected");
} catch (IOException e) {
assertEquals("Error while analyzing UnsupportedVersion.",
e.getMessage());
- assertEquals("Unsupported class file major version 60",
+ assertEquals("Unsupported class file major version 61",
e.getCause().getMessage());
}
}
@@ -217,7 +217,7 @@ public class AnalyzerTest {
*/
@Test
public void analyzeAll_should_throw_exception_for_unsupported_class_file_version() {
- final byte[] bytes = createClass(Opcodes.V14 + 2);
+ final byte[] bytes = createClass(Opcodes.V15 + 2);
try {
analyzer.analyzeAll(new ByteArrayInputStream(bytes),
"UnsupportedVersion");
@@ -225,7 +225,7 @@ public class AnalyzerTest {
} catch (IOException e) {
assertEquals("Error while analyzing UnsupportedVersion.",
e.getMessage());
- assertEquals("Unsupported class file major version 60",
+ assertEquals("Unsupported class file major version 61",
e.getCause().getMessage());
}
}
diff --git a/org.jacoco.core.test/src/org/jacoco/core/instr/ClassFileVersionsTest.java b/org.jacoco.core.test/src/org/jacoco/core/instr/ClassFileVersionsTest.java
index b735b467..f1d21db2 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/instr/ClassFileVersionsTest.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/instr/ClassFileVersionsTest.java
@@ -29,6 +29,7 @@ import static org.objectweb.asm.Opcodes.V11;
import static org.objectweb.asm.Opcodes.V12;
import static org.objectweb.asm.Opcodes.V13;
import static org.objectweb.asm.Opcodes.V14;
+import static org.objectweb.asm.Opcodes.V15;
import static org.objectweb.asm.Opcodes.V1_1;
import static org.objectweb.asm.Opcodes.V1_2;
import static org.objectweb.asm.Opcodes.V1_3;
@@ -129,7 +130,12 @@ public class ClassFileVersionsTest {
@Test
public void test_15() throws IOException {
- testVersion(V14 + 1, true);
+ testVersion(V15, true);
+ }
+
+ @Test
+ public void test_16() throws IOException {
+ testVersion(V15 + 1, true);
}
private void testVersion(int version, boolean frames) throws IOException {
diff --git a/org.jacoco.core.test/src/org/jacoco/core/instr/InstrumenterTest.java b/org.jacoco.core.test/src/org/jacoco/core/instr/InstrumenterTest.java
index b2d27a97..5d29429a 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/instr/InstrumenterTest.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/instr/InstrumenterTest.java
@@ -99,7 +99,7 @@ public class InstrumenterTest {
@Test
public void should_not_modify_class_bytes_to_support_next_version()
throws Exception {
- final byte[] originalBytes = createClass(Opcodes.V14 + 1);
+ final byte[] originalBytes = createClass(Opcodes.V15 + 1);
final byte[] bytes = new byte[originalBytes.length];
System.arraycopy(originalBytes, 0, bytes, 0, originalBytes.length);
final long expectedClassId = CRC64.classId(bytes);
@@ -122,14 +122,14 @@ public class InstrumenterTest {
*/
@Test
public void instrument_should_throw_exception_for_unsupported_class_file_version() {
- final byte[] bytes = createClass(Opcodes.V14 + 2);
+ final byte[] bytes = createClass(Opcodes.V15 + 2);
try {
instrumenter.instrument(bytes, "UnsupportedVersion");
fail("exception expected");
} catch (final IOException e) {
assertEquals("Error while instrumenting UnsupportedVersion.",
e.getMessage());
- assertEquals("Unsupported class file major version 60",
+ assertEquals("Unsupported class file major version 61",
e.getCause().getMessage());
}
}
@@ -224,7 +224,7 @@ public class InstrumenterTest {
*/
@Test
public void instrumentAll_should_throw_exception_for_unsupported_class_file_version() {
- final byte[] bytes = createClass(Opcodes.V14 + 2);
+ final byte[] bytes = createClass(Opcodes.V15 + 2);
try {
instrumenter.instrumentAll(new ByteArrayInputStream(bytes),
new ByteArrayOutputStream(), "UnsupportedVersion");
@@ -232,7 +232,7 @@ public class InstrumenterTest {
} catch (final IOException e) {
assertEquals("Error while instrumenting UnsupportedVersion.",
e.getMessage());
- assertEquals("Unsupported class file major version 60",
+ assertEquals("Unsupported class file major version 61",
e.getCause().getMessage());
}
}
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 924e61be..b6ddb293 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
@@ -43,8 +43,8 @@ public class InstrSupportTest {
}
@Test
- public void classReaderFor_should_read_java_15_class() {
- final byte[] bytes = createJava15Class();
+ public void classReaderFor_should_read_java_16_class() {
+ final byte[] bytes = createJava16Class();
final ClassReader classReader = InstrSupport.classReaderFor(bytes);
@@ -53,16 +53,16 @@ public class InstrSupportTest {
public void visit(final int version, final int access,
final String name, final String signature,
final String superName, final String[] interfaces) {
- assertEquals(Opcodes.V14 + 1, version);
+ assertEquals(Opcodes.V15 + 1, version);
}
}, 0);
- assertArrayEquals(createJava15Class(), bytes);
+ assertArrayEquals(createJava16Class(), bytes);
}
- private static byte[] createJava15Class() {
+ private static byte[] createJava16Class() {
final ClassWriter cw = new ClassWriter(0);
- cw.visit(Opcodes.V14 + 1, 0, "Foo", null, "java/lang/Object", null);
+ cw.visit(Opcodes.V15 + 1, 0, "Foo", null, "java/lang/Object", null);
cw.visitEnd();
return cw.toByteArray();
}
@@ -126,7 +126,8 @@ public class InstrSupportTest {
assertTrue(InstrSupport.needsFrames(Opcodes.V12));
assertTrue(InstrSupport.needsFrames(Opcodes.V13));
assertTrue(InstrSupport.needsFrames(Opcodes.V14));
- assertTrue(InstrSupport.needsFrames(Opcodes.V14 + 1));
+ assertTrue(InstrSupport.needsFrames(Opcodes.V15));
+ assertTrue(InstrSupport.needsFrames(Opcodes.V15 + 1));
assertTrue(InstrSupport.needsFrames(0x0100));
}