Scala warnings, IntelliJ and compiler flags

前端 未结 3 1667
悲哀的现实
悲哀的现实 2021-02-20 04:26

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 file         


        
相关标签:
3条回答
  • 2021-02-20 04:40

    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:

    0 讨论(0)
  • 2021-02-20 04:48

    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.

    0 讨论(0)
  • 2021-02-20 05:00

    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.

    0 讨论(0)
提交回复
热议问题