As i am aware, the _
for unnamed variables has been a preview feature [java:21] later released with JDK 22.
This is the code in question
char[] _ = { 'b', 'o', 'b' };
However i get this error
[ERROR] '_' is a keyword from source level 9 onwards, cannot be used as identifier
Now i had assumed that its a issue with the JDK version Maven is set to build with
so i changed pom.xml
<properties>
<maven.compiler.source>22</maven.compiler.source>
<maven.compiler.target>22</maven.compiler.target>
</properties>
And that hasn’t resolved the issue – so i rather thought of checking it with mavens –show-version:
Maven home: [maven path]
Java version: 22.0.1, vendor: Amazon.com Inc., runtime: [my path]/java/22.0.1-amzn
Default locale: [locale]
OS name: [os info]
for the sake of simplicity i’ve removed some info
So how do i go about resolving this error?