diff options
author | Evgeny Mandrikov <138671+Godin@users.noreply.github.com> | 2019-09-22 09:16:51 +0200 |
---|---|---|
committer | Marc R. Hoffmann <hoffmann@mountainminds.com> | 2019-09-22 09:16:51 +0200 |
commit | 19ef126cf9f3d57bd7a6a147ef745531c751422a (patch) | |
tree | 83995056a7ec6e355350216f68f1f510c3745e10 /org.jacoco.core.test/src/org/jacoco/core | |
parent | d0a73edd41a29f4c0ffabae15d7c023a37df976f (diff) | |
download | jacoco-19ef126cf9f3d57bd7a6a147ef745531c751422a.tar.gz |
Fix NPE in KotlinWhenStringFilter (#942)
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/KotlinWhenStringFilterTest.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/filter/KotlinWhenStringFilterTest.java b/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/filter/KotlinWhenStringFilterTest.java index df42803d..4408ef3d 100644 --- a/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/filter/KotlinWhenStringFilterTest.java +++ b/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/filter/KotlinWhenStringFilterTest.java @@ -105,4 +105,21 @@ public class KotlinWhenStringFilterTest extends FilterTestBase { assertIgnored(new Range(expectedFromInclusive, 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.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(); + } + } |