Skip to content

Commit 9ffac2c

Browse files
8022744: javac -Xpkginfo command's documentation is sparse
Reviewed-by: darcy
1 parent 50d89c0 commit 9ffac2c

File tree

1 file changed

+23
-1
lines changed
  • langtools/src/share/classes/com/sun/tools/javac/main

1 file changed

+23
-1
lines changed

langtools/src/share/classes/com/sun/tools/javac/main/Option.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ public boolean process(OptionHelper helper, String option, String arg) {
389389

390390
XPREFER("-Xprefer:", "opt.prefer", EXTENDED, BASIC, ONEOF, "source", "newer"),
391391

392+
// see enum PkgInfo
392393
XPKGINFO("-Xpkginfo:", "opt.pkginfo", EXTENDED, BASIC, ONEOF, "always", "legacy", "nonempty"),
393394

394395
/* -O is a no-op, accepted for backward compatibility. */
@@ -686,7 +687,28 @@ private String helpSynopsis(Log log) {
686687

687688
// For -XpkgInfo:value
688689
public enum PkgInfo {
689-
ALWAYS, LEGACY, NONEMPTY;
690+
/**
691+
* Always generate package-info.class for every package-info.java file.
692+
* The file may be empty if there annotations with a RetentionPolicy
693+
* of CLASS or RUNTIME. This option may be useful in conjunction with
694+
* build systems (such as Ant) that expect javac to generate at least
695+
* one .class file for every .java file.
696+
*/
697+
ALWAYS,
698+
/**
699+
* Generate a package-info.class file if package-info.java contains
700+
* annotations. The file may be empty if all the annotations have
701+
* a RetentionPolicy of SOURCE.
702+
* This value is just for backwards compatibility with earlier behavior.
703+
* Either of the other two values are to be preferred to using this one.
704+
*/
705+
LEGACY,
706+
/**
707+
* Generate a package-info.class file if and only if there are annotations
708+
* in package-info.java to be written into it.
709+
*/
710+
NONEMPTY;
711+
690712
public static PkgInfo get(Options options) {
691713
String v = options.get(XPKGINFO);
692714
return (v == null

0 commit comments

Comments
 (0)