aboutsummaryrefslogtreecommitdiff
path: root/org.jacoco.core.test/src
diff options
context:
space:
mode:
authorEvgeny Mandrikov <138671+Godin@users.noreply.github.com>2021-12-14 11:15:09 +0100
committerGitHub <noreply@github.com>2021-12-14 11:15:09 +0100
commitac756b60c029d0acf5e1202c9966b2c5a79b6b8c (patch)
treee1c314b267e1b1f8136f05f91ba4cf4ffec123d8 /org.jacoco.core.test/src
parenta0cf1e6c0ce9bbfeda705201278689a01b3d274b (diff)
downloadjacoco-ac756b60c029d0acf5e1202c9966b2c5a79b6b8c.tar.gz
Add experimental support for Java 19 class files (#1264)
Diffstat (limited to 'org.jacoco.core.test/src')
-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/InstrumenterTest.java10
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/internal/instr/InstrSupportTest.java15
3 files changed, 18 insertions, 17 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 00b0aebb..cbc357bd 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
@@ -108,7 +108,7 @@ public class AnalyzerTest {
@Test
public void should_not_modify_class_bytes_to_support_next_version()
throws Exception {
- final byte[] originalBytes = createClass(Opcodes.V17 + 1);
+ final byte[] originalBytes = createClass(Opcodes.V18 + 1);
final byte[] bytes = new byte[originalBytes.length];
System.arraycopy(originalBytes, 0, bytes, 0, originalBytes.length);
final long expectedClassId = CRC64.classId(bytes);
@@ -131,14 +131,14 @@ public class AnalyzerTest {
*/
@Test
public void analyzeClass_should_throw_exception_for_unsupported_class_file_version() {
- final byte[] bytes = createClass(Opcodes.V17 + 2);
+ final byte[] bytes = createClass(Opcodes.V18 + 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 63",
+ assertEquals("Unsupported class file major version 64",
e.getCause().getMessage());
}
}
@@ -218,7 +218,7 @@ public class AnalyzerTest {
*/
@Test
public void analyzeAll_should_throw_exception_for_unsupported_class_file_version() {
- final byte[] bytes = createClass(Opcodes.V17 + 2);
+ final byte[] bytes = createClass(Opcodes.V18 + 2);
try {
analyzer.analyzeAll(new ByteArrayInputStream(bytes),
"UnsupportedVersion");
@@ -226,7 +226,7 @@ public class AnalyzerTest {
} catch (IOException e) {
assertEquals("Error while analyzing UnsupportedVersion.",
e.getMessage());
- assertEquals("Unsupported class file major version 63",
+ assertEquals("Unsupported class file major version 64",
e.getCause().getMessage());
}
}
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 44d16d36..e745ce8d 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.V17 + 1);
+ final byte[] originalBytes = createClass(Opcodes.V18 + 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.V17 + 2);
+ final byte[] bytes = createClass(Opcodes.V18 + 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 63",
+ assertEquals("Unsupported class file major version 64",
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.V17 + 2);
+ final byte[] bytes = createClass(Opcodes.V18 + 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 63",
+ assertEquals("Unsupported class file major version 64",
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 4db19bf5..d98a2561 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_18_class() {
- final byte[] bytes = createJava18Class();
+ public void classReaderFor_should_read_java_19_class() {
+ final byte[] bytes = createJava19Class();
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.V17 + 1, version);
+ assertEquals(Opcodes.V18 + 1, version);
}
}, 0);
- assertArrayEquals(createJava18Class(), bytes);
+ assertArrayEquals(createJava19Class(), bytes);
}
- private static byte[] createJava18Class() {
+ private static byte[] createJava19Class() {
final ClassWriter cw = new ClassWriter(0);
- cw.visit(Opcodes.V17 + 1, 0, "Foo", null, "java/lang/Object", null);
+ cw.visit(Opcodes.V18 + 1, 0, "Foo", null, "java/lang/Object", null);
cw.visitEnd();
return cw.toByteArray();
}
@@ -129,7 +129,8 @@ public class InstrSupportTest {
assertTrue(InstrSupport.needsFrames(Opcodes.V15));
assertTrue(InstrSupport.needsFrames(Opcodes.V16));
assertTrue(InstrSupport.needsFrames(Opcodes.V17));
- assertTrue(InstrSupport.needsFrames(Opcodes.V17 + 1));
+ assertTrue(InstrSupport.needsFrames(Opcodes.V18));
+ assertTrue(InstrSupport.needsFrames(Opcodes.V18 + 1));
assertTrue(InstrSupport.needsFrames(0x0100));
}