Pattern: Import from illegal package
Issue: -
By default this rule rejects all sun.*
packages since they are internal APIs: they are subject to change in a undocumented or unsupported way and they are bound to a specific JRE/JDK (Sun in this case), limiting portability of your programs.
Try to avoid uses of such APIs, always prefer a public documented and specified class.
<module name="IllegalImport"/>
Example of incorrect code:
import sun.misc.Cleaner;
Example of correct code:
import java.lang.ref.Cleaner; // standard replacement for sun.misc.Cleaner