diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index 347679ea1d..4a622bd104 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -33,6 +33,8 @@ jobs: JDK_VERSION: 17 JDK 18: JDK_VERSION: 18 + JDK 19: + JDK_VERSION: 19 pool: vmImage: 'ubuntu-18.04' steps: diff --git a/org.jacoco.build/pom.xml b/org.jacoco.build/pom.xml index f452cde6ac..29dad3a560 100644 --- a/org.jacoco.build/pom.xml +++ b/org.jacoco.build/pom.xml @@ -894,6 +894,20 @@ + + java19-bytecode + + + bytecode.version + 19 + + + + 13 + 13 + + + ecj diff --git a/org.jacoco.core.test.validation/pom.xml b/org.jacoco.core.test.validation/pom.xml index 46041095b2..9df1529001 100644 --- a/org.jacoco.core.test.validation/pom.xml +++ b/org.jacoco.core.test.validation/pom.xml @@ -369,6 +369,36 @@ ../org.jacoco.core.test.validation.scala + + + java19-bytecode + + + bytecode.version + 19 + + + + + 16 + + 16 + + 19 + 19 + + + ../org.jacoco.core.test.validation.kotlin + ../org.jacoco.core.test.validation.java7 + ../org.jacoco.core.test.validation.java8 + ../org.jacoco.core.test.validation.java14 + ../org.jacoco.core.test.validation.java16 + + ../org.jacoco.core.test.validation.scala + + 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 00b0aebba5..cbc357bd0a 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 void should_ignore_synthetic_classes() throws Exception { @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 @@ private static byte[] createClass(final int version) { */ @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 void testAnalyzeClass_BrokenStream() throws IOException { */ @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 void analyzeAll_should_throw_exception_for_unsupported_class_file_version } 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 44d16d36e7..e745ce8de9 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 void setup() throws Exception { @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 @@ private static byte[] createClass(final int version) { */ @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 void testSerialization() throws Exception { */ @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 void instrumentAll_should_throw_exception_for_unsupported_class_file_vers } 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 4db19bf51c..d98a25616a 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 void setup() { } @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 void classReaderFor_should_read_java_18_class() { 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 void needFrames_should_return_true_for_versions_greater_than_or_equal_to_ 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)); } diff --git a/org.jacoco.core/src/org/jacoco/core/internal/instr/InstrSupport.java b/org.jacoco.core/src/org/jacoco/core/internal/instr/InstrSupport.java index 003efabea5..88e25944d6 100644 --- a/org.jacoco.core/src/org/jacoco/core/internal/instr/InstrSupport.java +++ b/org.jacoco.core/src/org/jacoco/core/internal/instr/InstrSupport.java @@ -273,9 +273,9 @@ public static void push(final MethodVisitor mv, final int value) { */ public static ClassReader classReaderFor(final byte[] b) { final int originalVersion = getMajorVersion(b); - if (originalVersion == Opcodes.V17 + 1) { + if (originalVersion == Opcodes.V18 + 1) { // temporarily downgrade version to bypass check in ASM - setMajorVersion(Opcodes.V17, b); + setMajorVersion(Opcodes.V18, b); } final ClassReader classReader = new ClassReader(b); setMajorVersion(originalVersion, b); diff --git a/org.jacoco.doc/docroot/doc/changes.html b/org.jacoco.doc/docroot/doc/changes.html index 873039ab62..392763f7b0 100644 --- a/org.jacoco.doc/docroot/doc/changes.html +++ b/org.jacoco.doc/docroot/doc/changes.html @@ -24,6 +24,8 @@

New Features