Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to ASM 9.0 #1094

Merged
merged 4 commits into from Sep 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,7 +1,7 @@
<h4>ASM</h4>

<p>
<a href="http://asm.objectweb.org/">ASM 7.2</a> is subject to the terms and
<a href="http://asm.objectweb.org/">ASM 9.0</a> is subject to the terms and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marchof nice catch 👍 while I checked during upgrade to 8.0 that license didn't change, forgot to update this 🤦

conditions of the following license:
</p>

Expand Down
2 changes: 1 addition & 1 deletion org.jacoco.build/pom.xml
Expand Up @@ -139,7 +139,7 @@
<argLine>${jvm.args}</argLine>

<!-- Dependencies versions -->
<asm.version>8.0.1</asm.version>
<asm.version>9.0</asm.version>
<ant.version>1.7.1</ant.version>
<args4j.version>2.0.28</args4j.version>
<junit.version>4.13</junit.version>
Expand Down
Expand Up @@ -107,7 +107,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.V15 + 1);
final byte[] originalBytes = createClass(Opcodes.V16);
final byte[] bytes = new byte[originalBytes.length];
System.arraycopy(originalBytes, 0, bytes, 0, originalBytes.length);
final long expectedClassId = CRC64.classId(bytes);
Expand All @@ -130,7 +130,7 @@ private static byte[] createClass(final int version) {
*/
@Test
public void analyzeClass_should_throw_exception_for_unsupported_class_file_version() {
final byte[] bytes = createClass(Opcodes.V15 + 2);
final byte[] bytes = createClass(Opcodes.V16 + 1);
try {
analyzer.analyzeClass(bytes, "UnsupportedVersion");
fail("exception expected");
Expand Down Expand Up @@ -217,7 +217,7 @@ public void testAnalyzeClass_BrokenStream() throws IOException {
*/
@Test
public void analyzeAll_should_throw_exception_for_unsupported_class_file_version() {
final byte[] bytes = createClass(Opcodes.V15 + 2);
final byte[] bytes = createClass(Opcodes.V16 + 1);
try {
analyzer.analyzeAll(new ByteArrayInputStream(bytes),
"UnsupportedVersion");
Expand Down
Expand Up @@ -30,6 +30,7 @@
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.V16;
import static org.objectweb.asm.Opcodes.V1_1;
import static org.objectweb.asm.Opcodes.V1_2;
import static org.objectweb.asm.Opcodes.V1_3;
Expand Down Expand Up @@ -135,7 +136,7 @@ public void test_15() throws IOException {

@Test
public void test_16() throws IOException {
testVersion(V15 + 1, true);
testVersion(V16, true);
}

private void testVersion(int version, boolean frames) throws IOException {
Expand Down
Expand Up @@ -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.V15 + 1);
final byte[] originalBytes = createClass(Opcodes.V16);
final byte[] bytes = new byte[originalBytes.length];
System.arraycopy(originalBytes, 0, bytes, 0, originalBytes.length);
final long expectedClassId = CRC64.classId(bytes);
Expand All @@ -122,7 +122,7 @@ private static byte[] createClass(final int version) {
*/
@Test
public void instrument_should_throw_exception_for_unsupported_class_file_version() {
final byte[] bytes = createClass(Opcodes.V15 + 2);
final byte[] bytes = createClass(Opcodes.V16 + 1);
try {
instrumenter.instrument(bytes, "UnsupportedVersion");
fail("exception expected");
Expand Down Expand Up @@ -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.V15 + 2);
final byte[] bytes = createClass(Opcodes.V16 + 1);
try {
instrumenter.instrumentAll(new ByteArrayInputStream(bytes),
new ByteArrayOutputStream(), "UnsupportedVersion");
Expand Down
Expand Up @@ -53,7 +53,7 @@ public void classReaderFor_should_read_java_16_class() {
public void visit(final int version, final int access,
final String name, final String signature,
final String superName, final String[] interfaces) {
assertEquals(Opcodes.V15 + 1, version);
assertEquals(Opcodes.V16, version);
}
}, 0);

Expand All @@ -62,7 +62,7 @@ public void visit(final int version, final int access,

private static byte[] createJava16Class() {
final ClassWriter cw = new ClassWriter(0);
cw.visit(Opcodes.V15 + 1, 0, "Foo", null, "java/lang/Object", null);
cw.visit(Opcodes.V16, 0, "Foo", null, "java/lang/Object", null);
cw.visitEnd();
return cw.toByteArray();
}
Expand Down Expand Up @@ -127,7 +127,7 @@ public void needFrames_should_return_true_for_versions_greater_than_or_equal_to_
assertTrue(InstrSupport.needsFrames(Opcodes.V13));
assertTrue(InstrSupport.needsFrames(Opcodes.V14));
assertTrue(InstrSupport.needsFrames(Opcodes.V15));
assertTrue(InstrSupport.needsFrames(Opcodes.V15 + 1));
assertTrue(InstrSupport.needsFrames(Opcodes.V16));

assertTrue(InstrSupport.needsFrames(0x0100));
}
Expand Down
Expand Up @@ -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.V15 + 1) {
if (originalVersion == Opcodes.V16) {
// temporarily downgrade version to bypass check in ASM
setMajorVersion(Opcodes.V15, b);
setMajorVersion(Opcodes.V16, b);
}
final ClassReader classReader = new ClassReader(b);
setMajorVersion(originalVersion, b);
Expand Down
13 changes: 13 additions & 0 deletions org.jacoco.doc/docroot/doc/changes.html
Expand Up @@ -20,6 +20,19 @@ <h1>Change History</h1>

<h2>Snapshot Build @qualified.bundle.version@ (@build.date@)</h2>

<h3>New Features</h3>
<ul>
<li>JaCoCo now officially supports Java 15
(GitHub <a href="https://github.com/jacoco/jacoco/issues/1094">#1094</a>).</li>
</ul>

<h3>Non-functional Changes</h3>
<ul>
<li>JaCoCo now depends on ASM 9.0
(GitHub <a href="https://github.com/jacoco/jacoco/issues/1094">#1094</a>).</li>
</ul>


<h2>Release 0.8.6 (2020/09/15)</h2>

<h3>New Features</h3>
Expand Down