JustDanyul
JustDanyul

Reputation: 14044

Scala warnings, IntelliJ and compiler flags

I'm currently giving the IntelliJ Scala plugin a spin and one thing is bugging me a wee-bit. I get 3 warnings when compiling.

Warning: scala: Recompiling 4 files
Warning: scala:
Warning: scala: there were 1 deprecation warnings; re-run with -deprecation for details

Why does it give me warnings that files are being recompiled? Can that be turned off? And finally, what's with the empty warning? :D

Upvotes: 12

Views: 8801

Answers (3)

om-nom-nom
om-nom-nom

Reputation: 62835

JVM parameters isn't compiler parameters -- first are used to actually run your code, later used to just compile it to bytecode. You need to open project settings and adjust options there:

enter image description here

Upvotes: 5

katfang
katfang

Reputation: 2030

In IntelliJ 14:

  1. Bring up preferences Intellij IDEA > Preferences or cmd + ,
  2. Look up Scala Compiler. Alternatively, it's under Build, Execution, Deployment > Compiler > Scala Compiler
  3. Check the option for Deprecation warnings

Rebuild your project!

Screenshot of preferences to enable deprecation flag.

Upvotes: 25

pawel.panasewicz
pawel.panasewicz

Reputation: 1833

I would like to add few words about warnings and errors reported by IntelliJ IDEa.

JetBrains uses it's own scala analyzer to identify and report errors. Sometimes it reports fake errors or warnings. I think this is because scala is much more complicated language from compilers point of view then much of other languages. Even if all official scala specification was implemented there are some cases which have been omited (read: There always are some bugs). If you find something reported as error/warning by your IntelliJ IDEa which is ok for scalac compiler you can always try to report it as a bug (IntelliJ IDEa supports reporting bugs). Guys from JetBrains will fix it.

More over some scala libraries use macros that are compiler extentions which adds some extra compiler behaviour. If IDE did know their specification it wouldn't identify these non standard codes as errors. It's better to be aware of that. I think the same touches Eclipse scala IDE.

Summarizing all above: Do not trust all warnings and errors that IntelliJ or other IDE is telling you unless it compiles well using scalac.

Upvotes: 7

Related Questions