Intellij - Unable to use newer Java 8 classes - Error : “Usage of API documented as @since 1.6+..”

前端 未结 8 1179
我寻月下人不归
我寻月下人不归 2020-11-28 19:00

I\'m trying to use a java.lang.function.Function in my java 8 code base, but i keep getting the following error in Intellij.

Usage of API

8条回答
  •  误落风尘
    2020-11-28 19:23

    Edited the answer based on Bastien Jansen comment.

    Seems that there is another project setting that affects the compiler level. A subtle indication of this problem is when your compiler starts complaining of the source and target java version being different from the one you specified while you are compiling the code

    Warning:java: source value 1.5 is obsolete and will be removed in a future release
    Warning:java: target value 1.5 is obsolete and will be removed in a future release
    Warning:java: To suppress warnings about obsolete options, use -Xlint:-options.
    

    To get rid of this, you need to open up

    File -> Project Structure -> Project Settings -> Modules -> "Your Module Name" -> Sources -> Language Level

    and change that to the desired level i.e 1.8 or the Project Default language level

提交回复
热议问题