TheLQ
TheLQ

Reputation: 15008

Javadoc: package.html or package-info.java

When trying to create package level Javadoc comments, whats the preferred method? What do you do?

package-info.java

package.html


For me, I've always used Package.html. But I'm wondering if its the correct choice.

Upvotes: 238

Views: 94565

Answers (1)

trashgod
trashgod

Reputation: 205785

package-info.java: "This file is new in JDK 5.0, and is preferred over package.html."—javadoc - The Java API Documentation Generator

Addendum: The big difference seems to be package annotations. There's a little more in the way of rationale in 7.4 Package Declarations.

Addendum: The annotation feature is also mentioned here and in Javadoc tip: Prefer package-info to package.html, cited here.

Addendum: See also What’s package-info.java for?.

Upvotes: 278

Related Questions