Skip to content
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

Can not find references for static method #3827

Open
mamilic opened this issue Oct 23, 2024 · 3 comments
Open

Can not find references for static method #3827

mamilic opened this issue Oct 23, 2024 · 3 comments

Comments

@mamilic
Copy link

mamilic commented Oct 23, 2024

By utilizing Go to References of static method I got error back.

Environment
  • Operating System: Windows 11
  • JDK version: 21
  • Visual Studio Code version: 1.94.2
  • Java extension version: 1.35.1
Steps To Reproduce
  1. Download and open test.zip
  2. Go to DemoApplication
  3. Find all references for public static Top of(One one), it will say no references found

However for method meta() in the same claas, DemoApplication, it will find references.

The error below happened on a project that I have no liberty of sharing. Hope it might be helpfull.

Logs

Oct 23, 2024 4:48:26 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint fallbackResponseError
SEVERE: Internal error: java.lang.UnsupportedOperationException
java.util.concurrent.CompletionException: java.lang.UnsupportedOperationException
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture$Completion.exec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
Caused by: java.lang.UnsupportedOperationException
at org.eclipse.jdt.internal.compiler.lookup.IntersectionTypeBinding18.getPackage(IntersectionTypeBinding18.java:143)
at org.eclipse.jdt.internal.compiler.lookup.ArrayBinding.getPackage(ArrayBinding.java:259)
at org.eclipse.jdt.internal.compiler.lookup.TypeBinding.qualifiedPackageName(TypeBinding.java:1605)
at org.eclipse.jdt.internal.core.search.matching.PatternLocator.resolveLevelForType(PatternLocator.java:823)
at org.eclipse.jdt.internal.core.search.matching.PatternLocator.resolveLevelForType(PatternLocator.java:752)
at org.eclipse.jdt.internal.core.search.matching.MethodLocator.matchMethod(MethodLocator.java:371)
at org.eclipse.jdt.internal.core.search.matching.MethodLocator.resolveLevel(MethodLocator.java:787)
at org.eclipse.jdt.internal.core.search.matching.MethodLocator.resolveLevel(MethodLocator.java:718)
at org.eclipse.jdt.internal.core.search.matching.OrLocator.resolveLevel(OrLocator.java:340)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching(MatchLocator.java:2805)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.process(MatchLocator.java:2053)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1366)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1403)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1546)
at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:134)
at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:251)
at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:595)
at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:669)
at org.eclipse.jdt.ls.core.internal.handlers.ReferencesHandler.search(ReferencesHandler.java:184)
at org.eclipse.jdt.ls.core.internal.handlers.ReferencesHandler.findReferences(ReferencesHandler.java:87)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$10(JDTLanguageServer.java:712)
at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:87)
... 7 more

Current Result
Expected Result
Additional Informations
@mamilic
Copy link
Author

mamilic commented Oct 23, 2024

I've also opened the issue upstream, eclipse-jdt/eclipse.jdt.core#3147, though I am not sure where is the root cause.

@rgrunber
Copy link
Member

I'm able to reproduce it. The error is :

[Error - 16:58:34] Request textDocument/references failed.
  Message: Internal error.
  Code: -32603 
java.util.concurrent.CompletionException: java.lang.UnsupportedOperationException
	at java.base/java.util.concurrent.CompletableFuture.wrapInCompletionException(CompletableFuture.java:323)
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:359)
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:364)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:693)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:527)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:507)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1458)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2034)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:189)
Caused by: java.lang.UnsupportedOperationException
	at org.eclipse.jdt.internal.compiler.lookup.IntersectionTypeBinding18.getPackage(IntersectionTypeBinding18.java:142)
	at org.eclipse.jdt.internal.compiler.lookup.ArrayBinding.getPackage(ArrayBinding.java:258)
	at org.eclipse.jdt.internal.compiler.lookup.TypeBinding.qualifiedPackageName(TypeBinding.java:1604)
	at org.eclipse.jdt.internal.core.search.matching.PatternLocator.resolveLevelForType(PatternLocator.java:965)
	at org.eclipse.jdt.internal.core.search.matching.PatternLocator.resolveLevelForType(PatternLocator.java:848)
	at org.eclipse.jdt.internal.core.search.matching.MethodLocator.matchMethod(MethodLocator.java:500)
	at org.eclipse.jdt.internal.core.search.matching.MethodLocator.resolveLevel(MethodLocator.java:1033)
	at org.eclipse.jdt.internal.core.search.matching.MethodLocator.resolveLevel(MethodLocator.java:936)
	at org.eclipse.jdt.internal.core.search.matching.OrLocator.resolveLevel(OrLocator.java:324)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching(MatchLocator.java:3085)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.process(MatchLocator.java:2333)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1638)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1675)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1818)
	at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:143)
	at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:276)
	at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:620)
	at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:677)
	at org.eclipse.jdt.ls.core.internal.handlers.ReferencesHandler.search(ReferencesHandler.java:184)
	at org.eclipse.jdt.ls.core.internal.handlers.ReferencesHandler.findReferences(ReferencesHandler.java:87)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$10(JDTLanguageServer.java:715)
	at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:87)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:690)
	... 5 more

Seems to be failing on the following methods binding :

public static transient Stream<java.lang.Object & java.io.Serializable & java.lang.Cloneable> of(java.lang.Object & java.io.Serializable & java.lang.Cloneable[])

@rgrunber rgrunber changed the title [Bug] - Can not find references for static method Can not find references for static method Oct 29, 2024
@rgrunber rgrunber added the bug label Oct 29, 2024
Copy link

We have found issues that are potential duplicates:

If any of the issues listed above are a duplicate, please consider closing this issue & upvoting/commenting the original one.
Alternatively, if neither of the listed issues addresses your feature/bug, keep this issue open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants