Incremental compiler does not always recompile sources
In short, I can make the builder fail on perfectly fine Scala code by commenting and uncommenting a method.
This can be currently reproduced using scala-ide master branch (I am using this commit).
Steps to reproduce it:
1. Comment Cached.initialized, save and let the builder compiling the project
2. Uncomment the above method, save and let the builder compiling the project
Now, if you repeat the above two steps for a few times, you'll eventually get in the state where the build compiler reports
a compilation error after step 2, which of course should never happen. In my tests, it looks like this happens cyclically, i.e.,
one time it works fine, and the other it breaks, and so on.
The reported error is: value initialized is not a member of scala.tools.eclipse.util.Cached[Option[scala.tools.eclipse.ScalaPresentationCompiler]]
Note that when the error is reported, the Cached classfile indeed does NOT contain the `initialized` method. And this, despite step 2 was performed.
So, how come we uncommented Cached.initialized, and still that method is not in the produced binary? That made me wonder if compilation fails because one
of the classes calling on Cached.initialized is being compiled with a not up-to-date Cached source file. Just a shoot in the air, but that's my best guess at the moment.
Another interesting fact is that when the build compiler reports the erroneous compilation error (i.e., we are after step 2), if you execute again step 1, i.e.,
commenting Cached.initialized, nothing happens. No entry in the log, nothing, just like the method was never there...
Last piece of information. When you get the faulty compilation error, if you type a space anywhere in the Cached source file and hit save, the build
compiler kicks-in again and this time compilation succeeds.
And finally, here is a link to a folder containing the IDE log after running step 2 alone, with `debugIncremental` flag enabled. 'good-compilation' is for
the project compiles fine, while 'bad-compilation' is for the buggy scenario.
I'll try to dig deeper and see if I can isolate the issue, but I thought it was good to start a discussion around this. By the way, all the above is happening
with the latest Scala IDE nightly for Scala 2.10.x. Or, more specifically, Scala IDE 4.0.0.nightly-2_10-201309240521-ec13fb7 (which ships with the incremental compiler of sbt v0.13.0).
This is likely an issue in Sbt. I'm opening the bug here so that we can keep track of it, Grzegorz (Kossakowski) will have a look at it.
This can be currently reproduced using scala-ide master branch (I am using this commit).
Steps to reproduce it:
1. Comment Cached.initialized, save and let the builder compiling the project
2. Uncomment the above method, save and let the builder compiling the project
Now, if you repeat the above two steps for a few times, you'll eventually get in the state where the build compiler reports
a compilation error after step 2, which of course should never happen. In my tests, it looks like this happens cyclically, i.e.,
one time it works fine, and the other it breaks, and so on.
The reported error is: value initialized is not a member of scala.tools.eclipse.util.Cached[Option[scala.tools.eclipse.ScalaPresentationCompiler]]
Note that when the error is reported, the Cached classfile indeed does NOT contain the `initialized` method. And this, despite step 2 was performed.
So, how come we uncommented Cached.initialized, and still that method is not in the produced binary? That made me wonder if compilation fails because one
of the classes calling on Cached.initialized is being compiled with a not up-to-date Cached source file. Just a shoot in the air, but that's my best guess at the moment.
Another interesting fact is that when the build compiler reports the erroneous compilation error (i.e., we are after step 2), if you execute again step 1, i.e.,
commenting Cached.initialized, nothing happens. No entry in the log, nothing, just like the method was never there...
Last piece of information. When you get the faulty compilation error, if you type a space anywhere in the Cached source file and hit save, the build
compiler kicks-in again and this time compilation succeeds.
And finally, here is a link to a folder containing the IDE log after running step 2 alone, with `debugIncremental` flag enabled. 'good-compilation' is for
the project compiles fine, while 'bad-compilation' is for the buggy scenario.
I'll try to dig deeper and see if I can isolate the issue, but I thought it was good to start a discussion around this. By the way, all the above is happening
with the latest Scala IDE nightly for Scala 2.10.x. Or, more specifically, Scala IDE 4.0.0.nightly-2_10-201309240521-ec13fb7 (which ships with the incremental compiler of sbt v0.13.0).
This is likely an issue in Sbt. I'm opening the bug here so that we can keep track of it, Grzegorz (Kossakowski) will have a look at it.
Leave a comment
on 2013-10-17 12:21 *
By Mirco Dotta
Description changed from In short, I can make the bu... to In short, I can make the bu...