As mentioned by @muymoo before, you could use a package-info.java
file. But all you can do is add a @deprecated
warning in the JavaDoc of your file:
/**
* @deprecated This package is deprecated, use {@link my.new.pkg} instead.
*/
package my.old.pkg;
JavaDoc is really your only option here, you cannot @Deprecate
the package using a "proper" in-code annotation
@Deprecated
package my.old.pkg;
will lead to a compilation error in Java 8
$ java -version
java version "1.8.0_191"
$ javac package-info.java
package-info.java:6: error: modifier deprecated not allowed here
The only real, clean option here is to really deprecate all the classes in your package. Which does make sense, if you think about it, because a package in Java is nothing more then a namespace.