I am using a Java 10 API in my source code, when I try to compiler this code with maven and idea, it throws an error:
// I use this Java 10 API
URLDecoder.decode(query, StandardCharsets.UTF_8)
// throw this error
Error:(10, 73) java: incompatible types: java.nio.charset.Charset cannot be converted to java.lang.String
My Env:
JDK 10
maven: 3.6
IDEA
I was fine if I remove this API.
And I do follow things:
- add compiler option to pom
<maven.compiler.target>10</maven.compiler.target>
<maven.compiler.source>10</maven.compiler.source>
change IDEA language level to java10
File -> Project Struct -> Module -> Language Level
Above two do not work.