New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix NPE #1020
Fix NPE #1020
Conversation
@poseidon-mysugr I don't think this would be a valid class file. ASM as well as JaCoCo assumes that the input are valid classfiles and has no safeguards against invalid class files. |
I've just encountered this in production code, let me see if I can come up with a simple example. |
Pretty much any Kotlin interface will trigger this: interface Foo {
fun bar()
} will result in
|
@Godin Probably we should apply filters to abstract methods? |
@poseidon-mysugr Nice catch! 👍 Thank you for reporting this! ❤️ This is regression introduced in unreleased version by #1012 :
using latest as of now
Regarding
in this case there is simply no instructions at all - see
Unfortunately this was not caught by
that is loaded by Also unfortunately we don't have examples in validation tests for Kotlin that produce execution data and contain abstract methods, such as for example
Regarding validity of class files and absence of instructions see https://docs.oracle.com/javase/specs/jvms/se13/html/jvms-4.html#jvms-4.1 :
AFAICS all invocations of
and such methods can not be
In
@marchof I guess that instead
you wanted to say "should not apply"? And wondering whether by "abstract methods" you mean
or
? 😉 On the one hand, we indeed can prevent similar mistakes in the future by not executing filters in On the other hand, I have a feeling that such an increase in coupling of filters with the rest is not good. And not counting missing unit test, I like proposed change also because AFAICS |
@Godin Ok, I agree to fix this with the filter. But what is missing here is a test that our filters can deal with empty methods. I was thinking of adding such a generic test to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@poseidon-mysugr Thanks a lot for this bug report and fix! 👍 ❤️
(cherry picked from commit 3b95f61)
(cherry picked from commit 3b95f61)
firstIsALoad0
produces an NPE if the method instructions contain only Non-Opcode instructions.