Skip to content

JUnit test find fails when method with default arguments is present #1542

@eric-milles

Description

@eric-milles

Consider the following:

class C {
  def m(x, y='foo', z='bar') {
  }
}

Opening the Run As context menu produces an error and removes the JUnit finder from service.

java.lang.NullPointerException: Cannot invoke "org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.getAnnotationType()" because "internalAnnotation" is null
	at org.eclipse.jdt.core.dom.MethodBinding.filterTypeAnnotations(MethodBinding.java:245)
	at org.eclipse.jdt.core.dom.MethodBinding.getAnnotations(MethodBinding.java:134)
	at org.eclipse.jdt.internal.junit.launcher.JUnit5TestFinder$Annotation.annotatesDeclaredMethods(JUnit5TestFinder.java:145)
	at org.eclipse.jdt.internal.junit.launcher.JUnit5TestFinder$Annotation.annotatesAtLeastOneMethod(JUnit5TestFinder.java:126)
	at org.eclipse.jdt.internal.junit.launcher.JUnit5TestFinder.isTest(JUnit5TestFinder.java:295)
	at org.eclipse.jdt.internal.junit.launcher.JUnit5TestFinder.internalIsTest(JUnit5TestFinder.java:276)
	at org.eclipse.jdt.internal.junit.launcher.JUnit5TestFinder.isTest(JUnit5TestFinder.java:247)
	at org.eclipse.jdt.internal.junit.launcher.ITestFinder$isTest.call(Unknown Source)
	...

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions