Skip to content

java.base module awareness issue when using workspace.json to resolve dependenciesΒ #85

@jonathanmorris180

Description

@jonathanmorris180

Hi, thanks for providing this LSP!

Initial issue

I'm working within a large multi-module Kotlin repository and am trying to get things working within Neovim. When I navigate to a submodule that has dependencies from another submodule and start the language server with the root set to the root of the submodule, it starts fine and third-party dependencies are resolved; however, dependencies from other submodules do not resolve, resulting in UNRESOLVED_REFERENCE errors.

Unfortunately, due to the large size of this multi-module repo, starting the server attached to the root of the repo doesn't seem to work.

workspace.json

From reading other issues, I noticed that the server will take into account a workspace.json to resolve dependencies, so I used the running server to generate its current workspace.json and then tried adding some paths to help it resolve dependencies from the other submodules. I added the following to the modules[0].contentRoots array:

        {
          "path": "<HOME>/",
          "excludedPatterns": [],
          "excludedUrls": [],
          "sourceRoots": [
            {
              "path": "<HOME>/path/to/other/submodule",
              "type": "java-source"
            },
            ...
          ]
        }

This seems to allow the server to resolve the dependencies correctly so I can go do definition, etc., but now I'm getting errors like this throughout all my files: Cannot access 'Object' which is a supertype of 'MyClass'. This may be forbidden soon. Check the module classpath for missing or conflicting dependencies. [MISSING_DEPENDENCY_SUPERCLASS_WARNING]

NB: This also happens even if I make no changes to the workspace.json file.

Any thoughts on how this might be fixed? I can currently disable diagnostics as a workaround since everything else seems to work okay.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions