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

Missing error message when running Java 11 #582

Closed
cquiroz opened this issue Mar 20, 2019 · 12 comments
Closed

Missing error message when running Java 11 #582

cquiroz opened this issue Mar 20, 2019 · 12 comments
Milestone

Comments

@cquiroz
Copy link
Contributor

cquiroz commented Mar 20, 2019

Describe the bug
On a certain project, I use metals and while metals/bloop can install and run successfully the editor cannot navigate nor shows all errors.

Looking at bloop projects we can see the projects and metals log shows a successful import. However metal doctor looks empty and when trying to navigate it shows messages like:

WARN code navigation does not work for the file '/Users/cquiroz/Projects/ocs3/modules/seqexec/server/src/main/scala/seqexec/server/SeqexecEngine.scala' because it doesn't belong to a build target.

To Reproduce
Steps to reproduce the behavior:

  1. Check out https://github.com/gemini-hlsw/ocs3
  2. Open atom and import
  3. Try to navigate
  4. See error

Expected behavior
Metals working correctly

Screenshots
img2
img1

Installation:

  • Operating system: macOS
  • Editor: Atom
  • Metals version: v0.4.3

Additional context
Gitter discussion:
https://gitter.im/scalameta/metals?at=5c8fadf49d9cc8114adece33

Search terms
navigation, metals

@olafurpg
Copy link
Member

Thank you for reporting! It is very helpful to have a repo that I can clone and run Metals myself 🙏

Is there a specific file where navigation doesn't work? I am unable to reproduce in the files I opened

2019-03-20 13 22 57

@theqabalist
Copy link

theqabalist commented Mar 20, 2019

I was able to reproduce this behavior on macos. In my case I had an external drive mounted at /Volumes/drive, and symlinked into my home at ~/drive. Launching atom from a project in the symlinked directory would recreate this behavior for me. Referring to the project through the canonical /Volumes/drive version alleviated the problem. I did not test symlink only to verify if that's the problem or if symlink to a mount is the issue.

@theqabalist
Copy link

also @olafurpg, given the same constraints I was not able to reproduce in vscode, since that's what your gif shows. So it seems to be specific to atom and it's interaction with metals. OP is also using atom.

@MateuszKubuszok
Copy link

@theqabalist do you use sbt to generate bloop? if so it might be related to sbt/sbt#4552

@laughedelic
Copy link
Member

laughedelic commented Mar 21, 2019

I tried it on the referred project and it worked for some subprojects, for example:

  • works in modules/ephemeris/src/main/scala/gem/horizons/HorizonsClient.scala
  • doesn't work in modules/describe/src/main/scala/gem/describe/F2Describe.scala and describe is not in the list of build targets in the Doctor output

I don't think it's an Atom-specific problem.

@olafurpg
Copy link
Member

@cquiroz in what source file does navigation not work for you? This might be an issue in sbt-bloop not detecting the declared sbt projects. I notice for example that build.sbt doesn't explicitly bind lazy val coreJS = core.js, I'm not sure if that has an effect.

Code navigation for cross-built projects is also not well supported, there is a feature request about it here scalameta/metals-feature-requests#13

@cquiroz
Copy link
Contributor Author

cquiroz commented Mar 26, 2019

@olafurpg For example I don't get navigation on files on the module seqexec_server, e.g. on
https://github.com/gemini-hlsw/ocs3/blob/develop/modules/seqexec/server/src/main/scala/seqexec/server/SeqTranslate.scala

That module is jvm only (btw it has some java files, perhaps that is the reason)

@olafurpg
Copy link
Member

@cquiroz I am unable to reproduce in Atom, navigation works fine for me in SeqTranslate.scala. Have you tried rm -rf .metals .bloop?

2019-03-29 15 33 52

@cquiroz
Copy link
Contributor Author

cquiroz commented Mar 29, 2019

I did a deep review reinstalling and installing stuff and I think I found the reason. I installed OpenJDK 11 a while ago and forgot about it. I use 1.8 normally on the shell but I think Atom was still picking 11 and that failed

Thanks for checking this. Would it be good to add this to the documentation (maybe it is already there)

@olafurpg
Copy link
Member

The server reports an error using window/showMessage saying

  def isUnsupportedJavaVersion: Boolean =
    scala.util.Properties.isJavaAtLeast("9")
  def warnUnsupportedJavaVersion(): Unit = {
    if (isUnsupportedJavaVersion) {
      val javaVersion = System.getProperty("java.version")
      val message =
        s"Unsupported Java version $javaVersion, no functionality will work. " +
          s"To fix this problem, restart the server using Java 8."
      languageClient.showMessage(new MessageParams(MessageType.Error, message))
      scribe.error(message)
    }
  }

when trying to connect to the build server. I wonder how we can make the message easier to discover 🤔

@cquiroz
Copy link
Contributor Author

cquiroz commented Mar 29, 2019

I don't recall seeing that. I got this message that got me thinking

ERROR WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/Users/cquiroz/.sbt/boot/scala-2.12.7/org.scala-sbt/sbt/1.2.8/protobuf-
java-3.3.1.jar) to field java.nio.Buffer.address
WARNING: Please consider reporting this to the maintainers of com.google.protobuf.UnsafeUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

@olafurpg olafurpg changed the title Navigation not working Missing error message when running Java 11 Mar 30, 2019
@olafurpg olafurpg added this to the Metals v0.5.1 milestone Apr 15, 2019
@olafurpg
Copy link
Member

I just tried running Metals with Java 11 and got the following error

Unsupported Java version 11.0.1, no functionality will work. To fix this problem, restart the server using Java 8.

Please reopen if you are able to provide a reproduction where Metals running on Java 9+ does not show that message.

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

5 participants