Sage-Bionetworks / sage-monorepo

Where OpenChallenges, Schematic, and other Sage open source apps are built
https://sage-bionetworks.github.io/sage-monorepo/
Apache License 2.0
23 stars 12 forks source link

[Bug] Language support for Java does not start properly #2333

Closed tschaffter closed 1 month ago

tschaffter commented 1 year ago

Is there an existing issue for this?

What product(s) are you seeing the problem on?

OpenChallenges

Current behavior

The Language server for Java in VS Code fails to start. This results in Intellisense not being available to Java files.

Language server logs:

WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.foreign
Nov 07, 2023 8:26:11 PM org.apache.aries.spifly.BaseActivator log
INFO: Registered provider ch.qos.logback.classic.servlet.LogbackServletContainerInitializer of service jakarta.servlet.ServletContainerInitializer in bundle ch.qos.logback.classic
Nov 07, 2023 8:26:11 PM org.apache.aries.spifly.BaseActivator log
INFO: Registered provider ch.qos.logback.classic.spi.LogbackServiceProvider of service org.slf4j.spi.SLF4JServiceProvider in bundle ch.qos.logback.classic
Nov 07, 2023 8:26:24 PM com.microsoft.java.debug.plugin.internal.JavaDebuggerServerPlugin start
INFO: Starting com.microsoft.java.debug.plugin
[Error - 8:26:54 PM] Nov 7, 2023, 8:26:54 PM Unable to load IDecompiler class for jarFileContentProvider
Nov 07, 2023 8:32:51 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleCancellation
WARNING: Unmatched cancel notification for request id 190

Expected behavior

No response

Anything else?

No response

Commit ID

4addaa2ad44084f6b69ee6628d2f0efeca621005

Are you developing inside the dev container?

Code of Conduct

tschaffter commented 1 year ago

I should actually look at the log of the Language support for Java (Syntax Server). For a file of the challenge service:

WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.foreign
[Error - 8:44:09 PM] Nov 7, 2023, 8:44:09 PM [Working copy] ChallengeServiceApplication.java [in org.sagebionetworks.openchallenges.challenge.service [in src [in jdt.ls-java-project]]] does not exist
[Working copy] ChallengeServiceApplication.java [in org.sagebionetworks.openchallenges.challenge.service [in src [in jdt.ls-java-project]]] does not exist
Java Model Exception: Error in Java Model (code 969): [Working copy] ChallengeServiceApplication.java [in org.sagebionetworks.openchallenges.challenge.service [in src [in jdt.ls-java-project]]] does not exist
    at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:550)
    at org.eclipse.jdt.internal.core.Openable.getUnderlyingResource(Openable.java:358)
    at org.eclipse.jdt.internal.core.CompilationUnit.getUnderlyingResource(CompilationUnit.java:986)
    at org.eclipse.jdt.ls.core.internal.handlers.BaseDiagnosticsHandler.collectNonJavaProblems(BaseDiagnosticsHandler.java:149)
    at org.eclipse.jdt.ls.core.internal.handlers.BaseDiagnosticsHandler.endReporting(BaseDiagnosticsHandler.java:135)
    at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.reportProblems(ReconcileWorkingCopyOperation.java:148)
    at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:112)
    at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:740)
    at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:806)
    at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1325)
    at org.eclipse.jdt.ls.core.internal.handlers.BaseDocumentLifeCycleHandler.publishDiagnostics(BaseDocumentLifeCycleHandler.java:325)
    at org.eclipse.jdt.ls.core.internal.handlers.BaseDocumentLifeCycleHandler.publishDiagnostics(BaseDocumentLifeCycleHandler.java:288)
    at org.eclipse.jdt.ls.core.internal.handlers.BaseDocumentLifeCycleHandler$PublishDiagnosticJob.run(BaseDocumentLifeCycleHandler.java:734)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

EDIT: It's actually the Language support for Java process that shows logs when highlighting Java elements.

tschaffter commented 1 year ago

ImageServiceApplication.java is a non-project file, only syntax errors are reportedJava(16)

I got the same warning simply because I had two Java (Maven) projects in the same Visual Studio Code workspace.

Source

That may be why.

In VS Code, run "Java: Clean the Java language server workspace"

This did not work.

tschaffter commented 9 months ago

Update 2024-02-12

The Language Support for Java thrown the following errors when saving a Java file:

Caused by: java.lang.IllegalStateException: 243:44: mismatched input '(' expecting ';'
    at com.puppycrawl.tools.checkstyle.JavaParser$CheckstyleErrorListener.syntaxError(JavaParser.java:255)
    at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41)
    at org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:543)
    at org.antlr.v4.runtime.DefaultErrorStrategy.reportInputMismatch(DefaultErrorStrategy.java:327)
    at org.antlr.v4.runtime.DefaultErrorStrategy.reportError(DefaultErrorStrategy.java:139)
    at com.puppycrawl.tools.checkstyle.CheckstyleParserErrorStrategy.recoverInline(CheckstyleParserErrorStrategy.java:38)
    at org.antlr.v4.runtime.Parser.match(Parser.java:207)
    at com.puppycrawl.tools.checkstyle.grammar.java.JavaLanguageParser.blockStatement(JavaLanguageParser.java:6092)
    at com.puppycrawl.tools.checkstyle.grammar.java.JavaLanguageParser.block(JavaLanguageParser.java:6007)
    at com.puppycrawl.tools.checkstyle.grammar.java.JavaLanguageParser.methodBody(JavaLanguageParser.java:2897)
    at com.puppycrawl.tools.checkstyle.grammar.java.JavaLanguageParser.methodDeclaration(JavaLanguageParser.java:2856)
    at com.puppycrawl.tools.checkstyle.grammar.java.JavaLanguageParser.memberDeclaration(JavaLanguageParser.java:2704)
    at com.puppycrawl.tools.checkstyle.grammar.java.JavaLanguageParser.classBodyDeclaration(JavaLanguageParser.java:2631)
    at com.puppycrawl.tools.checkstyle.grammar.java.JavaLanguageParser.classBody(JavaLanguageParser.java:2442)
    at com.puppycrawl.tools.checkstyle.grammar.java.JavaLanguageParser.classDeclaration(JavaLanguageParser.java:1084)
    at com.puppycrawl.tools.checkstyle.grammar.java.JavaLanguageParser.types(JavaLanguageParser.java:744)
    at com.puppycrawl.tools.checkstyle.grammar.java.JavaLanguageParser.typeDeclaration(JavaLanguageParser.java:659)
    at com.puppycrawl.tools.checkstyle.grammar.java.JavaLanguageParser.compilationUnit(JavaLanguageParser.java:411)
    at com.puppycrawl.tools.checkstyle.JavaParser.parse(JavaParser.java:99)
    ... 23 more
Caused by: org.antlr.v4.runtime.InputMismatchException
    ... 37 more
tschaffter commented 8 months ago

Added to Backlog

tschaffter commented 1 month ago

This has no longer been an issue recently.