Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Controlling false IntelliJ code editor error in Scala plugin

I have Java code generated from ANTLR4. Scala is using the Java code by extending some of the methods. The issue is that IntelliJ's scala plugin does not seem to know the relationship between Java base class and Scala subclass to show a false positive error message; it reports "Method ... overrides nothing" when Scala overrides Java method.

How to control the error level in IntelliJ to suppress this error message?

enter image description here

like image 624
prosseek Avatar asked Apr 17 '16 17:04

prosseek


People also ask

How do I get Scala plugin in IntelliJ?

To install Scala plugin, press Ctrl+Alt+S , open the Plugins page, browse repositories to locate the Scala plugin, click Install and restart IntelliJ IDEA. Now you can successfully check out from VCS, create, or import Scala projects.

How do I change the Scala version in IntelliJ?

In most cases your project JDK is not compatible with Scala or sbt version, try to change the Scala Compile Server SDK. Press Ctrl+Alt+S to open Settings/Preferences dialog. From the options on the left, select Build, Execution, Deployment | Compiler | Scala | Scala Compiler Server.


1 Answers

Most of the false-negatives produced by Scala plugin are caused by type-aware highlighting:

enter image description here

Now you pressing on this icon you can disable it everywhere and your error will be gone, but that means that you'll lose your type validation everywhere.

There is less radical approach. According to IntelliJ documentation, enclosing your code in /*_*/ ... /*_*/, allows to disable type-aware highlighting locally.

For example:

class Test {
}

class Test1 {
  /*_*/
  override def foo = 1
  /*_*/
}

In this case, override def foo will not be highlighted.

like image 196
Aivean Avatar answered Oct 13 '22 21:10

Aivean