artur-shaik / vim-javacomplete2

DEPRECATED in favor of jc.nvim
Vim License
973 stars 83 forks source link

Receiving Null Pointer Exception from JavaVI #358

Closed michaeljoelphillips closed 6 years ago

michaeljoelphillips commented 6 years ago

Actual behavior (Required!)

Open a Java file with NeoVim and attempt to autocomplete java.util.Collection.

Expected behavior (Required!)

The autocomplete menu (Deoplete) to appear with suggestions.

The steps to reproduce actual behavior (Required!)

  1. Start NeoVim
  2. Open .java file
  3. Attempt to autocomplete import java.
  4. Encounter Vim error

Environment (Required!)

Q&A

Screenshot (Optional)

The output of :redir and :message (Optional)

Message

message: packages still empty, try later. indexing...                                                                                                                                                                                       
Error detected while processing function javacomplete#Complete[1]..javacomplete#complete#complete#Complete:                                                                                                                                 
line   38:                                                                                                                                                                                                                                  
javacomplete error: []

JCdebugLogs

 93.432629 [context] context: CONTEXT_IMPORT
 93.432725 [context] dot expression: java.
 93.432918 [complete] get members. fqn: java
 93.436098 [server] communicate: -E java [s:GetMembers for static]
 93.541678 [server] 
 93.543286 [server] communicate: -p java [collector#FetchInfoFromServer]
 93.654895 [server] message: packages still empty, try later. indexing...
 93.655192 [complete] package info in directories. package: java
 93.655270 [complete] get source dirs. filepath: [redacted]/Main.java

JavaVI Logs

Exception in thread "Thread-3" java.lang.NullPointerException
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
    at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:590)
    at java.base/java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:668)
    at java.base/java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:726)
    at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateParallel(ForEachOps.java:160)
    at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(ForEachOps.java:174)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:233)
    at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:430)
    at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:594)
    at kg.ash.javavi.searchers.PackagesLoader.collectPackages(PackagesLoader.java:21)
    at kg.ash.javavi.cache.Cache.lambda$collectPackages$0(Cache.java:55)
    at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: java.lang.NullPointerException
    at kg.ash.javavi.searchers.ClasspathCollector.collectClassPath(ClasspathCollector.java:30)
    at kg.ash.javavi.searchers.ClasspathPackageSearcher.loadEntries(ClasspathPackageSearcher.java:23)
    at kg.ash.javavi.searchers.PackagesLoader.lambda$collectPackages$0(PackagesLoader.java:21)
    at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
    at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1492)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
    at java.base/java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:291)
    at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:747)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:283)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1603)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175)

It looks like the issue is with javavi, so if I need to file this somewhere else, please let me know. I thought I would post here first in case anyone has encountered this type of issue before.

Thanks in advance!

michaeljoelphillips commented 6 years ago

For anyone else that might encounter a similar issue, this plugin requires JDK 8, as stated in the README. I was running JDK 9. Switching to JDK 8 fixes this issue.