package-info

Andrew John Hughes gnu_andrew at member.fsf.org
Tue Nov 3 13:55:01 PST 2009


2009/11/3 Jonathan Gibbons <Jonathan.Gibbons at sun.com>:
> Currently, javac does not generate package-info.class when package-info.java
> contains no annotations.
>
> This can cause issues for build systems that assume that for every *.java
> file, the compiler ought to generate a corresponding *.class file.
>
> It appears that Ant 1.8 has apparently taken it upon itself to "work around"
> this issue, by generating package-info.class if javac does not. Does anyone
> have any opinions as to whether this is a good or bad idea? Is this
> something that should really be fixed in javac, perhaps as an optional
> behavior?
>
> -- Jon
>
>
>

What would such a class contain? Presumably it would be just an empty
shell, with just a single no-argument constructor?

The package-info.java (and module-info.java) are a bit of a hack as
pseudo-Java classes to begin with, so it doesn't surprise me all that
much that another hack is needed to make them indistinguishable from
normal classes.
-- 
Andrew :-)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net

PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint: F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8



More information about the compiler-dev mailing list