Tuesday 17 January 2017

Java9: No More Deprecation Warnings for Imports

Prior to Java9, Java compiler issue deprecation warnings when a deprecated type is imported by name or when a deprecated member (method, field, and nested type) is imported statically.

From Java9 onwards, Java compiler don't issue deprecated warning for importing if packages, but Deprecation warnings at actual uses of deprecated members should remain.

Test.java
import java.io.StringBufferInputStream;

public class Test{

}

Compile above application in Java8, you will get following warnings.
$javac Test.java
Note: Test.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.


Now compile the same application using java9 compiler, you will not see above warnings.



Previous                                                 Next                                                 Home

No comments:

Post a Comment