Nicolas Geoffray wrote:
That's what I thought too in the first place, but the
ClassLoader.getPackage calls the parent loader's getPackage
method. If the parent is null, then it calls
VMClassLoader.getPackage().
If VMClassLoader.getPackage had to add the package given as
parameter, then all packages (system + applications) would be
defined in VMClassLoader.definedPackages.
I hope I'm clear enough.
The suggestion you gave for getPackages (having all bootstrap packages
in VMClassLoader.definedPackages at startup) could remove the
additional VMClassLoader.getVMPackage. Maybe that's a better solution?
(Sun does it)
Ah, I see what you mean now. In my VM I also have a full list of the
packages defined by the boot class loader, so there my approach does
work (I just tested it). I can't think of any other way to solve this,
there should be a native method that returns a String[] with the native
package names.