artur-shaik / vim-javacomplete2

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

infinite javavi recompilation loop #400

Closed jasonobrien closed 5 years ago

jasonobrien commented 6 years ago

Actual behavior (Required!)

Perpetual javavi compilation loop when opening a java file, with the message:

Javavi compilation finished

Autocomplete does not work.

It appears to be repeatedly recompiling, then failing the version compatibility check. The log is full of this:

server is outdated, recompile

Note the extra spaces; the code appears to be trying to call javavi -version, but for some reason no output is making it back to the handle. The same infrastructure is working fine for compilation (which forks out to maven), and it's returning status code 0 so I'm assuming the call is succeeding (unless javavi is swallowing errors).

I can manually run javavi -version, and it correctly outputs a version string (2.3.7) to stdout.

Expected behavior (Required!)

A single compilation up-front, then functional autocompletion.

The steps to reproduce actual behavior (Required!)

  1. Install Vim/vim-plug/JDK8/maven.
  2. Enable vim-javacomplete in .vimrc according to the README.
  3. Edit a .java file.

Environment (Required!)

Q&A

These commands seem outdated; I submitted PR #399 accordingly. Logs attached.

vim.log 1808191756-52303.log javavi_stdout.log

I tried to debug this, but I'm not that familiar with vim script debugging. I couldn't even get it to spit out the entire command line being used to call the version check.

I'd be happy to dig further if anyone can get me there.

artur-shaik commented 6 years ago

Hm, what if you comment version check call? At server.vim:90.

jasonobrien commented 6 years ago

That got me past the recompilation, and autocomplete is working great. Thanks!

I did manage to dump the entire command used for the version check (classpath and all), and it's working correctly when I run it manually. Not sure why the stdout event handler isn't getting called, but I'm happy to run with that line commented out.

JonasKlamroth commented 4 years ago

Hey, i had the same problem but when i commented out the corresponding line i still dont get the plugin to work. My Setup is the following: OS: Ubuntu 19.04 VIM: 8.1 (with python3 supported) JDK: 1.8

Server is running correctly as far as i can tell (at least :JCserverShowPID responds with some number)

When enabling the Logger i get the following result:

354.839662 [server] executing python file: /home/klamroth/.vim/bundle/vim-javacomplete2/autoload/javavibridge.py
  9 354.852271 [server] server classpath: -cp /home/klamroth/.vim/bundle/vim-javacomplete2/libs/javavi/target/classes:/home/klamroth/.vim/bundle/vim-javacomplete2/libs/javaparser-core-3.5.20.jar:/home/kla    mroth/.vim/bundle/vim-javacomplete2/libs/javavi_log4j-api.jar:/home/klamroth/.vim/bundle/vim-javacomplete2/libs/javavi_log4j-core.jar:.:/usr/lib/jvm/java-8-openjdk-amd64/lib
  8 354.852305 [server] server arguments:-Ddaemon.port=48589 -Dlog4j.configurationFile=/home/klamroth/.vim/bundle/vim-javacomplete2/libs/javavi/target/classes/log4j2.xml kg.ash.javavi.Javavi -sources  -ba    se /home/klamroth/.cache/javacomplete2/ -compiler javac
  7 408.632794 [context] context: CONTEXT_AFTER_DOT
  6 408.632834 [context] dot expression: l.
  5 408.632907 [complete] complete after dot. expr: l.
  4 408.633311 [collector] get declared class name for: "l"
  3 408.642717 [complete] F3. "l.|"  typename: "ArrayList<String>"
  2 408.642774 [collector] get class info. class: ArrayList<String>
  1 408.654274 [server] communicate: -E "java.util.ArrayList<(String|java.lang.String|java.lang.Object)>" [collector#FetchInfoFromServer]
20  409.312760 [server]

when trying to get completions for a simple arraylist. But nothing shows up. Any ideas on what im doing wrong?

artur-shaik commented 4 years ago

@JonasKlamroth Hi. Does your project has src directory?

In your logs there is empty argument after -sources, may be this is a problem.

artur-shaik commented 4 years ago

And have you added import in your java file, before trying completion?

JonasKlamroth commented 4 years ago

Hey, thanks for the quick reply. I dont know why he did not find my source folder yesterday. Anyway now the output is like this:

499.144161 [server] server arguments:-Ddaemon.port=56395 -Dlog4j.configurationFile=/home/klamroth/.vim/bundle/vim-javacomplete2/libs/javavi/target/classes/log4j2.xml kg.ash.javavi.Javavi -sources /hom e/klamroth/Documents/Masterthesis/openjmlToBMC/OpenJML/OpenJML/demos/src:/home/klamroth/Documents/Masterthesis/openjmlToBMC/OpenJML/OpenJML/src:/home/klamroth/Documents/Masterthesis/openjmlToBMC/OpenJ ML/OpenJMLGUITests/Tests/src:/home/klamroth/Documents/Masterthesis/openjmlToBMC/OpenJML/OpenJMLTest/src:/home/klamroth/Documents/Masterthesis/openjmlToBMC/OpenJML/OpenJMLUI/src:/home/klamroth/Document s/Masterthesis/openjmlToBMC/OpenJML/vendor/FreeBoogie/src:/home/klamroth/Documents/Masterthesis/openjmlToBMC/src: -base /home/klamroth/.cache/javacomplete2/ -compiler javac -project _home_klamroth_Doc uments_Masterthesis_openjmlToBMC_build_xml

so i guess he found the right sources. But its still not working. My test file looks like this:

import java.util.ArrayList;

public class Test {
      public test() {
          ArrayList<String> l = new ArrayList();
          l. //here i tried <C-x><C-o> or completion with you complete me neither works
      }
}
artur-shaik commented 4 years ago

Looks like I can reproduce it. Seems like a bug.

artur-shaik commented 4 years ago

@JonasKlamroth can you try again with last version, please.

JonasKlamroth commented 4 years ago

works fine for me. Thanks a lot

artur-shaik commented 4 years ago

@JonasKlamroth thank you for report.