Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ doesn't recognize Java enum [closed]

I'm working with IntelliJ 14.1.4 and Java SDK 1.8. I've created an Enum but IntelliJ is not recognizing the code and it's showing the following error:

'class' os 'interface' expected

enter image description here

Are enum not supported by IntelliJ???

like image 795
Rafa Romero Avatar asked Jan 05 '23 19:01

Rafa Romero


1 Answers

The issue is solved configuring a correct language level. In the case of enums, as enums are available since Java 1.5, the language level should be at least 5.

To configure the language level in IntelliJ go to File > Project Structure > Project Settings > Project > Project language level To ensure the chagnes are applied, restart IntelliJ, although in my case it wasn't necessary

enter image description here

like image 74
Rafa Romero Avatar answered Jan 07 '23 08:01

Rafa Romero