diff options
author | Marc R. Hoffmann <hoffmann@mountainminds.com> | 2018-04-02 22:07:10 +0200 |
---|---|---|
committer | Evgeny Mandrikov <Godin@users.noreply.github.com> | 2018-04-02 22:07:10 +0200 |
commit | 65ad735cf564abeeb2517149843928d28740a559 (patch) | |
tree | d55c9c5cdd9b0fe940f68bda79439c1ad386d34f /org.jacoco.core.test/src/org/jacoco/core/internal/instr | |
parent | ac702e772b29a073da9d1b7b70d8b61610beedb3 (diff) | |
download | jacoco-65ad735cf564abeeb2517149843928d28740a559.tar.gz |
Don't insert stackmap frames into class files with version < 1.6. (#667)
For certain probes additional frames needs to be inserted, but only from
class file version 1.6 on.
Diffstat (limited to 'org.jacoco.core.test/src/org/jacoco/core/internal/instr')
-rw-r--r-- | org.jacoco.core.test/src/org/jacoco/core/internal/instr/InstrSupportTest.java | 22 |
1 files changed, 22 insertions, 0 deletions
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 fb1cb3e3..95de8bd5 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 @@ -12,9 +12,13 @@ package org.jacoco.core.internal.instr; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import org.jacoco.core.internal.BytecodeVersion; import org.junit.Before; import org.junit.Test; +import org.objectweb.asm.Opcodes; import org.objectweb.asm.util.Printer; import org.objectweb.asm.util.Textifier; import org.objectweb.asm.util.TraceMethodVisitor; @@ -34,6 +38,24 @@ public class InstrSupportTest { } @Test + public void needFrames_should_return_false_for_versions_less_than_1_6() { + assertFalse(InstrSupport.needsFrames(Opcodes.V1_1)); + assertFalse(InstrSupport.needsFrames(Opcodes.V1_2)); + assertFalse(InstrSupport.needsFrames(Opcodes.V1_3)); + assertFalse(InstrSupport.needsFrames(Opcodes.V1_4)); + assertFalse(InstrSupport.needsFrames(Opcodes.V1_5)); + } + + @Test + public void needFrames_should_return_true_for_versions_greater_than_or_equal_to_1_6() { + assertTrue(InstrSupport.needsFrames(Opcodes.V1_6)); + assertTrue(InstrSupport.needsFrames(Opcodes.V1_7)); + assertTrue(InstrSupport.needsFrames(Opcodes.V1_8)); + assertTrue(InstrSupport.needsFrames(Opcodes.V9)); + assertTrue(InstrSupport.needsFrames(BytecodeVersion.V10)); + } + + @Test public void testAssertNotIntrumentedPositive() { InstrSupport.assertNotInstrumented("run", "Foo"); } |