Skip to content

Zinc incremental compilation behaviour is different when executed in the single jvm vs two consecutive runs #1493

@ov7a

Description

@ov7a

steps

Please see the reproducer

In short, it does the following:

  1. creates a mixed java/scala project
  2. compiles java sources with javac and scala sources with zinc
  3. changes the java source and recompiles it
  4. recompiles the scala source with zinc

If all these steps are executed in a single sbt run, zinc does not see the updated java class properly. If 1-2 and 3-4 are made in two consecutive runs, it works as expected.

I can observe this behavior with zinc 1.10.4, 1.10.0, 1.9.6.

problem

I suspect it has something to do with the internal caches of zinc. However, I haven't found a proper way to clear them.

expectation

I expect the behavior to be the same: the state should be preserved in compileAnalysis, and all the necessary data should be there. Apparently, that's not the case.

I expect the same output to be produced if the same inputs are used, independent of the environment.

notes

Somebody may suspect that it depends on the loaded jars, but I get the same issue with the hardcoded, explicit paths to pre-downloaded jars.

The reproducer is a very rough approximation of how Gradle (8.10) works.

I stumbled across this issue while investigating

The only relevant change in 1.10.1 is fixed stamps for empty files/directories, but I can't reproduce Gradle's issue in isolation. If anyone has ideas about what can be an (implicit) input, it would be appreciated.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions