coc-java icon indicating copy to clipboard operation
coc-java copied to clipboard

cannot find symbol

Open bQvg5S66szS opened this issue 4 years ago • 5 comments

versions

vim version: NVIM v0.4.3 node version: v14.2.0 coc.nvim version: 0.0.78-23d26d8e02 term: st-256color platform: linux

Output channel: java

[Info  - 6:57:55 PM] JDT Language Server started
[object Object]
[Error  - 7:10:42 PM] May 28, 2020, 7:10:42 PM Error while handling document save. URI: file:///home/dennisbergkamp/lib/docs/repos/java/prg011/src/App/Estudiante.java
_/java/prg011/src/App [in repos_447272c9] does not exist
Java Model Exception: Java Model Status [_/java/prg011/src/App [in repos_447272c9] does not exist]
	at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:573)
	at org.eclipse.jdt.internal.core.PackageFragmentRoot.getUnderlyingResource(PackageFragmentRoot.java:761)
	at org.eclipse.jdt.internal.core.PackageFragment.getUnderlyingResource(PackageFragment.java:426)
	at org.eclipse.jdt.internal.core.Openable.getUnderlyingResource(Openable.java:351)
	at org.eclipse.jdt.internal.core.CompilationUnit.getUnderlyingResource(CompilationUnit.java:976)
	at org.eclipse.jdt.ls.core.internal.handlers.BaseDocumentLifeCycleHandler.handleSaved(BaseDocumentLifeCycleHandler.java:433)
	at org.eclipse.jdt.ls.core.internal.handlers.BaseDocumentLifeCycleHandler$7.run(BaseDocumentLifeCycleHandler.java:281)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2292)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2312)
	at org.eclipse.jdt.ls.core.internal.handlers.BaseDocumentLifeCycleHandler.didSave(BaseDocumentLifeCycleHandler.java:278)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.didSave(JDTLanguageServer.java:744)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
	at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.notify(GenericEndpoint.java:152)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(RemoteEndpoint.java:220)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:187)
	at org.eclipse.jdt.ls.core.internal.ParentProcessWatcher.lambda$0(ParentProcessWatcher.java:123)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
	at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

this is the structure of my project:

║ ~/lib/docs/repos/java/prg011 ║◞◜·◦° tree 
. 
└── src 
    └── App 
        ├── Estudiante.java 
        ├── Main.java 
        └── Persona.java 
2 directories, 3 files 

i don't know why am i getting this error if all the files are one next to the other...

... and because of that, the Main class won't work either (same symbol not found error))

compilation is working as intended: (no problems)

this is the Persona class which gives NO error: (no issues at all)

you may also see i'm getting these two non-critical errors (respectively):

Main.java is not on the classpath of project repos_447272c9, only syntax errors are reported
[Java: 32]
Persona.java is not on the classpath of project repos_447272c9, only syntax errors are reported
[Java: 32]
Estudiante.java is not on the classpath of project repos_447272c9, only syntax errors are reported
[Java: 32]

thought these above would have been gone with this at ~/.config/nvim/coc-settings.json (this is the only line i have) but no luck

{
	"java.errors.incompleteClasspath.severity": "ignore"
}

output of Estudiante

[Info  - 7:34:11 PM] JDT Language Server started
[object Object]

[Error  - 7:38:25 PM] May 28, 2020, 7:38:25 PM Error while handling document save. URI: file:///home/dennisbergkamp/lib/docs/repos/java/prg011/src/App/Estudiante.java
_/java/prg011/src/App [in repos_447272c9] does not exist
Java Model Exception: Java Model Status [_/java/prg011/src/App [in repos_447272c9] does not exist]
	at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:573)
	at org.eclipse.jdt.internal.core.PackageFragmentRoot.getUnderlyingResource(PackageFragmentRoot.java:761)
	at org.eclipse.jdt.internal.core.PackageFragment.getUnderlyingResource(PackageFragment.java:426)
	at org.eclipse.jdt.internal.core.Openable.getUnderlyingResource(Openable.java:351)
	at org.eclipse.jdt.internal.core.CompilationUnit.getUnderlyingResource(CompilationUnit.java:976)
	at org.eclipse.jdt.ls.core.internal.handlers.BaseDocumentLifeCycleHandler.handleSaved(BaseDocumentLifeCycleHandler.java:433)
	at org.eclipse.jdt.ls.core.internal.handlers.BaseDocumentLifeCycleHandler$7.run(BaseDocumentLifeCycleHandler.java:281)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2292)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2312)
	at org.eclipse.jdt.ls.core.internal.handlers.BaseDocumentLifeCycleHandler.didSave(BaseDocumentLifeCycleHandler.java:278)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.didSave(JDTLanguageServer.java:744)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
	at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.notify(GenericEndpoint.java:152)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(RemoteEndpoint.java:220)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:187)
	at org.eclipse.jdt.ls.core.internal.ParentProcessWatcher.lambda$0(ParentProcessWatcher.java:123)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
	at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

bQvg5S66szS avatar May 29 '20 00:05 bQvg5S66szS

Can't reproduce, looks like invalid URI.

chemzqm avatar May 29 '20 08:05 chemzqm

I am facing the same issue.

nickel8448 avatar Jun 16 '20 12:06 nickel8448

do folders need specific permissions? i'm aware "packages" in java are just folders but sometimes when i open a project i created on NetBeans (probably other IDEs too) they have the executable attribute..

also does the directory you're in also matter? i'm normally at the /src folder where i can index all my packages...

bQvg5S66szS avatar Jun 16 '20 16:06 bQvg5S66szS

Don't know, it's problem of jdt.ls

chemzqm avatar Jun 16 '20 17:06 chemzqm

I encountered the same problem, how do you solve it?

notorangee avatar Sep 21 '21 06:09 notorangee

Should be fixed on recent version of coc-java, try upgrade coc.nvim to latest release and coc-java to version 1.14.0.

It's caused by unexpected arguments passed to rename command.

chemzqm avatar Jan 29 '23 05:01 chemzqm