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.
Labels: Java 9