-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Non-deterministic class files #22181
Comments
I remember a lot of work was done for Scala 2 to make the artifacts deterministic. Did we ever port those changes to Scala 3? Anyone knows? As the reporter noticed, this might be pretty important for industry adoptions. @aalleexxeeii do you have examples where this order is nondeterministic? That would help a lot, since it's really sometimes hard to get it right in all possible configurations. |
Starting point is scala/scala-dev#405. There are many links from there to PRs, a repo with tests / experiments, eg a script that compiles files in random orders or recompiles random files. scala/scala#6300 is a good example, but there were many fixes. This is definitely an important feature. |
FWIW this is also important for the Mill build tool, which relies on analyzing bytecode changes to determine whether to invalidate tasks on code changes, so non-deterministic code changes result in tasks being un-necessarily invalidated and re-run. So far this hasn't been a problem in Scala 2.13, but we're upgrading to Scala 3 soon so would like to put it on the radar to ensure Scala 3 preserves the determinism |
Btw. @Gedochao I think we should focus on this one as soon as possible, if there is no one available I might need to take a look. |
Compiler version
3.3.3
Description
When large source files are compiled, the compiler can generate class files which are binary different. The difference is usually in the order of entries in the constant pool or it may be the ordering of methods. Is there a compiler option to make output deterministic? Some industrial standards require checking binary consistency of generated artifacts.
The text was updated successfully, but these errors were encountered: