StackTraceAnalyser class "getMethod" calls callingClass.getSuperclass, and passes it to extractMethod. But its not necessary that there be superclass. Leads to Nullpointer. Especially when the call is from Junit 5 execution engine I am getting Nullpointer for "ExecutableInvoker" class which has a inner interface single method implementation for "ReflectiveInterceptorCall" which does not have a super class. Leading to Nullpointer exception in "extractMethod" because callingClass is passed as null.









Can you propose a PR to fix?
@wakaleo Sure. Should i just handle the "null" returned in "callingClass.getSuperclass" or should i pass the ReflectiveInterceptorCall reference too to the extractMethod? I am not sure whether we need to dig in to these classes as these are core Junit5 classes and no logical need to in this usecase. However if there is some nested single method lambda interface defined in a class where a "screenshot" annotation is applied then we ideally should(I am not sure whether thats a valid use case)
I would just handle the null by ignoring it, as this code is to detect annotations in the test code itself, not in JUnit code.
Thanks @wakaleo . Will raise PR to handle this
Had the same issue: StackTraceAnalyser runs into a NullPointerException for stacktrace element org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115) because org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall is a inner interface and does not have a superclass. (StackTraceAnalyser#36)
This is working as expected now. Hence closing this issue. Thank you @fabianlinz and @wakaleo
Most helpful comment
2295 was release with v2.3.9