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?
Bu
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.
Open Module Settings
Choose Language level
You also should check Project language level by this way: press Ctrl+Alt+Shift+S
Project language level