When a new package is being created in Eclipse Juno, a java file (package-info.java) would be created automatically. What is the use of that file? Is it useful in importing
It can be used for documentation on package level. For instance, the Spring Team uses it quite extensively in the core of the Spring Framework.
Beside that, it can contain annotations that apply to all classes in the package. For instance, it is a convenient way to avoid writing the NonNullByDefault annotations for the Eclipse Null Analysis on each class.
Note that for applying an annotation to a package, a file by the name package-info.java is used.
package-info.java file contains package level documentation as well as annotations.
package-info.java
is a package comment file, used by Javadoc for giving your package its own documentation.
It was introduced in Javadoc 5.0, and replaces package.html
.