Skip to content

NPE in KotlinWhenStringFilter #940

@marchof

Description

@marchof

Steps to reproduce

JaCoCo version: master (commit 8b586a9)
Operating system: OSX
Tool integration: CLI

Run

java -jar jacococli.jar report --classfiles NPE.zip

on the attached class file.

Expected behaviour

Command terminates without exception.

Actual behaviour

Exception in thread "main" java.io.IOException: Error while analyzing NPE.zip@$value$ReadableByteChannel.class.
	at org.jacoco.core.analysis.Analyzer.analyzerError(Analyzer.java:161)
	at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:133)
	at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:156)
	at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:192)
	at org.jacoco.core.analysis.Analyzer.analyzeZip(Analyzer.java:264)
	at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:195)
	at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:225)
	at org.jacoco.cli.internal.commands.Report.analyze(Report.java:109)
	at org.jacoco.cli.internal.commands.Report.execute(Report.java:83)
	at org.jacoco.cli.internal.Main.execute(Main.java:89)
	at org.jacoco.cli.internal.Main.main(Main.java:104)
Caused by: java.lang.NullPointerException
	at org.jacoco.core.internal.analysis.MethodCoverageCalculator.ignore(MethodCoverageCalculator.java:159)
	at org.jacoco.core.internal.analysis.filter.KotlinWhenStringFilter$Matcher.match(KotlinWhenStringFilter.java:98)
	at org.jacoco.core.internal.analysis.filter.KotlinWhenStringFilter.filter(KotlinWhenStringFilter.java:37)
	at org.jacoco.core.internal.analysis.filter.Filters.filter(Filters.java:57)
	at org.jacoco.core.internal.analysis.ClassAnalyzer.addMethodCoverage(ClassAnalyzer.java:118)
	at org.jacoco.core.internal.analysis.ClassAnalyzer.access$2(ClassAnalyzer.java:113)
	at org.jacoco.core.internal.analysis.ClassAnalyzer$1.accept(ClassAnalyzer.java:107)
	at org.jacoco.core.internal.flow.ClassProbesAdapter$2.visitEnd(ClassProbesAdapter.java:89)
	at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1287)
	at org.objectweb.asm.ClassReader.accept(ClassReader.java:688)
	at org.objectweb.asm.ClassReader.accept(ClassReader.java:400)
	at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:115)
	at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:131)
	... 9 more

NPE.zip

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions