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

前端 未结 8 1175
我寻月下人不归
我寻月下人不归 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:21

    If you are using Gradle, don't forget to make sure the following is set to 1.8 and not 1.5 (for instance for some bizarre reason in Intelij it defaults to 1.5) so no matter what you do at the project level to set the compiler compatibility level, this setting will cause it to continue giving you trouble with Java 8 features that it would not recognize:

    version '1.0-SNAPSHOT'
    
    apply plugin: 'groovy'
    apply plugin: 'java'
    
    sourceCompatibility = 1.8
    

提交回复
热议问题