|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
package-infoCurrently, 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 |
|
|
Re: package-info2009/11/3 Jonathan Gibbons <Jonathan.Gibbons@...>:
> 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 |
|
|
Re: package-info
Andrew John Hughes wrote:
Yes, it would presumably be an empty shell class.2009/11/3 Jonathan Gibbons Jonathan.Gibbons@...: -- Jon |
|
|
Re: package-info
On 11/03/09 02:35 PM, Jonathan Gibbons wrote:
Andrew John Hughes wrote:Yes, it would presumably be an empty shell class.2009/11/3 Jonathan Gibbons Jonathan.Gibbons@...: Yes, no constructor need be present; here is the verbose javap output from a package-info file with an annotation: javap -verbose package-info.class Classfile /home/darcy/Scratch/package-info.class Last modified Nov 3, 2009; size 109 bytes MD5 checksum dfc45af5b7a94a2f4bdf5c42ba29eafc Compiled from "package-info.java" interface foo.package-info SourceFile: "package-info.java" minor version: 0 major version: 51 flags: ACC_INTERFACE, ACC_ABSTRACT, ACC_SYNTHETIC Constant pool: #1 = Class #5 // "foo/package-info" #2 = Class #6 // java/lang/Object #3 = Utf8 SourceFile #4 = Utf8 package-info.java #5 = Utf8 foo/package-info #6 = Utf8 java/lang/Object { } -Joe |
| Free embeddable forum powered by Nabble | Forum Help |