Presentation Compiler reports false positive for package private members
Say you have the following
Make sure to have both files opened in Eclipse.
Do a full clean-build, and the following (correct) error is reported method apply in object B cannot be accessed in object b.B
Now, remove the private[b] access qualifier from B.apply, an hit save. The incremental compiler kicks in and the error is no longer reported in the Problems view, which is correct. However, if you look at the editor for A.scala, you'll see that the error is still present in the editor. This is wrong, and 99.9% it's a bug in the presentation compiler.
The only workaround at the moment is to do a full clean-build to force the Presentation Compiler to restart. After this, the false error reported in the editor is removed.
We should check if this is a regression in 2.10.0, or the bug existed in 2.9 as well. And a ticket should be opened in the Scala issue tracker, it would be good if this could be fixed in time for 2.10.2 (I believe it's too late for 2.10.1...)
// a/A.scala
package a
import b.B
class A {
b.B()
}
//b/B.scala
package b
object B {
private[b] def apply(): Any = new Object
}
Make sure to have both files opened in Eclipse.
Do a full clean-build, and the following (correct) error is reported method apply in object B cannot be accessed in object b.B
Now, remove the private[b] access qualifier from B.apply, an hit save. The incremental compiler kicks in and the error is no longer reported in the Problems view, which is correct. However, if you look at the editor for A.scala, you'll see that the error is still present in the editor. This is wrong, and 99.9% it's a bug in the presentation compiler.
The only workaround at the moment is to do a full clean-build to force the Presentation Compiler to restart. After this, the false error reported in the editor is removed.
We should check if this is a regression in 2.10.0, or the bug existed in 2.9 as well. And a ticket should be opened in the Scala issue tracker, it would be good if this could be fixed in time for 2.10.2 (I believe it's too late for 2.10.1...)
Leave a comment