aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jacoco-maven-plugin.test/it/it-java9-offline-instrumentation/pom.xml6
-rw-r--r--org.jacoco.build/pom.xml26
-rw-r--r--org.jacoco.cli.test/src/org/jacoco/cli/internal/commands/InstrumentTest.java2
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/analysis/AnalyzerTest.java5
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/internal/flow/FrameSnapshotTest.java3
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/internal/instr/ProbeArrayStrategyFactoryTest.java4
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/test/validation/ClassFileVersionsTest.java8
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/test/validation/FramesTest.java4
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/test/validation/ResizeInstructionsTest.java22
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/test/validation/StructuredLockingTest.java4
-rw-r--r--org.jacoco.core/pom.xml18
-rw-r--r--org.jacoco.core/src/org/jacoco/core/analysis/Analyzer.java7
-rw-r--r--org.jacoco.core/src/org/jacoco/core/instr/Instrumenter.java13
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/ContentTypeDetector.java2
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/InputStreams.java49
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/Java9Support.java112
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/instr/InstrSupport.java2
-rw-r--r--org.jacoco.core/src/org/jacoco/core/runtime/ModifiedSystemClassRuntime.java3
-rw-r--r--org.jacoco.doc/docroot/doc/changes.html12
-rw-r--r--org.jacoco.report/pom.xml4
20 files changed, 133 insertions, 173 deletions
diff --git a/jacoco-maven-plugin.test/it/it-java9-offline-instrumentation/pom.xml b/jacoco-maven-plugin.test/it/it-java9-offline-instrumentation/pom.xml
index e6583c08..733e1e02 100644
--- a/jacoco-maven-plugin.test/it/it-java9-offline-instrumentation/pom.xml
+++ b/jacoco-maven-plugin.test/it/it-java9-offline-instrumentation/pom.xml
@@ -50,12 +50,6 @@
<goals>
<goal>instrument</goal>
</goals>
- <configuration>
- <!-- FIXME remove this workaround after update of ASM to 6.0 -->
- <excludes>
- <exclude>module-info.class</exclude>
- </excludes>
- </configuration>
</execution>
<execution>
<id>restore-instrumented-classes</id>
diff --git a/org.jacoco.build/pom.xml b/org.jacoco.build/pom.xml
index 968f2081..dee6323f 100644
--- a/org.jacoco.build/pom.xml
+++ b/org.jacoco.build/pom.xml
@@ -141,7 +141,7 @@
<argLine>${jvm.args}</argLine>
<!-- Dependencies versions -->
- <asm.version>5.2</asm.version>
+ <asm.version>6.0</asm.version>
<ant.version>1.7.1</ant.version>
<args4j.version>2.0.28</args4j.version>
<junit.version>4.8.2</junit.version>
@@ -210,7 +210,27 @@
<!-- Third-party dependencies -->
<dependency>
<groupId>org.ow2.asm</groupId>
- <artifactId>asm-debug-all</artifactId>
+ <artifactId>asm</artifactId>
+ <version>${asm.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.ow2.asm</groupId>
+ <artifactId>asm-commons</artifactId>
+ <version>${asm.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.ow2.asm</groupId>
+ <artifactId>asm-tree</artifactId>
+ <version>${asm.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.ow2.asm</groupId>
+ <artifactId>asm-analysis</artifactId>
+ <version>${asm.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.ow2.asm</groupId>
+ <artifactId>asm-util</artifactId>
<version>${asm.version}</version>
</dependency>
<dependency>
@@ -370,7 +390,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
- <version>2.4.3</version>
+ <version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
diff --git a/org.jacoco.cli.test/src/org/jacoco/cli/internal/commands/InstrumentTest.java b/org.jacoco.cli.test/src/org/jacoco/cli/internal/commands/InstrumentTest.java
index 59594a76..25a4be01 100644
--- a/org.jacoco.cli.test/src/org/jacoco/cli/internal/commands/InstrumentTest.java
+++ b/org.jacoco.cli.test/src/org/jacoco/cli/internal/commands/InstrumentTest.java
@@ -137,7 +137,7 @@ public class InstrumentTest extends CommandTestBase {
ClassReader reader = new ClassReader(in);
in.close();
final Set<String> fields = new HashSet<String>();
- reader.accept(new ClassVisitor(Opcodes.ASM5) {
+ reader.accept(new ClassVisitor(Opcodes.ASM6) {
@Override
public FieldVisitor visitField(int access, String name, String desc,
String signature, Object value) {
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 1bf63ad6..71808496 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
@@ -36,7 +36,6 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import org.jacoco.core.data.ExecutionDataStore;
-import org.jacoco.core.internal.Java9Support;
import org.jacoco.core.internal.data.CRC64;
import org.jacoco.core.test.TargetLoader;
import org.junit.Before;
@@ -93,8 +92,8 @@ public class AnalyzerTest {
@Test
public void testAnalyzeClassIdMatch() throws IOException {
// class IDs are always calculated after downgrade of the version
- final byte[] bytes = Java9Support.downgradeIfRequired(
- TargetLoader.getClassDataAsBytes(AnalyzerTest.class));
+ final byte[] bytes = TargetLoader
+ .getClassDataAsBytes(AnalyzerTest.class);
executionData.get(Long.valueOf(CRC64.checksum(bytes)),
"org/jacoco/core/analysis/AnalyzerTest", 200);
analyzer.analyzeClass(bytes, "Test");
diff --git a/org.jacoco.core.test/src/org/jacoco/core/internal/flow/FrameSnapshotTest.java b/org.jacoco.core.test/src/org/jacoco/core/internal/flow/FrameSnapshotTest.java
index e89176b9..9df32e11 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/internal/flow/FrameSnapshotTest.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/internal/flow/FrameSnapshotTest.java
@@ -115,8 +115,7 @@ public class FrameSnapshotTest {
analyzer.visitInsn(Opcodes.AALOAD);
frame = FrameSnapshot.create(analyzer, 0);
- // FIXME should be Opcodes.NULL after update of ASM to 6.0
- final Object[] stack = arr("java/lang/Object");
+ final Object[] stack = arr(Opcodes.NULL);
expectedVisitor.visitFrame(Opcodes.F_FULL, 1, arr("Foo"), 1, stack);
}
diff --git a/org.jacoco.core.test/src/org/jacoco/core/internal/instr/ProbeArrayStrategyFactoryTest.java b/org.jacoco.core.test/src/org/jacoco/core/internal/instr/ProbeArrayStrategyFactoryTest.java
index 33415207..a68e4990 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/internal/instr/ProbeArrayStrategyFactoryTest.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/internal/instr/ProbeArrayStrategyFactoryTest.java
@@ -283,7 +283,7 @@ public class ProbeArrayStrategyFactoryTest {
private final List<AddedMethod> methods = new ArrayList<AddedMethod>();
ClassVisitorMock() {
- super(Opcodes.ASM5);
+ super(Opcodes.ASM6);
}
@Override
@@ -300,7 +300,7 @@ public class ProbeArrayStrategyFactoryTest {
String signature, String[] exceptions) {
final AddedMethod m = new AddedMethod(access, name, desc);
methods.add(m);
- return new MethodVisitor(Opcodes.ASM5) {
+ return new MethodVisitor(Opcodes.ASM6) {
@Override
public void visitFrame(int type, int nLocal, Object[] local,
int nStack, Object[] stack) {
diff --git a/org.jacoco.core.test/src/org/jacoco/core/test/validation/ClassFileVersionsTest.java b/org.jacoco.core.test/src/org/jacoco/core/test/validation/ClassFileVersionsTest.java
index 1ec04deb..8465b833 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/test/validation/ClassFileVersionsTest.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/test/validation/ClassFileVersionsTest.java
@@ -25,11 +25,11 @@ import static org.objectweb.asm.Opcodes.V1_5;
import static org.objectweb.asm.Opcodes.V1_6;
import static org.objectweb.asm.Opcodes.V1_7;
import static org.objectweb.asm.Opcodes.V1_8;
+import static org.objectweb.asm.Opcodes.V9;
import java.io.IOException;
import org.jacoco.core.instr.Instrumenter;
-import org.jacoco.core.internal.Java9Support;
import org.jacoco.core.internal.instr.InstrSupport;
import org.jacoco.core.runtime.IRuntime;
import org.jacoco.core.runtime.SystemPropertiesRuntime;
@@ -86,7 +86,7 @@ public class ClassFileVersionsTest {
@Test
public void test_1_9() throws IOException {
- testVersion(Java9Support.V1_9, true);
+ testVersion(V9, true);
}
private void testVersion(int version, boolean frames) throws IOException {
@@ -101,8 +101,8 @@ public class ClassFileVersionsTest {
private void assertFrames(byte[] source, boolean expected) {
final boolean[] hasFrames = new boolean[] { false };
- new ClassReader(Java9Support.downgradeIfRequired(source)).accept(
- new ClassVisitor(InstrSupport.ASM_API_VERSION) {
+ new ClassReader(source)
+ .accept(new ClassVisitor(InstrSupport.ASM_API_VERSION) {
@Override
public MethodVisitor visitMethod(int access, String name,
diff --git a/org.jacoco.core.test/src/org/jacoco/core/test/validation/FramesTest.java b/org.jacoco.core.test/src/org/jacoco/core/test/validation/FramesTest.java
index 9bea83ab..afc4978f 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/test/validation/FramesTest.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/test/validation/FramesTest.java
@@ -18,7 +18,6 @@ import java.io.PrintWriter;
import java.io.StringWriter;
import org.jacoco.core.instr.Instrumenter;
-import org.jacoco.core.internal.Java9Support;
import org.jacoco.core.internal.instr.InstrSupport;
import org.jacoco.core.runtime.IRuntime;
import org.jacoco.core.runtime.SystemPropertiesRuntime;
@@ -88,8 +87,7 @@ public class FramesTest {
}
private byte[] calculateFrames(byte[] source) {
- ClassReader rc = new ClassReader(
- Java9Support.downgradeIfRequired(source));
+ ClassReader rc = new ClassReader(source);
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
// Adjust Version to 1.6 to enable frames:
diff --git a/org.jacoco.core.test/src/org/jacoco/core/test/validation/ResizeInstructionsTest.java b/org.jacoco.core.test/src/org/jacoco/core/test/validation/ResizeInstructionsTest.java
index 413c37ac..0d2c2145 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/test/validation/ResizeInstructionsTest.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/test/validation/ResizeInstructionsTest.java
@@ -11,12 +11,11 @@
*******************************************************************************/
package org.jacoco.core.test.validation;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import org.jacoco.core.instr.Instrumenter;
-import org.jacoco.core.internal.Java9Support;
import org.jacoco.core.internal.instr.InstrSupport;
import org.jacoco.core.runtime.IRuntime;
import org.jacoco.core.runtime.RuntimeData;
@@ -58,9 +57,11 @@ public class ResizeInstructionsTest {
*/
@Test
public void should_not_loose_InnerClasses_attribute() throws Exception {
- final ClassWriter cw = new ClassWriter(0);
- final ClassReader cr = new ClassReader(Java9Support.downgradeIfRequired(
- TargetLoader.getClassDataAsBytes(Inner.class)));
+ // FIXME fails without COMPUTE_FRAMES because of
+ // https://gitlab.ow2.org/asm/asm/issues/317800
+ final ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
+ final ClassReader cr = new ClassReader(
+ TargetLoader.getClassDataAsBytes(Inner.class));
cr.accept(new ClassVisitor(InstrSupport.ASM_API_VERSION, cw) {
@Override
public void visitEnd() {
@@ -79,11 +80,10 @@ public class ResizeInstructionsTest {
final Class<?> outer = targetLoader.add(ResizeInstructionsTest.class,
TargetLoader.getClassDataAsBytes(ResizeInstructionsTest.class));
final Class<?> inner = targetLoader.add(Inner.class, bytes);
- // FIXME should not be null after update of ASM to 6.0
- assertNotSame(outer, inner.getEnclosingClass());
- assertNull(inner.getEnclosingClass());
- assertNotSame(outer, inner.getDeclaringClass());
- assertNull(inner.getDeclaringClass());
+ assertSame(outer, inner.getEnclosingClass());
+ assertNotNull(inner.getEnclosingClass());
+ assertSame(outer, inner.getDeclaringClass());
+ assertNotNull(inner.getDeclaringClass());
}
/**
diff --git a/org.jacoco.core.test/src/org/jacoco/core/test/validation/StructuredLockingTest.java b/org.jacoco.core.test/src/org/jacoco/core/test/validation/StructuredLockingTest.java
index 9aa67a6c..ef95e591 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/test/validation/StructuredLockingTest.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/test/validation/StructuredLockingTest.java
@@ -20,7 +20,6 @@ import java.util.List;
import java.util.Set;
import org.jacoco.core.instr.Instrumenter;
-import org.jacoco.core.internal.Java9Support;
import org.jacoco.core.runtime.IRuntime;
import org.jacoco.core.runtime.SystemPropertiesRuntime;
import org.jacoco.core.test.TargetLoader;
@@ -64,8 +63,7 @@ public class StructuredLockingTest {
byte[] instrumented = instrumenter.instrument(source, "TestTarget");
ClassNode cn = new ClassNode();
- new ClassReader(Java9Support.downgradeIfRequired(instrumented))
- .accept(cn, 0);
+ new ClassReader(instrumented).accept(cn, 0);
for (MethodNode mn : cn.methods) {
assertStructuredLocking(cn.name, mn);
}
diff --git a/org.jacoco.core/pom.xml b/org.jacoco.core/pom.xml
index 2f8f94c7..9b5766b2 100644
--- a/org.jacoco.core/pom.xml
+++ b/org.jacoco.core/pom.xml
@@ -27,7 +27,23 @@
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
- <artifactId>asm-debug-all</artifactId>
+ <artifactId>asm</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.ow2.asm</groupId>
+ <artifactId>asm-commons</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.ow2.asm</groupId>
+ <artifactId>asm-tree</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.ow2.asm</groupId>
+ <artifactId>asm-analysis</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.ow2.asm</groupId>
+ <artifactId>asm-util</artifactId>
</dependency>
</dependencies>
diff --git a/org.jacoco.core/src/org/jacoco/core/analysis/Analyzer.java b/org.jacoco.core/src/org/jacoco/core/analysis/Analyzer.java
index 06c7ec2b..32384b86 100644
--- a/org.jacoco.core/src/org/jacoco/core/analysis/Analyzer.java
+++ b/org.jacoco.core/src/org/jacoco/core/analysis/Analyzer.java
@@ -23,7 +23,7 @@ import java.util.zip.ZipInputStream;
import org.jacoco.core.data.ExecutionData;
import org.jacoco.core.data.ExecutionDataStore;
import org.jacoco.core.internal.ContentTypeDetector;
-import org.jacoco.core.internal.Java9Support;
+import org.jacoco.core.internal.InputStreams;
import org.jacoco.core.internal.Pack200Streams;
import org.jacoco.core.internal.analysis.ClassAnalyzer;
import org.jacoco.core.internal.analysis.ClassCoverageImpl;
@@ -124,8 +124,7 @@ public class Analyzer {
public void analyzeClass(final byte[] buffer, final String location)
throws IOException {
try {
- analyzeClass(
- new ClassReader(Java9Support.downgradeIfRequired(buffer)));
+ analyzeClass(new ClassReader(buffer));
} catch (final RuntimeException cause) {
throw analyzerError(location, cause);
}
@@ -146,7 +145,7 @@ public class Analyzer {
throws IOException {
final byte[] buffer;
try {
- buffer = Java9Support.readFully(input);
+ buffer = InputStreams.readFully(input);
} catch (final IOException e) {
throw analyzerError(location, e);
}
diff --git a/org.jacoco.core/src/org/jacoco/core/instr/Instrumenter.java b/org.jacoco.core/src/org/jacoco/core/instr/Instrumenter.java
index 179861ca..5129f62a 100644
--- a/org.jacoco.core/src/org/jacoco/core/instr/Instrumenter.java
+++ b/org.jacoco.core/src/org/jacoco/core/instr/Instrumenter.java
@@ -22,7 +22,7 @@ import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
import org.jacoco.core.internal.ContentTypeDetector;
-import org.jacoco.core.internal.Java9Support;
+import org.jacoco.core.internal.InputStreams;
import org.jacoco.core.internal.Pack200Streams;
import org.jacoco.core.internal.flow.ClassProbesAdapter;
import org.jacoco.core.internal.instr.ClassInstrumenter;
@@ -105,14 +105,7 @@ public class Instrumenter {
public byte[] instrument(final byte[] buffer, final String name)
throws IOException {
try {
- if (Java9Support.isPatchRequired(buffer)) {
- final byte[] result = instrument(
- new ClassReader(Java9Support.downgrade(buffer)));
- Java9Support.upgrade(result);
- return result;
- } else {
- return instrument(new ClassReader(buffer));
- }
+ return instrument(new ClassReader(buffer));
} catch (final RuntimeException e) {
throw instrumentError(name, e);
}
@@ -135,7 +128,7 @@ public class Instrumenter {
throws IOException {
final byte[] bytes;
try {
- bytes = Java9Support.readFully(input);
+ bytes = InputStreams.readFully(input);
} catch (final IOException e) {
throw instrumentError(name, e);
}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/ContentTypeDetector.java b/org.jacoco.core/src/org/jacoco/core/internal/ContentTypeDetector.java
index 2d7362b5..46992ad5 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/ContentTypeDetector.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/ContentTypeDetector.java
@@ -82,7 +82,7 @@ public class ContentTypeDetector {
case Opcodes.V1_6:
case Opcodes.V1_7:
case Opcodes.V1_8:
- case Java9Support.V1_9:
+ case Opcodes.V9:
return CLASSFILE;
}
}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/InputStreams.java b/org.jacoco.core/src/org/jacoco/core/internal/InputStreams.java
new file mode 100644
index 00000000..463545df
--- /dev/null
+++ b/org.jacoco.core/src/org/jacoco/core/internal/InputStreams.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2017 Mountainminds GmbH & Co. KG and Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Evgeny Mandrikov - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.internal;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Utilities for {@link InputStream}s.
+ */
+public final class InputStreams {
+
+ private InputStreams() {
+ }
+
+ /**
+ * Reads all bytes from an input stream into a byte array. The provided
+ * {@link InputStream} is not closed by this method.
+ *
+ * @param is
+ * the input stream to read from
+ * @return a byte array containing all the bytes from the stream
+ * @throws IOException
+ * if an I/O error occurs
+ */
+ public static byte[] readFully(final InputStream is) throws IOException {
+ final byte[] buf = new byte[1024];
+ final ByteArrayOutputStream out = new ByteArrayOutputStream();
+ while (true) {
+ final int r = is.read(buf);
+ if (r == -1) {
+ break;
+ }
+ out.write(buf, 0, r);
+ }
+ return out.toByteArray();
+ }
+
+}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/Java9Support.java b/org.jacoco.core/src/org/jacoco/core/internal/Java9Support.java
deleted file mode 100644
index 70a921bd..00000000
--- a/org.jacoco.core/src/org/jacoco/core/internal/Java9Support.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2017 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Evgeny Mandrikov - initial API and implementation
- *
- *******************************************************************************/
-package org.jacoco.core.internal;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.objectweb.asm.Opcodes;
-
-/**
- * Patching for Java 9 classes, so that ASM can read them.
- */
-public final class Java9Support {
-
- /**
- * Version of the Java 9 class file format.
- */
- public static final int V1_9 = Opcodes.V1_8 + 1;
-
- private Java9Support() {
- }
-
- /**
- * Reads all bytes from an input stream into a byte array.
- *
- * @param is
- * the input stream to read from
- * @return a byte array containing all the bytes from the stream
- * @throws IOException
- * if an I/O error occurs
- */
- public static byte[] readFully(final InputStream is)
- throws IOException {
- final byte[] buf = new byte[1024];
- final ByteArrayOutputStream out = new ByteArrayOutputStream();
- while (true) {
- int r = is.read(buf);
- if (r == -1) {
- break;
- }
- out.write(buf, 0, r);
- }
- return out.toByteArray();
- }
-
- private static void putShort(byte[] b, int index, int s) {
- b[index] = (byte) (s >>> 8);
- b[index + 1] = (byte) s;
- }
-
- private static short readShort(byte[] b, int index) {
- return (short) (((b[index] & 0xFF) << 8) | (b[index + 1] & 0xFF));
- }
-
- /**
- * Determines whether class definition contains {@link #V1_9} version.
- *
- * @param buffer
- * definition of the class
- * @return <code>true</code> if class definition contains Java 9 version
- */
- public static boolean isPatchRequired(byte[] buffer) {
- return readShort(buffer, 6) == V1_9;
- }
-
- /**
- * Returns new definition of class with version {@link Opcodes#V1_8},
- * if it has version {@link #V1_9}.
- *
- * @param buffer
- * definition of the class
- * @return new definition of the class
- */
- public static byte[] downgradeIfRequired(byte[] buffer) {
- return isPatchRequired(buffer) ? downgrade(buffer) : buffer;
- }
-
- /**
- * Replaces version in the definition of class on {@link Opcodes#V1_8}.
- *
- * @param b
- * definition of the class
- * @return new definition of the class
- */
- public static byte[] downgrade(byte[] b) {
- byte[] result = new byte[b.length];
- System.arraycopy(b, 0, result, 0, b.length);
- putShort(result, 6, Opcodes.V1_8);
- return result;
- }
-
- /**
- * Replaces version in the definition of class on {@link #V1_9}.
- *
- * @param b
- * definition of the class
- */
- public static void upgrade(byte[] b) {
- putShort(b, 6, V1_9);
- }
-
-}
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 c38094fa..7499c97b 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
@@ -25,7 +25,7 @@ public final class InstrSupport {
}
/** ASM API version */
- public static final int ASM_API_VERSION = Opcodes.ASM5;
+ public static final int ASM_API_VERSION = Opcodes.ASM6;
// === Data Field ===
diff --git a/org.jacoco.core/src/org/jacoco/core/runtime/ModifiedSystemClassRuntime.java b/org.jacoco.core/src/org/jacoco/core/runtime/ModifiedSystemClassRuntime.java
index e4ec31b9..dd2c1d57 100644
--- a/org.jacoco.core/src/org/jacoco/core/runtime/ModifiedSystemClassRuntime.java
+++ b/org.jacoco.core/src/org/jacoco/core/runtime/ModifiedSystemClassRuntime.java
@@ -19,7 +19,6 @@ import java.lang.instrument.Instrumentation;
import java.lang.reflect.Field;
import java.security.ProtectionDomain;
-import org.jacoco.core.internal.Java9Support;
import org.jacoco.core.internal.instr.InstrSupport;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
@@ -154,7 +153,7 @@ public class ModifiedSystemClassRuntime extends AbstractRuntime {
*/
public static byte[] instrument(final byte[] source,
final String accessFieldName) {
- final ClassReader reader = new ClassReader(Java9Support.downgradeIfRequired(source));
+ final ClassReader reader = new ClassReader(source);
final ClassWriter writer = new ClassWriter(reader, 0);
reader.accept(new ClassVisitor(InstrSupport.ASM_API_VERSION, writer) {
diff --git a/org.jacoco.doc/docroot/doc/changes.html b/org.jacoco.doc/docroot/doc/changes.html
index b9e61a12..9035dc36 100644
--- a/org.jacoco.doc/docroot/doc/changes.html
+++ b/org.jacoco.doc/docroot/doc/changes.html
@@ -68,10 +68,22 @@
(GitHub <a href="https://github.com/jacoco/jacoco/issues/555">#555</a>).</li>
<li>Restored Maven <code>help</code> goal that was missing in version 0.7.9
(GitHub <a href="https://github.com/jacoco/jacoco/issues/559">#559</a>).</li>
+ <li><code>NullPointerException</code> during offline instrumentation of
+ <code>module-info.class</code>
+ (GitHub <a href="https://github.com/jacoco/jacoco/issues/600">#600</a>).</li>
+ <li>Incorrect update of frames caused by bug in ASM library
+ (GitHub <a href="https://github.com/jacoco/jacoco/issues/600">#600</a>).</li>
+ <li>Loss of <code>InnerClasses</code> attribute caused by bug in ASM library
+ (GitHub <a href="https://github.com/jacoco/jacoco/issues/600">#600</a>).</li>
+ <li><code>NegativeArraySizeException</code> during instrumentation caused by bug
+ in ASM library
+ (GitHub <a href="https://github.com/jacoco/jacoco/issues/600">#600</a>).</li>
</ul>
<h3>Non-functional Changes</h3>
<ul>
+ <li>JaCoCo now depends on ASM 6.0
+ (GitHub <a href="https://github.com/jacoco/jacoco/issues/600">#600</a>).</li>
<li>More information about context is provided when unable to read input during
instrumentation
(GitHub <a href="https://github.com/jacoco/jacoco/issues/527">#527</a>).</li>
diff --git a/org.jacoco.report/pom.xml b/org.jacoco.report/pom.xml
index 19907e91..2d2bd301 100644
--- a/org.jacoco.report/pom.xml
+++ b/org.jacoco.report/pom.xml
@@ -29,10 +29,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>org.jacoco.core</artifactId>
</dependency>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-debug-all</artifactId>
- </dependency>
</dependencies>
<build>