@Override is not allowed when implementing interface method
JavaExtjsIntellij IdeaOverridingGxtJava Problem Overview
I have the problem mentioned in the title. You could say that this thread duplicates another one: How do I turn off error validation for annotations in IntelliJ IDEA?
But the solution given there doesn't work. They say that I need to take the following action:
> In the Project Structure | Project dialog, change the Project language Level to 6.0 - @Override in interfaces.
However, the Project language Level is 6.0 at the moment, but I still see the error.
Vic, here is the window and there is no JVM version right under Language level (unfortunately I can't post images because I have 10 reputation)
Java Solutions
Solution 1 - Java
If your project has multiple modules, also check that every module uses language level 6 or above, or use the project's language level (see Project Settings > Modules > xxx > Language level
).
You may need to reload your project once it is modified.
Solution 2 - Java
At your module/project, Right click to see context menu:
Choose Open Module Settings
or press F4. In setting windows:
Set value for Choose Language level
section.
You also should check Project language level
by this way: press Ctrl+Alt+Shift+S
Solution 3 - Java
A simpler solution - inline
- Put the caret on the
@Override
word and move the caret on the left side until the red bulb icon will appear. Then click on it.
- Click on Set language level to 6 - Override in interfaces
The method above is an alternative to the following approach:
- Go to File > Project Structure... or press Ctrl+Alt+Shift+S
- Go to Project Settings > Modules > Sources > Language level and choose any level that is 6 or greater than 6.
Solution 4 - Java
If you are using maven, add maven compiler plugin to the project's pom.xml file.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
This solved the issue for me.
Solution 5 - Java
There's also a language level for every module. Please check your module settings in the Project Structure.
Solution 6 - Java
I ran into this problem for the first time while using a multi module maven project. As other answers / IDE suggested, we need to set the language level.
Rather than changing the setting of IDE, to make the project IDE agnostic, I update the parent pom with below properties, which solved the issue.
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
Solution 7 - Java
In JIdea 2020.1.2 and above,
- Go to Project Structure [ Ctrl+Alt+Shift+S ]
- Select Modules sub section
- Select each module
- Under sources-section, check Language Level
- Change the Language Level as required
NOTE:
If you get below error after this change,
Error:java: Compilation failed: internal java compiler error
You have to change the target bytecode version as well.
- Go to Settings [ Ctrl+Alt+S ]
- Select Java Compiler
- Select module in the table
- Change the byte-code version to map what you selected in the previous step for language-level