I had the same error.
In your pom.xml file locate:
"
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
"
and change the <release>11</release>
to
<release>17</release>
Reload maven.
This fixes the error.