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

java completer reports errors on clean workspace until any dummy change made #4224

Open
11 tasks done
RomanValov opened this issue Mar 1, 2024 · 3 comments
Open
11 tasks done

Comments

@RomanValov
Copy link

Issue Prelude

  • I have read and understood YCM's CONTRIBUTING document.
  • I have read and understood YCM's CODE_OF_CONDUCT document.
  • I have read and understood YCM's README, especially the
    Frequently Asked Questions section.
  • I have searched YCM's issue tracker to find issues similar to the one I'm
    about to report and couldn't find an answer to my problem. (Example Google
    search.
    )
  • If filing a bug report, I have included the output of vim --version.
  • If filing a bug report, I have included the output of :YcmDebugInfo.
  • If filing a bug report, I have attached the contents of the logfiles using
    the :YcmToggleLogs command.
  • If filing a bug report, I have included which OS (including specific OS
    version) I am using.
  • If filing a bug report, I have included a minimal test case that reproduces
    my issue, using vim -Nu /path/to/YCM/vimrc_ycm_minimal, including what I
    expected to happen and what actually happened.
  • I understand this is an open-source project staffed by volunteers and
    that any help I receive is a selfless, heartfelt gift of their free time. I
    know I am not entitled to anything and will be polite and courteous.
  • I understand my issue may be closed if it becomes obvious I didn't
    actually perform all of these steps.

Thank you for adhering to this process! It ensures your issue is resolved
quickly and that neither your nor our time is needlessly wasted.

Issue Details

Screencast

Sample java project attached. There are three java files:

  • UsedObject.java -- contains one public object and one package private object (UsedObjectHelper)
  • UnusedObject.java -- contains one public object and one package private object (UnusedObjectHelper)
  • Main.java -- references UsedObject, UserObjectHelper and UnusedObjectHelper, but not UnusedObject

When Main.java opened in clean workspace and java completer initialized there are errors about unresolved UnusedObjectHelper type. But if I make any nonsensical change errors are gone.

  • What did you do?

Sample project: ycm.demo.tar.gz

  1. Go to sample project directory.
  2. Run: vim -Nu NONE --cmd 'set filetype=java' --cmd 'packadd YouCompleteMe' ./src/main/java/ycm/demo/Main.java
  3. Wait until YCM and JDT.LS initialized
  4. Observe "cannot be resovled to a type" errors
  5. Make any nonsensical change
  6. Observe "cannot be resolved to a type" errors are gone
  • What did you expect to happen?

There should be no "cannot be resolved to a type" errors

  • What actually happened?

Errors shown until any change made

Diagnostic data

Output of vim --version

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Dec 05 2023 17:58:57)
Included patches: 1-579, 1969, 580-1848, 4975, 5016, 5023, 5072, 2068, 1849-1854, 1857, 1855-1857, 1331, 1858, 1858-1859, 1873, 1860-1969, 1992, 1970-1992, 2010, 1993-2068, 2106, 2069-2106, 2108, 2107-2109, 2109-3995, 4563, 4646, 4774, 4895, 4899, 4901, 4919, 213, 1840, 1846-1847, 2110-2112, 2121
Modified by team+vim@tracker.debian.org
Compiled by team+vim@tracker.debian.org
Huge version without GUI.  Features included (+) or not (-):
+acl               +file_in_path      +mouse_urxvt       -tag_any_white
+arabic            +find_in_path      +mouse_xterm       +tcl
+autocmd           +float             +multi_byte        +termguicolors
+autochdir         +folding           +multi_lang        +terminal
-autoservername    -footer            -mzscheme          +terminfo
-balloon_eval      +fork()            +netbeans_intg     +termresponse
+balloon_eval_term +gettext           +num64             +textobjects
-browse            -hangul_input      +packages          +textprop
++builtin_terms    +iconv             +path_extra        +timers
+byte_offset       +insert_expand     +perl              +title
+channel           +ipv6              +persistent_undo   -toolbar
+cindent           +job               +popupwin          +user_commands
-clientserver      +jumplist          +postscript        +vartabs
-clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +vim9script
+cmdline_hist      +langmap           -python            +viminfo
+cmdline_info      +libcall           +python3           +virtualedit
+comments          +linebreak         +quickfix          +visual
+conceal           +lispindent        +reltime           +visualextra
+cryptv            +listcmds          +rightleft         +vreplace
+cscope            +localmap          +ruby              +wildignore
+cursorbind        +lua               +scrollbind        +wildmenu
+cursorshape       +menu              +signs             +windows
+dialog_con        +mksession         +smartindent       +writebackup
+diff              +modify_fname      +sodium            -X11
+digraphs          +mouse             -sound             -xfontset
-dnd               -mouseshape        +spell             -xim
-ebcdic            +mouse_dec         +startuptime       -xpm
+emacs_tags        +mouse_gpm         +statusline        -xsmp
+eval              -mouse_jsbterm     -sun_workshop      -xterm_clipboard
+ex_extra          +mouse_netterm     +syntax            -xterm_save
+extra_search      +mouse_sgr         +tag_binary        
-farsi             -mouse_sysmouse    -tag_old_static    
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -Wdate-time -g -O2 -ffile-prefix-map=/build/vim-gVT2fw/vim-8.2.3995=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 
Linking: gcc -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lm -ltinfo -lselinux -lsodium -lacl -lattr -lgpm -L/usr/lib -llua5.2 -Wl,-E -fstack-protector-strong -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.34/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python3.10/config-3.10-x86_64-linux-gnu -lpython3.10 -lcrypt -ldl -lm -lm -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lm -lruby-3.0 -lm -L/usr/lib 

