Suppress javac warning “…is internal proprietary API and may be removed in a future release”

前端 未结 7 1909
悲哀的现实
悲哀的现实 2020-11-30 08:09

When I compile the Spring JDBC source on OS X with JDK 1.7.0, I get this warning:

warning: CachedRowSetImpl is internal proprietary API and may be removed in         


        
7条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-30 08:59

    see this answer

    Cannot stop ant from generating compiler Sun proprietary API warnings

    Testing code

    @SuppressWarnings("sunapi")
    sun.security.x509.X509CertImpl test;
    

    compiling command line

    javac test.java -Werror -Xlint:sunapi -XDenableSunApiLintControl
    

    or

    javac test.java -Werror -Xlint:all -XDenableSunApiLintControl
    

    compile passed without any warnings

    remove the SuppressWarnings tag and compile again:

    an error is reported then

    test.java:4: warning: X509CertImpl is internal proprietary API and may be removed in a future release
            sun.security.x509.X509CertImpl test;
                         ^
    error: warnings found and -Werror specified
    1 error
    1 warning
    

提交回复
热议问题