Usage of API documented as @since 1.6 + ...... solution

When using the Java scripting language javax.script package, project error, error reads as follows:

Usage of API documented as @since 1.6+ This inspection finds all usages of methods that have @since tag in their documentation. This may be useful when development is performed under newer SDK version as the target platform for production

Problem Solution: Open the project configuration, modify the language level of 6 or higher version to
File -> Project Structure-> Project Settings -> Modules -> ( need to modify the project name) -> Sources -> Language Level- > 6 election or later.

Here the problem has been resolved, want to continue to understand the root of the problem students continue:

Firstly, given the information, this is due to the use jdk characteristics of the current development environment can not be resolved, javax.script Java6 is a new feature added, it may lower the current development environment version.
Open the project's Properties window (Ctrl + Alt + shift + S ):

The current JDK version 1.7, this is nothing wrong with the following language level and also select the JDK version of the same, but why would an error? Then look engineering configuration information:

从这里可以看出工程的language level还是5.0,这也就解释了为什么使用javax.script会报错了,把这里的language level改成6以上的版本,确认后就OK了。

那么还有一个疑问,那就是我明明在项目配置中设置了language level为7,为什么到了module中就变成5了呢?

这里面就是项目和工程的区别了,在maven中每个工程有各自的pom.xml配置,如果不在pom.xml中进行配置的话,工程的language level默认为5,可以在pom中进行该项设置

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version>
    <configuration>
        <source>1.7</source>
        <target>1.7</target>
        <encoding>utf-8</encoding>
    </configuration>
</plugin>

 

Guess you like

Origin www.cnblogs.com/wpcnblog/p/12358143.html