This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libgcj/23288] java.lang.Class's #getPackage() returns null
- From: "tromey at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Sep 2005 18:35:36 -0000
- Subject: [Bug libgcj/23288] java.lang.Class's #getPackage() returns null
- References: <20050808185414.23288.martin@egholm-nielsen.dk>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From tromey at gcc dot gnu dot org 2005-09-09 18:35 -------
Note also that Package.getVersion fails when the class file comes from a
jar. With the included example you can see this by making a manifest file
(in my example named "J/Man"):
Main-Class: men.gcjpackage.TestPackage
Name: men/gcjpackage/
Specification-Title: JChemPaint
Specification-Version: 2.0
Specification-Vendor: The JChemPaint Project
Implementation-Title: jchempaint
Implementation-Version: 2.0.12
Implementation-Vendor: The JChemPaint Project
Then make a jar:
jar -cv -m J/Man -f J/men.jar men/gcjpackage/*.class
And change the test to:
package men.gcjpackage;
public class TestPackage
{
public static void main(String[] args)
{
System.out.println("ClassLoader: " + TestPackage.class.getClassLoader() );
Package x = TestPackage.class.getPackage();
System.out.println("Package: " + x);
System.out.println("Version: " + x.getImplementationVersion());
} // main
} // TestPackage
With the JDK the last line prints:
Version: 2.0.12
With gij it prints:
Version: null
As the names suggest, this prevents JChemPaint from working:
http://almost.cubic.uni-koeln.de/cdk/jcp
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23288