Scala warnings, IntelliJ and compiler flags

I am currently using the IntelliJ Scala plugin and one thing is causing me a bit. When compiling, I get 3 warnings.

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

Why does this give me warnings that files are recompiling? Could this be turned off? And finally, what's with an empty warning ?: D

+6
source share
3 answers

In IntelliJ 14:

  • Bring preferences Intellij IDEA > Preferences or cmd + ,
  • Check out the Scala Compiler . Alternatively, this is under Build, Execution, Deployment > Compiler > Scala Compiler
  • Check the option Deprecation warnings

Rebuild your project!

Screenshot of preferences to enable deprecation flag.

+20
source

I would like to add a few words about the warnings and errors that IntelliJ IDEa reports.

JetBrains uses its own scala analyzer to identify and report errors. Sometimes it reports false errors or warnings. I think this is due to the fact that scala is a much more complex language from compilers, and then many other languages. Even if the entire official scala specification was implemented, there are some cases that were omitted (read: there are always some errors). If you find that IntelliJ IDEa has an error / warning message that is suitable for the scalac compiler, you can always try to report it as an error (IntelliJ IDEa supports reporting errors). The guys at JetBrains will fix this.

More than some scala libraries use macros, which are compiler extensions, which adds some additional compiler behavior. If the IDE knows its specification, they will not identify these non-standard codes as errors. It is better to know about it. I think the same goes for the Eclipse scala IDE.

To summarize the above: Don’t trust all the warnings and errors that IntelliJ or another IDE tells you if they are not compiled using scalac.

+6
source

JVM parameters are not compiler parameters β€” they are first used to actually run your code, and then used to compile it into bytecode. You need to open the project settings and configure the settings there:

enter image description here

+5
source

Source: https://habr.com/ru/post/956701/


All Articles