Output of YcmDebugInfo

Printing YouCompleteMe debug information...
-- Resolve completions: Up front
-- Client logfile: /tmp/ycm_toc4u4f9.log
-- Server Python interpreter: /usr/bin/python3
-- Server Python version: 3.10.12
-- Server has Clang support compiled in: False
-- Clang version: None
-- No extra configuration file found
-- Java completer debug information:
--   jdt.ls running
--   jdt.ls process ID: 28957
--   jdt.ls executable: ['/usr/bin/java', '-Dfile.encoding=UTF-8', '-Declipse.application=org.eclipse.jdt.ls.core.id1', '-Dosgi.bundles.defaultStartLevel=4', '-Declipse.product=org.eclipse.
jdt.ls.core.product', '-Dlog.level=ALL', '-jar', '/home/reddot/.vim/pack/ycm/opt/YouCompleteMe/third_party/ycmd/third_party/eclipse.jdt.ls/target/repository/plugins/org.eclipse.equinox.launcher_1.
6.700.v20231214-2017.jar', '-configuration', '/home/reddot/.vim/pack/ycm/opt/YouCompleteMe/third_party/ycmd/third_party/eclipse.jdt.ls/workspace/config_linux', '-data', '/home/reddot/.vim/pack/ycm/opt/YouCompleteMe/third_party/ycmd/third_party/eclipse.jdt.ls/workspace/temp/tmp0yoo7ktg']
--   jdt.ls logfiles:
--     /tmp/jdt_ls_stderr_emzz4ge.log
--     /home/reddot/.vim/pack/ycm/opt/YouCompleteMe/third_party/ycmd/third_party/eclipse.jdt.ls/workspace/temp/tmp0yoo7ktg/.metadata/.log
--   jdt.ls Server State: Initialized
--   jdt.ls Project Directory: /home/reddot/garage/ycm
--   jdt.ls Open Workspaces: {'/home/reddot/garage/ycm'}
--   jdt.ls Settings: {
--   "bundles": []
-- }
--   jdt.ls Startup Status: Ready
--   jdt.ls Java Path: /usr/bin/java
--   jdt.ls Launcher Config.: /home/reddot/.vim/pack/ycm/opt/YouCompleteMe/third_party/ycmd/third_party/eclipse.jdt.ls/workspace/config_linux
--   jdt.ls Workspace Path: /home/reddot/.vim/pack/ycm/opt/YouCompleteMe/third_party/ycmd/third_party/eclipse.jdt.ls/workspace/temp/tmp0yoo7ktg
--   jdt.ls Extension Path: ['/home/reddot/.vim/pack/ycm/opt/YouCompleteMe/third_party/ycmd/third_party/eclipse.jdt.ls/extensions']
-- Server running at: http://127.0.0.1:60727
-- Server process ID: 28945
-- Server logfiles:
--   /tmp/ycmd_60727_stdout_8qe_2dx1.log
--   /tmp/ycmd_60727_stderr_kn5ilr6t.log
-- Semantic highlighting supported: True
-- Virtual text supported: False
-- Popup windows supported: True

Output of YcmDiags

firstly after initialization

./src/main/java/ycm/demo/Main.java|6 col 13 error| UnusedObjectHelper cannot be resolved to a type [16777218]                                                                                
./src/main/java/ycm/demo/Main.java|13 col 28 error| UnusedObjectHelper cannot be resolved to a type [16777218]

then after any change

./src/main/java/ycm/demo/Main.java|4 col 24 warning| The value of the field Main.usedObject is not used [570425421]                                                                          

Output of git rev-parse HEAD in YouCompleteMe installation directory

c3c03323c4e4bd84b8fc6173a6c95bbd6c922b11

Contents of YCM, ycmd and completion engine logfiles

gist

OS version, distribution, etc.

Ubuntu 22.04.4 LTS

@bstaletic
Copy link
Collaborator

I can repro this, but as far as I can tell it's the fault of JDT itself. It actually reports diagnostics the way you are seeing them. YCM is just relaying those errors from JDT to vim's UI.

I also got a warning that JRE 17 is not found and that JRE 21 will be used, but that's expected on my machine.

Here's the list of exchanged messages between YCM and JDT:

2024-03-03 10:01:29,631 - DEBUG - Event name: FileReadyToParse
2024-03-03 10:01:29,635 - DEBUG - TX: Sending message: b'Content-Length: 1761\r\n\r\n{"id":1,"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"textDocument":{"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"completion":{"completionItem":{"documentationFormat":["plaintext","markdown"],"resolveSupport":{"properties":["documentation","detail"]}},"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]}},"documentSymbol":{"hierarchicalDocumentSymbolSupport":false,"labelSupport":false,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},"hover":{"contentFormat":["plaintext","markdown"]},"inlay_hint":{},"semanticTokens":{"augmentSyntaxTokens":true,"formats":["relative"],"requests":{"full":{"delta":false},"range":true},"tokenModifiers":[],"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","member","macro","keyword","modifier","comment","string","number","regexp","operator"]},"signatureHelp":{"signatureInformation":{"documentationFormat":["plaintext","markdown"],"parameterInformation":{"labelOffsetSupport":true}}},"synchronization":{"didSave":true}},"workspace":{"applyEdit":true,"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},"workspaceEdit":{"documentChanges":true},"workspaceFolders":true}},"initializationOptions":{"bundles":[]},"processId":32306,"rootPath":"/home/bstaletic/work/test/ycmd","rootUri":"file:///home/bstaletic/work/test/ycmd","workspaceFolders":[]}}'
2024-03-03 10:01:33,242 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:33\xe2\x80\xafAM Main thread is waiting"}}'
2024-03-03 10:01:33,323 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:33\xe2\x80\xafAM \\u003e\\u003e initialize"}}'
2024-03-03 10:01:33,327 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:33\xe2\x80\xafAM Initializing Java Language Server 1.31.0.202401111522"}}'
2024-03-03 10:01:33,329 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:33\xe2\x80\xafAM Started org.eclipse.m2e.core 1ms"}}'
2024-03-03 10:01:35,214 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:35\xe2\x80\xafAM ProjectRegistryRefreshJob finished 1884ms"}}'
2024-03-03 10:01:35,272 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:35\xe2\x80\xafAM Started org.eclipse.buildship.core 53ms"}}'
2024-03-03 10:01:35,323 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:35\xe2\x80\xafAM Static Commands: []"}}'
2024-03-03 10:01:35,324 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:35\xe2\x80\xafAM Non-Static Commands: [java.project.import, java.project.changeImportedProjects, java.navigate.openTypeHierarchy, java.project.resolveStackTraceLocation, java.edit.handlePasteEvent, java.edit.stringFormatting, java.project.getSettings, java.project.resolveWorkspaceSymbol, java.project.upgradeGradle, java.project.createModuleInfo, java.vm.getAllInstalls, java.edit.organizeImports, java.project.refreshDiagnostics, java.project.removeFromSourcePath, java.project.listSourcePaths, java.project.getAll, java.reloadBundles, java.project.isTestFile, java.project.resolveText, java.project.getClasspaths, java.navigate.resolveTypeHierarchy, java.edit.smartSemicolonDetection, java.project.updateSourceAttachment, java.decompile, java.protobuf.generateSources, java.project.resolveSourceAttachment, java.project.updateJdk, java.project.addToSourcePath, java.completion.onDidSelect]"}}'
2024-03-03 10:01:35,347 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"language/status","params":{"type":"Starting","message":"Init..."}}'
2024-03-03 10:01:35,347 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"language/status","params":{"type":"Starting","message":"0% Starting Java Language Server"}}'
2024-03-03 10:01:35,358 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:35\xe2\x80\xafAM RepositoryRegistryUpdateJob finished 0ms"}}'
2024-03-03 10:01:35,380 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:35\xe2\x80\xafAM Creating the Java project jdt.ls-java-project"}}'
2024-03-03 10:01:35,380 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","id":1,"result":{"capabilities":{"textDocumentSync":{"openClose":true,"change":2,"save":{"includeText":true}},"hoverProvider":true,"completionProvider":{"resolveProvider":true,"triggerCharacters":[".","@","#","*"," "]},"signatureHelpProvider":{"triggerCharacters":["(",","]},"definitionProvider":true,"typeDefinitionProvider":true,"implementationProvider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"workspaceSymbolProvider":true,"codeActionProvider":true,"codeLensProvider":{"resolveProvider":true},"documentFormattingProvider":true,"documentRangeFormattingProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":";","moreTriggerCharacter":["\\n","}"]},"renameProvider":{"prepareProvider":true},"foldingRangeProvider":true,"declarationProvider":true,"executeCommandProvider":{"commands":["java.project.import","java.project.changeImportedProjects","java.navigate.openTypeHierarchy","java.project.resolveStackTraceLocation","java.edit.handlePasteEvent","java.edit.stringFormatting","java.project.getSettings","java.project.resolveWorkspaceSymbol","java.project.upgradeGradle","java.project.createModuleInfo","java.vm.getAllInstalls","java.edit.organizeImports","java.project.refreshDiagnostics","java.project.removeFromSourcePath","java.project.listSourcePaths","java.project.getAll","java.reloadBundles","java.project.isTestFile","java.project.resolveText","java.project.getClasspaths","java.navigate.resolveTypeHierarchy","java.edit.smartSemicolonDetection","java.project.updateSourceAttachment","java.decompile","java.protobuf.generateSources","java.project.resolveSourceAttachment","java.project.updateJdk","java.project.addToSourcePath","java.completion.onDidSelect"]},"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":true}},"typeHierarchyProvider":true,"callHierarchyProvider":true,"selectionRangeProvider":true,"semanticTokensProvider":{"legend":{"tokenTypes":["namespace","class","interface","enum","enumMember","type","typeParameter","method","property","variable","parameter","modifier","keyword","annotation","annotationMember","record","recordComponent"],"tokenModifiers":["abstract","static","readonly","deprecated","declaration","documentation","public","private","protected","native","generic","typeArgument","importDeclaration","constructor"]},"range":false,"full":{"delta":false},"documentSelector":[{"language":"java","scheme":"file"},{"language":"java","scheme":"jdt"}]},"inlayHintProvider":true}}}'
2024-03-03 10:01:35,382 - DEBUG - TX: Sending notification: b'Content-Length: 52\r\n\r\n{"jsonrpc":"2.0","method":"initialized","params":{}}'
2024-03-03 10:01:35,382 - DEBUG - TX: Sending notification: b'Content-Length: 98\r\n\r\n{"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"bundles":[]}}}'
2024-03-03 10:01:35,383 - DEBUG - TX: Sending notification: b'Content-Length: 614\r\n\r\n{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"java","text":"package ycm.demo;\\n\\nclass Main {\\n    private UsedObject usedObject;\\n    private UsedObjectHelper usedObjectHelper;\\n    private UnusedObjectHelper unusedObjectHelper;\\n\\n    public void testUsedObjectHelper() {\\n        System.out.println(usedObjectHelper);\\n    }\\n\\n    public void testUnusedObjectHelper() {\\n        System.out.println(unusedObjectHelper);\\n    }\\n\\n    public static void main() {\\n    }\\n}\\n","uri":"file:///home/bstaletic/work/test/ycmd/src/main/java/ycm/demo/Main.java","version":1}}}'
2024-03-03 10:01:35,384 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:35\xe2\x80\xafAM \\u003e\\u003e initialized"}}'
2024-03-03 10:01:35,562 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:35\xe2\x80\xafAM Finished creating the Java project jdt.ls-java-project"}}'
2024-03-03 10:01:36,591 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"language/status","params":{"type":"Starting","message":"31% Starting Java Language Server - Refreshing \\u0027/jdt.ls-java-project\\u0027."}}'
2024-03-03 10:01:36,594 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:36\xe2\x80\xafAM Importing Maven project(s)"}}'
2024-03-03 10:01:38,527 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"language/status","params":{"type":"Starting","message":"60% Starting Java Language Server - Project \\u0027demo\\u0027"}}'
2024-03-03 10:01:38,771 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"language/status","params":{"type":"Starting","message":"61% Starting Java Language Server - Project \\u0027demo\\u0027"}}'
2024-03-03 10:01:39,213 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"language/status","params":{"type":"Starting","message":"69% Starting Java Language Server - Refreshing \\u0027/demo/src/main/java\\u0027."}}'
2024-03-03 10:01:39,408 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"language/status","params":{"type":"ProjectStatus","message":"OK"}}'
2024-03-03 10:01:39,408 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"language/status","params":{"type":"Starting","message":"100% Starting Java Language Server - Refreshing \\u0027/demo/src/test/java\\u0027."}}'
2024-03-03 10:01:39,410 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:39\xe2\x80\xafAM Workspace initialized in 4053ms"}}'
2024-03-03 10:01:39,410 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"language/status","params":{"type":"Started","message":"Ready"}}'
2024-03-03 10:01:39,430 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"language/status","params":{"type":"Starting","message":"100% Starting Java Language Server - Refreshing \\u0027/demo/src/test/java\\u0027."}}'
2024-03-03 10:01:39,437 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:39\xe2\x80\xafAM \\u003e\\u003e initialization job finished"}}'
2024-03-03 10:01:39,451 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:39\xe2\x80\xafAM \\u003e\\u003e registerWatchers\\u0027"}}'
2024-03-03 10:01:39,460 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:39\xe2\x80\xafAM \\u003e\\u003e registerFeature \\u0027workspace/didChangeWatchedFiles\\u0027"}}'
2024-03-03 10:01:39,468 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","id":"1","method":"client/registerCapability","params":{"registrations":[{"id":"e58b0de6-a91e-4e41-a00b-ca09a0dbfd0c","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"**/*.java"},{"globPattern":"**/.project"},{"globPattern":"**/.classpath"},{"globPattern":"**/.settings/*.prefs"},{"globPattern":"**/src/**"},{"globPattern":"**/*.gradle"},{"globPattern":"**/*.gradle.kts"},{"globPattern":"**/gradle.properties"},{"globPattern":"**/pom.xml"},{"globPattern":"/home/bstaletic/work/test/ycmd","kind":4}]}}]}}'
2024-03-03 10:01:39,488 - DEBUG - TX: Sending response: b'Content-Length: 40\r\n\r\n{"id":"1","jsonrpc":"2.0","result":null}'
2024-03-03 10:01:39,489 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","id":"2","method":"client/registerCapability","params":{"registrations":[{"id":"7d3f0236-ee0d-40a9-969f-0be89d2f5703","method":"workspace/didChangeWorkspaceFolders"}]}}'
2024-03-03 10:01:39,489 - DEBUG - TX: Sending response: b'Content-Length: 40\r\n\r\n{"id":"2","jsonrpc":"2.0","result":null}'
2024-03-03 10:01:39,489 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"language/status","params":{"type":"ServiceReady","message":"ServiceReady"}}'
2024-03-03 10:01:39,873 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/bstaletic/work/test/ycmd","diagnostics":[]}}'
2024-03-03 10:01:39,963 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/bstaletic/work/test/ycmd/pom.xml","diagnostics":[]}}'
2024-03-03 10:01:40,420 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:40\xe2\x80\xafAM Reconciled 1. Took 1 ms"}}'
2024-03-03 10:01:40,770 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/bstaletic/work/test/ycmd","diagnostics":[{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"severity":2,"code":"0","source":"Java","message":"Build path specifies execution environment JavaSE-17. There are no JREs installed in the workspace that are strictly compatible with this environment."},{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"severity":2,"code":"0","source":"Java","message":"The compiler compliance specified is 17 but a JRE 21 is used"}]}}'
2024-03-03 10:01:40,772 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/bstaletic/work/test/ycmd/pom.xml","diagnostics":[]}}'
2024-03-03 10:01:40,792 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:40\xe2\x80\xafAM \\u003e\\u003e build jobs finished"}}'
2024-03-03 10:01:40,796 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:40\xe2\x80\xafAM Reconciled 1. Took 0 ms"}}'
2024-03-03 10:01:40,818 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/bstaletic/work/test/ycmd","diagnostics":[{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"severity":2,"code":"0","source":"Java","message":"Build path specifies execution environment JavaSE-17. There are no JREs installed in the workspace that are strictly compatible with this environment."},{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"severity":2,"code":"0","source":"Java","message":"The compiler compliance specified is 17 but a JRE 21 is used"}]}}'
2024-03-03 10:01:40,842 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/bstaletic/work/test/ycmd/pom.xml","diagnostics":[]}}'
2024-03-03 10:01:41,929 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:41\xe2\x80\xafAM begin problem for /Main.java"}}'
2024-03-03 10:01:41,940 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:41\xe2\x80\xafAM 2 problems reported for /Main.java"}}'
2024-03-03 10:01:41,954 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/bstaletic/work/test/ycmd/src/main/java/ycm/demo/Main.java","diagnostics":[{"range":{"start":{"line":5,"character":12},"end":{"line":5,"character":30}},"severity":1,"code":"16777218","source":"Java","message":"UnusedObjectHelper cannot be resolved to a type","data":["UnusedObjectHelper"]},{"range":{"start":{"line":12,"character":27},"end":{"line":12,"character":45}},"severity":1,"code":"16777218","source":"Java","message":"UnusedObjectHelper cannot be resolved to a type","data":["UnusedObjectHelper"]}]}}'
2024-03-03 10:01:41,954 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:41\xe2\x80\xafAM Validated 1. Took 504 ms"}}'
2024-03-03 10:01:56,060 - DEBUG - Event name: FileReadyToParse
2024-03-03 10:01:56,060 - DEBUG - TX: Sending notification: b'Content-Length: 619\r\n\r\n{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"package ycm.demo;\\n\\n\\nclass Main {\\n    private UsedObject usedObject;\\n    private UsedObjectHelper usedObjectHelper;\\n    private UnusedObjectHelper unusedObjectHelper;\\n\\n    public void testUsedObjectHelper() {\\n        System.out.println(usedObjectHelper);\\n    }\\n\\n    public void testUnusedObjectHelper() {\\n        System.out.println(unusedObjectHelper);\\n    }\\n\\n    public static void main() {\\n    }\\n}\\n"}],"textDocument":{"uri":"file:///home/bstaletic/work/test/ycmd/src/main/java/ycm/demo/Main.java","version":2}}}'
2024-03-03 10:01:56,133 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:56\xe2\x80\xafAM Reconciled 1. Took 2 ms"}}'
2024-03-03 10:01:56,973 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:56\xe2\x80\xafAM begin problem for /Main.java"}}'
2024-03-03 10:01:56,974 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:56\xe2\x80\xafAM 1 problems reported for /Main.java"}}'
2024-03-03 10:01:56,975 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/bstaletic/work/test/ycmd/src/main/java/ycm/demo/Main.java","diagnostics":[{"range":{"start":{"line":4,"character":23},"end":{"line":4,"character":33}},"severity":2,"code":"570425421","source":"Java","message":"The value of the field Main.usedObject is not used"}]}}'
2024-03-03 10:01:56,976 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Mar 3, 2024, 10:01:56\xe2\x80\xafAM Validated 1. Took 35 ms"}}'

I really do not see how this could be YCM's fault, but maybe @puremourning sees something I'm missing?
@RomanValov to get debug logs, put let g:ycm_log_level='debug' in your vimrc. That will enable verbose logging even for JDT's .log.

@RomanValov
Copy link
Author

@bstaletic thank you for looking into this. Indeed I have tested with coc-java too and the same issue reproduced. Do you have any advices on how to report the issue to JDT.LS team? I suppose they may not be happy with end user testcase bound to particular editor.

@bstaletic
Copy link
Collaborator

The key part are the messages exchanged between JDT.LS and tge client.

Turn on debug logging, as I have suggested in my previous comment. Then look at the .log, which is where JDT logs the messages from its perspective.

That should be fine for a JDT bug report.

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

No branches or pull requests

2 participants