java-language-server icon indicating copy to clipboard operation
java-language-server copied to clipboard

When I started typing "pub" to defined new class method, the LS crashed.

Open bushev opened this issue 4 years ago • 0 comments

image

Code:

public class App {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }

  pub // <--
}

Requests:

{
  "jsonrpc": "2.0",
  "id": "0",
  "method": "initialize",
  "params": {
    "capabilities": {
      "textDocument": {
        "hover": {
          "dynamicRegistration": true,
          "contentFormat": [
            "plaintext",
            "markdown"
          ]
        },
        "moniker": {},
        "synchronization": {
          "dynamicRegistration": true,
          "willSave": false,
          "didSave": false,
          "willSaveWaitUntil": false
        },
        "completion": {
          "dynamicRegistration": true,
          "completionItem": {
            "snippetSupport": false,
            "commitCharactersSupport": true,
            "documentationFormat": [
              "plaintext",
              "markdown"
            ],
            "deprecatedSupport": false,
            "preselectSupport": false
          },
          "contextSupport": false
        },
        "signatureHelp": {
          "dynamicRegistration": true,
          "signatureInformation": {
            "documentationFormat": [
              "plaintext",
              "markdown"
            ]
          }
        },
        "declaration": {
          "dynamicRegistration": true,
          "linkSupport": true
        },
        "definition": {
          "dynamicRegistration": true,
          "linkSupport": true
        },
        "typeDefinition": {
          "dynamicRegistration": true,
          "linkSupport": true
        },
        "implementation": {
          "dynamicRegistration": true,
          "linkSupport": true
        }
      },
      "workspace": {
        "didChangeConfiguration": {
          "dynamicRegistration": true
        }
      }
    },
    "initializationOptions": {
      "languageId": "java"
    },
    "processId": null,
    "rootUri": "file:///",
    "workspaceFolders": [
      {
        "name": "root",
        "uri": "file:///"
      }
    ]
  }
}
{
  "jsonrpc": "2.0",
  "method": "initialized",
  "params": {}
}
{
  "jsonrpc": "2.0",
  "method": "textDocument/didOpen",
  "params": {
    "textDocument": {
      "uri": "file:///App.java",
      "languageId": "java",
      "text": "public class App {\n    public static void main(String[] args) {\n        System.out.println(\"Hello, World!\");\n    }\n\n  \tpub\n}\n",
      "version": 0
    }
  }
}

Logs:

Language Server Server: 19:27:09.359	INFO	LSP connect	Reading messages from queue...

Language Server Server: 19:27:09.359	INFO	LSP$1MessageReader run	Placing incoming messages on queue...

Language Server Server: 19:27:10.110	INFO	JavaLanguageServer lint	Lint 1 files...

Language Server Server: 19:27:10.130	INFO	ScanClassPath jdkTopLevelClasses	Searching for top-level classes in the JDK

Language Server Server: 19:27:10.323	INFO	ScanClassPath jdkTopLevelClasses	Found 5670 classes in the java platform
Class path:
Doc path:

Language Server Server: 19:27:10.401	INFO	Docs findSrcZip	Found /usr/java/openjdk-14/lib/src.zip

Language Server Server: 19:27:10.490	INFO	ScanClassPath classPathTopLevelClasses	Searching for top-level classes in 0 classpath locations

Language Server Server: 19:27:10.501	INFO	ScanClassPath classPathTopLevelClasses	Found 0 classes in classpath

Language Server Server: 19:27:10.505	WARNING	ReusableCompiler getTask	Options changed from [-classpath, , --add-modules, ALL-MODULE-PATH, -proc:none, -g, -Xlint:cast, -Xlint:deprecation, -Xlint:empty, -Xlint:fallthrough, -Xlint:finally, -Xlint:path, -Xlint:unchecked, -Xlint:varargs, -Xlint:static] to [-classpath, , --add-modules, ALL-MODULE-PATH, -proc:none, -g, -Xlint:cast, -Xlint:deprecation, -Xlint:empty, -Xlint:fallthrough, -Xlint:finally, -Xlint:path, -Xlint:unchecked, -Xlint:varargs, -Xlint:static], creating new compiler

Language Server Server: 19:27:10.921	WARNING	FileStore readInfoFromDisk	/App.java

Language Server Server: 19:27:10.922	SEVERE	Main main	null
java.lang.NullPointerException
	at org.javacs.FileStore.packageName(FileStore.java:150)
	at org.javacs.CompileBatch.packageName(CompileBatch.java:79)
	at org.javacs.CompileBatch.needsAdditionalSources(CompileBatch.java:60)
	at org.javacs.JavaCompilerService.doCompile(JavaCompilerService.java:77)
	at org.javacs.JavaCompilerService.loadCompile(JavaCompilerService.java:67)
	at org.javacs.JavaCompilerService.compileBatch(JavaCompilerService.java:93)
	at org.javacs.JavaCompilerService.compile(JavaCompilerService.java:349)
	at org.javacs.JavaCompilerService.compile(JavaCompilerService.java:344)
	at org.javacs.JavaLanguageServer.lint(JavaLanguageServer.java:61)
	at org.javacs.JavaLanguageServer.doAsyncWork(JavaLanguageServer.java:523)
	at org.javacs.lsp.LSP.connect(LSP.java:247)
	at org.javacs.Main.main(Main.java:30)

bushev avatar May 11 '21 19:05 bushev