Eclipse Juno - What is the use of package-info.java?

前端 未结 3 567
伪装坚强ぢ
伪装坚强ぢ 2020-12-09 02:06

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

相关标签:
3条回答
  • 2020-12-09 02:08

    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.

    0 讨论(0)
  • 2020-12-09 02:13

    package-info.java file contains package level documentation as well as annotations.

    0 讨论(0)
  • 2020-12-09 02:27

    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.

    0 讨论(0)
提交回复
热议问题