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

chore: deprecate running Metals on Java 8 #3788

Closed
wants to merge 2 commits into from

Conversation

kpodsiad
Copy link
Member

@kpodsiad kpodsiad commented Apr 5, 2022

As discussed in #3784

Comment on lines +167 to +168
.problemMessage(scalaTargets, javaTargets)
.orElse(deprecatedJavaVersion())
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build targets' problems first, then jdk deprecation

Comment on lines +180 to +182
if (clientConfig.isDoctorVisibilityProvider()) {
isVisible.set(true)
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When there is some problem there is also More Information button, without this snippet, it won't work.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I broke this in #3768

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a question.

@@ -390,6 +411,17 @@ final class Doctor(
}
}

deprecatedJavaVersion().foreach { deprecatedJdk =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does it look in the doctor?

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I wonder about a case where you want to use JDK 8 to build Java files, it currently defaults to whatever you used for import. If you are unable to use it then you might not be able to compile your code. javaHome should in that case be used for Bloop + running sbt.

We should probably only issue this warnings once we switch to Metals downloading a specific JDK version, so that this would only pop up for users of other editors, who would still be able to run Metals with different versions. (maybe we could make a requirement in coursier? OR build Metals using JDK17 ?)

@dos65
Copy link
Member

dos65 commented Apr 7, 2022

@tgodzik

I think these cases are rare and might be solved by having several jdk installed.
For example, you might have jdk8 as a default but the jdk selection rules in metals-vscode can select a higher non-default one >=11 for Metals process.

@tgodzik
Copy link
Contributor

tgodzik commented Apr 8, 2022

@tgodzik

I think these cases are rare and might be solved by having several jdk installed. For example, you might have jdk8 as a default but the jdk selection rules in metals-vscode can select a higher non-default one >=11 for Metals process.

Yeah, that's why I think we should separate Java used to run Metals (even download our own) from the one used for compilation etc.

@dos65
Copy link
Member

dos65 commented Apr 13, 2022

It seems that we stuck here.
What about adding adding an additional default jdk as parameter to initialize options?
Then we would be able running Metals on higher jdk version and keep using jdk8 for bloop if it's a default one.

@tgodzik
Copy link
Contributor

tgodzik commented Apr 13, 2022

It seems that we stuck here. What about adding adding an additional default jdk as parameter to initialize options? Then we would be able running Metals on higher jdk version and keep using jdk8 for bloop if it's a default one.

I think we should do a couple of separate step:

  • download our own binary for Metals JDK 17 and decouple javaHome (maybe rename the description)
  • change the plugins for generating Bloop configuration to add the proper release flags to make sure it's run with a proper version
  • automatically set javaHome in Bloop to be the same JDK 17 as Metals uses

There is not much benefit in deprecating it here without those steps I feel.

@kpodsiad
Copy link
Member Author

I think we should do a couple of separate step:

  • download our own binary for Metals JDK 17 and decouple javaHome (maybe rename the description)
  • change the plugins for generating Bloop configuration to add the proper release flags to make sure it's run with a proper version
  • automatically set javaHome in Bloop to be the same JDK 17 as Metals uses

There is not much benefit in deprecating it here without those steps I feel.

Sounds very reasonable.

@dos65
Copy link
Member

dos65 commented Apr 13, 2022

@tgodzik

change the plugins for generating Bloop configuration to add the proper release flags to make sure it's run with a proper version

What do you mean here by release flags? javac and scalac?

@tgodzik
Copy link
Contributor

tgodzik commented Apr 14, 2022

@tgodzik

change the plugins for generating Bloop configuration to add the proper release flags to make sure it's run with a proper version

What do you mean here by release flags? javac and scalac?

Yeah, similar way that ScalaCLI does it. Currently, it's not working too great since we just run with whatever Bloop is started with.

@dos65
Copy link
Member

dos65 commented Apr 14, 2022

@tgodzik

change the plugins for generating Bloop configuration to add the proper release flags to make sure it's run with a proper version

What do you mean here by release flags? javac and scalac?

Yeah, similar way that ScalaCLI does it. Currently, it's not working too great since we just run with whatever Bloop is started with.

I wouldn't go this way. Even if we tune options with proper release flags some user might face the issues during the run/debug because the runtime is different from the expected one.
Also, there will be difference between bsp servers in this moment. Auto-jdk17 with bloop and system-default for sbt/mill/...

@tgodzik
Copy link
Contributor

tgodzik commented Apr 14, 2022

I wouldn't go this way. Even if we tune options with proper release flags some user might face the issues during the run/debug because the runtime is different from the expected one.

We already have options for that, run/debug should be launched using platform settings and not the current Java version, so this should not be an issue.

Also, there will be difference between bsp servers in this moment. Auto-jdk17 with bloop and system-default for sbt/mill/...

I think Metals can still start the bsp server with a proper Java from .bsp and sbt will most likely create an entry with the Java version that we launched the generate configuration task with. It's different here since each workspace can use different Java while Bloop only uses one, so there is no other option aside from using the release flags from what I see.

@dos65
Copy link
Member

dos65 commented Apr 15, 2022

@tgodzik ok, sounds good!
Looks like this one can be closed.

@kpodsiad
Copy link
Member Author

kpodsiad commented May 14, 2022

I think we should do a couple of separate step:

  • download our own binary for Metals JDK 17 and decouple javaHome (maybe rename the description)
  • change the plugins for generating Bloop configuration to add the proper release flags to make sure it's run with a proper version
  • automatically set javaHome in Bloop to be the same JDK 17 as Metals uses

There is not much benefit in deprecating it here without those steps I feel.

@tgodzik Could you put this (in a bit more verbose form) into an issue? Until it happen, I'll keep this PR open to not forget about conclusions.

@tgodzik
Copy link
Contributor

tgodzik commented May 16, 2022

Done! #3923

@tgodzik tgodzik closed this May 16, 2022
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

Successfully merging this pull request may close these issues.

5 participants