diff options
author | Evgeny Mandrikov <138671+Godin@users.noreply.github.com> | 2019-09-22 21:44:02 +0200 |
---|---|---|
committer | Marc R. Hoffmann <hoffmann@mountainminds.com> | 2019-09-22 21:44:02 +0200 |
commit | 18f571a764a9879bb8ceb95f7a23efa373a5a89c (patch) | |
tree | 4c05883646908a8e60027ffe5edff71e95de08fd /org.jacoco.core.test/src/org/jacoco/core | |
parent | 19ef126cf9f3d57bd7a6a147ef745531c751422a (diff) | |
download | jacoco-18f571a764a9879bb8ceb95f7a23efa373a5a89c.tar.gz |
Fix NPE in StringSwitchEcjFilter (#944)
Diffstat (limited to 'org.jacoco.core.test/src/org/jacoco/core')
-rw-r--r-- | org.jacoco.core.test/src/org/jacoco/core/internal/analysis/filter/StringSwitchEcjFilterTest.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/filter/StringSwitchEcjFilterTest.java b/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/filter/StringSwitchEcjFilterTest.java index 3f726185..a13ea8f0 100644 --- a/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/filter/StringSwitchEcjFilterTest.java +++ b/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/filter/StringSwitchEcjFilterTest.java @@ -155,4 +155,22 @@ public class StringSwitchEcjFilterTest extends FilterTestBase { assertIgnored(new Range(switchNode.getNext(), expectedToInclusive)); } + @Test + public void should_not_filter_empty_lookup_switch() { + final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, 0, + "name", "(Ljava/lang/String;)V", null, null); + m.visitVarInsn(Opcodes.ALOAD, 1); + m.visitVarInsn(Opcodes.ASTORE, 2); + m.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/String", "hashCode", + "()I", false); + final Label defaultCase = new Label(); + m.visitLookupSwitchInsn(defaultCase, null, new Label[] {}); + m.visitLabel(defaultCase); + m.visitInsn(Opcodes.RETURN); + + filter.filter(m, context, output); + + assertIgnored(); + } + } |