changeset 1987:96b6865eda94

8022744: javac -Xpkginfo command's documentation is sparse Reviewed-by: darcy
author jjg
date Thu, 29 Aug 2013 12:11:36 -0700
parents 9c0e192c0926
children fcd768844b99 23f0f3c9c44a
files src/share/classes/com/sun/tools/javac/main/Option.java
diffstat 1 files changed, 23 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/main/Option.java	Thu Aug 29 12:03:28 2013 -0700
+++ b/src/share/classes/com/sun/tools/javac/main/Option.java	Thu Aug 29 12:11:36 2013 -0700
@@ -389,6 +389,7 @@
 
     XPREFER("-Xprefer:", "opt.prefer", EXTENDED, BASIC, ONEOF, "source", "newer"),
 
+    // see enum PkgInfo
     XPKGINFO("-Xpkginfo:", "opt.pkginfo", EXTENDED, BASIC, ONEOF, "always", "legacy", "nonempty"),
 
     /* -O is a no-op, accepted for backward compatibility. */
@@ -686,7 +687,28 @@
 
     // For -XpkgInfo:value
     public enum PkgInfo {
-        ALWAYS, LEGACY, NONEMPTY;
+        /**
+         * Always generate package-info.class for every package-info.java file.
+         * The file may be empty if there annotations with a RetentionPolicy
+         * of CLASS or RUNTIME.  This option may be useful in conjunction with
+         * build systems (such as Ant) that expect javac to generate at least
+         * one .class file for every .java file.
+         */
+        ALWAYS,
+        /**
+         * Generate a package-info.class file if package-info.java contains
+         * annotations. The file may be empty if all the annotations have
+         * a RetentionPolicy of SOURCE.
+         * This value is just for backwards compatibility with earlier behavior.
+         * Either of the other two values are to be preferred to using this one.
+         */
+        LEGACY,
+        /**
+         * Generate a package-info.class file if and only if there are annotations
+         * in package-info.java to be written into it.
+         */
+        NONEMPTY;
+
         public static PkgInfo get(Options options) {
             String v = options.get(XPKGINFO);
             return (v == null