Remove Deprecation Warnings on Import Statements



1) Remove Deprecation Warnings on Import Statements
In java 8 java compilers issue deprecation warnings when >
  • deprecated type is imported by name or
  • deprecated method is imported statically,
  • deprecated field is imported statically,
  • deprecated nested type is imported statically.

These deprecated warnings will be removed in java 9 because they are not informative.

So, deprecation warnings on imports cannot be suppressed using the @SuppressWarnings annotation.

2) Where deprecation warnings will remain?
Deprecation warnings at actual uses of deprecated members will remain.

3) Advantage of removing Deprecation Warnings on Import Statements >
Projects having large code bases will be much clean after removal of these short deprecated warnings.

4) In more detail about Removing Deprecation Warnings on Import Statements >
Java compiler will issue deprecation warning when any of the following are overridden, invoked, or referenced by name >
  • @Deprecated type,
  • @Deprecated method,
  • @Deprecated field, or
  • @Deprecated constructor
Java compiler will NOT issue deprecation warning when any of the above are >
  • Used in @Deprecated entity.
  • Used in entity annotated with @SuppressWarnings("deprecation")
  • The use and declaration are both within the same outermost class.






Having any doubt? or you liked the tutorial! Please comment in below section.
Please express your love by liking JavaMadeSoEasy.com (JMSE) on facebook, following on google+ or Twitter.


RELATED LINKS>

varHandle (variable handle) in java 9

Improve Locking performance in java 9

JVM logging system in Java 9 - Levels, tags, output, rotation, decoration


Static keyword in java - variable, method, class, block - 24 salient features



Labels: Core Java Java 9
eEdit
Must read for you :