Skip to content

Show correct version when using util.Properties.versionNumberString #22144

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

Open
tgodzik opened this issue Dec 5, 2024 · 9 comments
Open

Show correct version when using util.Properties.versionNumberString #22144

tgodzik opened this issue Dec 5, 2024 · 9 comments

Comments

@tgodzik
Copy link
Contributor

tgodzik commented Dec 5, 2024

Compiler version

3.5.2

Minimized code

println(util.Properties.versionNumberString)

Output

2.13.15

or 14 don't remember, but that's not important

Expectation

It should show 3.5.2. For that to happen two steps were suggested:

  • Scala 2 library should first check for scala 3 properties
  • Scala 3 should have those properties

They should be something like:

/library3.properties
maven.version.number=3.5.2
version.number=3.5.2

maven version might not be needed.

First step should be adding it here, but if we hurry we can add it to Scala 2.13.16

@tgodzik tgodzik added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Dec 5, 2024
@hamzaremmal
Copy link
Member

hamzaremmal commented Dec 5, 2024

Why add it to 2.13.16, can't we fully solve it in Scala 3 ?

@tgodzik
Copy link
Contributor Author

tgodzik commented Dec 5, 2024

First step should be adding it here, but if we hurry we can add it to Scala 2.13.16

Why add it to 2.13.16, can't we fully solve it in Scala 3 ?

Can we patch the scala library to fix that?

@sjrd
Copy link
Member

sjrd commented Dec 5, 2024

No, we cannot override class files that exist in the scala-library.jar.

@dwijnand
Copy link
Member

dwijnand commented Dec 5, 2024

The version of the scala-library is 2.13.15. Perhaps you want:

scala> println(dotty.tools.dotc.config.Properties.versionNumberString)
3.6.4-RC1-bin-20241204-a67dbb0-NIGHTLY

@tgodzik
Copy link
Contributor Author

tgodzik commented Dec 5, 2024

The version of the scala-library is 2.13.15. Perhaps you want:

scala> println(dotty.tools.dotc.config.Properties.versionNumberString)
3.6.4-RC1-bin-20241204-a67dbb0-NIGHTLY

I think that requires you to have the compiler on your classpath, no?

@dwijnand
Copy link
Member

dwijnand commented Dec 5, 2024

Yeah, it's in scala3-compiler.

@tgodzik
Copy link
Contributor Author

tgodzik commented Dec 5, 2024

So normal users will try to use println(util.Properties.versionNumberString) which will point them to thinking they are using Scala 2.13. This has actually happened, people were reporting that a wrong version is being used because that println returned 2.13. So this is quite confusing.

@hamzaremmal
Copy link
Member

hamzaremmal commented Dec 5, 2024

This should be fixed when we work on #22043 anyways

@dwijnand
Copy link
Member

dwijnand commented Dec 5, 2024

So normal users will try to use println(util.Properties.versionNumberString) which will point them to thinking they are using Scala 2.13. This has actually happened, people were reporting that a wrong version is being used because that println returned 2.13. So this is quite confusing.

I take it back. I think it's reasonable to configure scala-library's scala.util.Properties to try to look for a properties file which we'll ship in scala3-library, as an override.

@Gedochao Gedochao added compat:scala2 area:tooling and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants