Errors in JUnit5TestSearcher

Open
#1,399 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
java
Domain
testing-qa

Research direction

Start with JUnit5TestSearcher.java at lines 69, 85, and 110, then follow the stack traces through TestSearchUtils.findTestItemsInTypeBinding. Reproduce test discovery for the affected project and determine which annotation-hierarchy path triggers the reported NullPointerExceptions; done means JUnit 5 test searching completes without these errors.

Written by the indexing model from the issue text.

Description

ai-triaged bug junit needs-reproduction test-discovery
java.lang.NullPointerException: Cannot read the array length because "this.fields" is null
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getField(BinaryTypeBinding.java:1426)
	at org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.buildTargetAnnotation(AnnotationBinding.java:179)
	at org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.addStandardAnnotations(AnnotationBinding.java:83)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.retrieveAnnotations(BinaryTypeBinding.java:1855)
	at org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.getAnnotations(ReferenceBinding.java:1067)
	at org.eclipse.jdt.core.dom.TypeBinding.getAnnotations(TypeBinding.java:122)
	at com.microsoft.java.test.plugin.searcher.JUnit5TestSearcher.matchesNameInAnnotationHierarchy(JUnit5TestSearcher.java:110)
	at com.microsoft.java.test.plugin.searcher.JUnit5TestSearcher.findAnnotation(JUnit5TestSearcher.java:85)
	at com.microsoft.java.test.plugin.searcher.JUnit5TestSearcher.isTestMethod(JUnit5TestSearcher.java:69)
	at com.microsoft.java.test.plugin.util.TestSearchUtils.findTestItemsInTypeBinding(TestSearchUtils.java:382)
	at com.microsoft.java.test.plugin.util.TestSearchUtils.findTestTypesAndMethods(TestSearchUtils.java:360)
	at com.microsoft.java.test.plugin.handler.TestDelegateCommandHandler.executeCommand(TestDelegateCommandHandler.java:60)
	at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler$1.run(WorkspaceExecuteCommandHandler.java:215)
java.lang.NullPointerException: Cannot assign field "mayTolerateMissingType" because "this.env" is null
	at org.eclipse.jdt.internal.compiler.lookup.UnresolvedAnnotationBinding.resolve(UnresolvedAnnotationBinding.java:34)
	at org.eclipse.jdt.internal.compiler.lookup.UnresolvedAnnotationBinding.getAnnotationType(UnresolvedAnnotationBinding.java:41)
	at org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.addStandardAnnotations(AnnotationBinding.java:47)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.retrieveAnnotations(BinaryTypeBinding.java:1855)
	at org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.getAnnotations(ReferenceBinding.java:1067)
	at org.eclipse.jdt.core.dom.TypeBinding.getAnnotations(TypeBinding.java:122)
	at com.microsoft.java.test.plugin.searcher.JUnit5TestSearcher.matchesNameInAnnotationHierarchy(JUnit5TestSearcher.java:110)
	at com.microsoft.java.test.plugin.searcher.JUnit5TestSearcher.findAnnotation(JUnit5TestSearcher.java:85)
	at com.microsoft.java.test.plugin.searcher.JUnit5TestSearcher.isTestMethod(JUnit5TestSearcher.java:69)
	at com.microsoft.java.test.plugin.util.TestSearchUtils.findTestItemsInTypeBinding(TestSearchUtils.java:382)
	at com.microsoft.java.test.plugin.util.TestSearchUtils.findTestTypesAndMethods(TestSearchUtils.java:360)
	at com.microsoft.java.test.plugin.handler.TestDelegateCommandHandler.executeCommand(TestDelegateCommandHandler.java:60)
Dominant language
TypeScript
Stars
340
Forks
173
Avg merge
1d 2h
Merged PRs (30d)
17

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/vscode-java-test

All issues in microsoft/vscode-java-test

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.