You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks for looking into the issue.
I was thinking if we could somehow prevent such regression as it's tough thinking in advance of other possible compiler plugins and their combinations. On the other hand, serialization plugin is a pretty big one and we now have a test for it.
Thanks a lot @Godin for taking care of this MR as Kotlinx Serialization caused a lot of troubles for me with synthetic methods and coverage.
I use a snapshot Jacoco version and today it broke for my project perhaps due to this commit (or another about ASM update). Please take a look if it's something relevant for a fix:
...
Caused by: java.io.IOException: Error while analyzing BillingAddressFieldType$Companion.class with JaCoCo 0.8.14.202510071157/0981128.
at org.jacoco.core.analysis.Analyzer.analyzerError(Analyzer.java:163)
at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:135)
at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:158)
at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:195)
at org.jacoco.ant.ReportTask.createBundle(ReportTask.java:573)
at org.jacoco.ant.ReportTask.createReport(ReportTask.java:545)
at org.jacoco.ant.ReportTask.execute(ReportTask.java:496)
... 155 more
Caused by: java.lang.NullPointerException: Cannot invoke "org.objectweb.asm.tree.AbstractInsnNode.getPrevious()" because "this.cursor" is null
at org.jacoco.core.internal.analysis.filter.KotlinSerializableFilter$Matcher.match(KotlinSerializableFilter.java:79)
at org.jacoco.core.internal.analysis.filter.KotlinSerializableFilter.filter(KotlinSerializableFilter.java:44)
at org.jacoco.core.internal.analysis.filter.FilterSet.filter(FilterSet.java:31)
at org.jacoco.core.internal.analysis.filter.Filters$1.filter(Filters.java:45)
at org.jacoco.core.internal.analysis.ClassAnalyzer.addMethodCoverage(ClassAnalyzer.java:131)
at org.jacoco.core.internal.analysis.ClassAnalyzer.access$100(ClassAnalyzer.java:38)
at org.jacoco.core.internal.analysis.ClassAnalyzer$1.accept(ClassAnalyzer.java:115)
at org.jacoco.core.internal.flow.ClassProbesAdapter$2.visitEnd(ClassProbesAdapter.java:91)
at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1516)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:745)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:425)
at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:117)
at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:133)
The class it complains about BillingAddressFieldType$Companion.class has an empty companion object declared without any body/fields (just companion object).
@ajeihala first of all thank you for testing snapshot version and for the report β€
while there is already another report #1969 with the same stack trace
your example is different and
empty companion object declared without any body/fields (just companion object)
like
@Serializable
class EmptyCompanion {
companion object
}
does not seem to be enough to trigger NPE, so could you please provide source code of your BillingAddressFieldType and/or class files BillingAddressFieldType.class and BillingAddressFieldType$Companion.class entirely to make sure that we won't miss some corner-case again?
@Serializable
enum class EmptyCompanion {
@SerialName("TEST")
TEST;
companion object
}
it fails too with Error while analyzing EmptyCompanion$Companion.class with JaCoCo 0.8.14.202510071157/0981128 and the same Cannot invoke "org.objectweb.asm.tree.AbstractInsnNode.getPrevious()" because "this.cursor" is null.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1855