Different behaviours when running a full rebuild and building incrementally

Hi,
In case of projects containing both Java and Scala files it's possible to don't have any warning in case of a full rebuild and get deprecation warnings related to Java when building incrementally. It's esp. problematic when one uses -Xfatal-warnings.

The minimal reproduction:

1. Create two files.
J.java

public class J {
    @Deprecated
    public static void foo
() {}
}


S.scala

class S {
  J.foo()
}


2. Make project (for the first time) or Rebuild Project. Everything is okay and the Messages view is even not shown.

3. Now add some blank line in S.scala and start build:
Warning (or obviously Error in case of -Xfatal-warnings):scalac: there was one deprecation warning; re-run with -deprecation for details

4. Then Rebuild Project and, again, there are no warnings.

Currently I use IntelliJ 15.0.2 with Scala plugin 2.0.4 but I saw this previously also with IntelliJ 14.

Just in case - having "Enable warnings" unchecked or explicit -deprecation:false is a workaround but it's not a solution. Also sometimes it's not so simple to just get rid of deprecated code (or it's the responsibility of someone else).

Probably I could just create an issue in your issue tracker, but anyway I'd like to understand what do you do differently when running the full build and when building incrementally. For instance in case of gradle's build from cmd and with -Xfatal-warnings enabled it was never failing - no matter whether building from scratch or incrementally.

Cheers,
Michał

0
2 comments

Ah, ok. It looks it's not IntelliJ-specific but it's more something with scalac/sbt. As I checked, the behaviour is exactly the same in case of sbt build from cmd  (unlike in case of gradle) and Scala IDE.

Cheers,
Michał

0
Avatar
Permanently deleted user

Yes, it seems that scalac emit deprecation warnings if deprecated members are from classpath. If class is compiled in the same compilation run, there are no such warnings.

0

Please sign in to leave a comment.