Re: [cp-patches] RFC: change in VMClassLoader to define boot packages
Hi, the patch is committed. Now that fastjar has its own home on savannah, the patch to support the -i option should be incorporated soon and we'll be able to add the creation of the index to the glibj.zip by default. regards +Olivier Nicolas Geoffray wrote: Hi Oliver, This is fine for me. About the Index.list file, maybe we should force it to be in glibj.zip? Best, Nicolas Olivier Jolly wrote: Hi, in the VMClassLoader reference file, we have a method to define boot packages and tell vm implementors that they may override it. I propose this patch to use the META-INF/INDEX.LIST in the glibj.zip file (if this entry exists) to predefine boot packages as all packages found in this archive. Thanks for the feedback. Regards +Olivier 2006-04-13 Olivier Jolly [EMAIL PROTECTED] * vm/reference/java/lang/VMClassLoader.java (getBootPackages): Loads boot packages list from the META-INF/INDEX.LIST file if it exists. Index: VMClassLoader.java === RCS file: /sources/classpath/classpath/vm/reference/java/lang/VMClassLoader.java,v retrieving revision 1.34 diff -u -r1.34 VMClassLoader.java --- VMClassLoader.java2 Mar 2006 00:36:44 -1.34 +++ VMClassLoader.java13 Apr 2006 19:32:24 - @@ -1,6 +1,6 @@ /* VMClassLoader.java -- Reference implementation of native interface required by ClassLoader - Copyright (C) 1998, 2001, 2002, 2004, 2005 Free Software Foundation + Copyright (C) 1998, 2001, 2002, 2004, 2005, 2006 Free Software Foundation This file is part of GNU Classpath. @@ -39,17 +39,21 @@ package java.lang; -import gnu.classpath.SystemProperties; import gnu.classpath.Configuration; +import gnu.classpath.SystemProperties; +import java.io.BufferedReader; import java.io.File; import java.io.IOException; +import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; import java.security.ProtectionDomain; import java.util.Enumeration; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import java.util.StringTokenizer; import java.util.Vector; import java.util.zip.ZipFile; @@ -235,12 +239,46 @@ /** * Returns a String[] of native package names. The default - * implementation returns an empty array, or you may decide - * this needs native help. + * implementation tries to load a list of package from + * the META-INF/INDEX.LIST file in the boot jar file. + * If not found or if any exception is raised, it returns + * an empty array. You may decide this needs native help. */ private static String[] getBootPackages() { -return new String[0]; +URL indexList = getResource(META-INF/INDEX.LIST); +if (indexList != null) + { +try + { +Set packageSet = new HashSet(); +String line; +int lineToSkip = 3; +BufferedReader reader = new BufferedReader( + new InputStreamReader( + indexList.openStream())); +while ((line = reader.readLine()) != null) + { +if (lineToSkip == 0) + { +if (line.length() == 0) + lineToSkip = 1; +else + packageSet.add(line.replace('/', '.')); + } +else + lineToSkip--; + } +reader.close(); +return (String[]) packageSet.toArray(new String[packageSet.size()]); + } +catch (IOException e) + { +return new String[0]; + } + } +else + return new String[0]; }
Re: [cp-patches] RFC: change in VMClassLoader to define boot packages
Hi Oliver, This is fine for me. About the Index.list file, maybe we should force it to be in glibj.zip? Best, Nicolas Olivier Jolly wrote: Hi, in the VMClassLoader reference file, we have a method to define boot packages and tell vm implementors that they may override it. I propose this patch to use the META-INF/INDEX.LIST in the glibj.zip file (if this entry exists) to predefine boot packages as all packages found in this archive. Thanks for the feedback. Regards +Olivier 2006-04-13 Olivier Jolly [EMAIL PROTECTED] * vm/reference/java/lang/VMClassLoader.java (getBootPackages): Loads boot packages list from the META-INF/INDEX.LIST file if it exists. Index: VMClassLoader.java === RCS file: /sources/classpath/classpath/vm/reference/java/lang/VMClassLoader.java,v retrieving revision 1.34 diff -u -r1.34 VMClassLoader.java --- VMClassLoader.java 2 Mar 2006 00:36:44 - 1.34 +++ VMClassLoader.java 13 Apr 2006 19:32:24 - @@ -1,6 +1,6 @@ /* VMClassLoader.java -- Reference implementation of native interface required by ClassLoader - Copyright (C) 1998, 2001, 2002, 2004, 2005 Free Software Foundation + Copyright (C) 1998, 2001, 2002, 2004, 2005, 2006 Free Software Foundation This file is part of GNU Classpath. @@ -39,17 +39,21 @@ package java.lang; -import gnu.classpath.SystemProperties; import gnu.classpath.Configuration; +import gnu.classpath.SystemProperties; +import java.io.BufferedReader; import java.io.File; import java.io.IOException; +import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; import java.security.ProtectionDomain; import java.util.Enumeration; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import java.util.StringTokenizer; import java.util.Vector; import java.util.zip.ZipFile; @@ -235,12 +239,46 @@ /** * Returns a String[] of native package names. The default - * implementation returns an empty array, or you may decide - * this needs native help. + * implementation tries to load a list of package from + * the META-INF/INDEX.LIST file in the boot jar file. + * If not found or if any exception is raised, it returns + * an empty array. You may decide this needs native help. */ private static String[] getBootPackages() { -return new String[0]; +URL indexList = getResource(META-INF/INDEX.LIST); +if (indexList != null) + { +try + { +Set packageSet = new HashSet(); +String line; +int lineToSkip = 3; +BufferedReader reader = new BufferedReader( + new InputStreamReader( + indexList.openStream())); +while ((line = reader.readLine()) != null) + { +if (lineToSkip == 0) + { +if (line.length() == 0) + lineToSkip = 1; +else + packageSet.add(line.replace('/', '.')); + } +else + lineToSkip--; + } +reader.close(); +return (String[]) packageSet.toArray(new String[packageSet.size()]); + } +catch (IOException e) + { +return new String[0]; + } + } +else + return new String[0]; }
[cp-patches] RFC: change in VMClassLoader to define boot packages
Hi, in the VMClassLoader reference file, we have a method to define boot packages and tell vm implementors that they may override it. I propose this patch to use the META-INF/INDEX.LIST in the glibj.zip file (if this entry exists) to predefine boot packages as all packages found in this archive. Thanks for the feedback. Regards +Olivier 2006-04-13 Olivier Jolly [EMAIL PROTECTED] * vm/reference/java/lang/VMClassLoader.java (getBootPackages): Loads boot packages list from the META-INF/INDEX.LIST file if it exists. Index: VMClassLoader.java === RCS file: /sources/classpath/classpath/vm/reference/java/lang/VMClassLoader.java,v retrieving revision 1.34 diff -u -r1.34 VMClassLoader.java --- VMClassLoader.java 2 Mar 2006 00:36:44 - 1.34 +++ VMClassLoader.java 13 Apr 2006 19:32:24 - @@ -1,6 +1,6 @@ /* VMClassLoader.java -- Reference implementation of native interface required by ClassLoader - Copyright (C) 1998, 2001, 2002, 2004, 2005 Free Software Foundation + Copyright (C) 1998, 2001, 2002, 2004, 2005, 2006 Free Software Foundation This file is part of GNU Classpath. @@ -39,17 +39,21 @@ package java.lang; -import gnu.classpath.SystemProperties; import gnu.classpath.Configuration; +import gnu.classpath.SystemProperties; +import java.io.BufferedReader; import java.io.File; import java.io.IOException; +import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; import java.security.ProtectionDomain; import java.util.Enumeration; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import java.util.StringTokenizer; import java.util.Vector; import java.util.zip.ZipFile; @@ -235,12 +239,46 @@ /** * Returns a String[] of native package names. The default - * implementation returns an empty array, or you may decide - * this needs native help. + * implementation tries to load a list of package from + * the META-INF/INDEX.LIST file in the boot jar file. + * If not found or if any exception is raised, it returns + * an empty array. You may decide this needs native help. */ private static String[] getBootPackages() { -return new String[0]; +URL indexList = getResource(META-INF/INDEX.LIST); +if (indexList != null) + { +try + { +Set packageSet = new HashSet(); +String line; +int lineToSkip = 3; +BufferedReader reader = new BufferedReader( + new InputStreamReader( + indexList.openStream())); +while ((line = reader.readLine()) != null) + { +if (lineToSkip == 0) + { +if (line.length() == 0) + lineToSkip = 1; +else + packageSet.add(line.replace('/', '.')); + } +else + lineToSkip--; + } +reader.close(); +return (String[]) packageSet.toArray(new String[packageSet.size()]); + } +catch (IOException e) + { +return new String[0]; + } + } +else + return new String[0]; }
Re: RFC: VMClassLoader changes proposition
Hi Olivier, Olivier Jolly wrote: Hi, it seems to me that there is a missing/incomplete feature in the VMClassLoader. For now, the vm implementation are not encouraged, helped nor told to define packages in which classes are loaded from when the boot class loader is defining them. Notably, this makes such that java.lang package is not defined (i.e. basically getPackage on the VMClassLoader for java.lang is null) Well the actual comment on the getBootPackages method are /** * Returns a String[] of native package names. The default * implementation returns an empty array, or you may decide * this needs native help. */ So if the VM implementer decides that he wants to return the strings of all gnu-classpath + vm-specific packages, he has to redefine getBootPackages. We could force getBootPackages to be native though. I spent my week end trying to hack cacao to call a new VMClassLoader method (definePackageIfNeeded) in the native implementation of VMClassLoader.loadClass. I had to skip this call when the loaded class was coming from java.lang.** since the definePackageIfNeeded was using java.lang.** classes and we would run into an infinite loop else. The definePackageIfNeeded is taking a class name as parameter and extract the package name and then defines the package using default values for vendor and such (like the reference clinit of VMClassLoader) if it's not defined yet. Since java.lang.** packages can not be defined by this method, I overrided the getBootPackages reference method to return the java.lang.** packages (which are then defined by the clinit) Please find attached the hack I did on my environment (which I do not consider to be usable but a working proof of concept) as a support of my explanations. This looks complex compared to the (native - should be) getBootPackages method. Maybe I'm missing something, but all of this can be solved by implementing the getBootPackages on the VM side. Best, Nicolas
RFC: VMClassLoader changes proposition
Hi, it seems to me that there is a missing/incomplete feature in the VMClassLoader. For now, the vm implementation are not encouraged, helped nor told to define packages in which classes are loaded from when the boot class loader is defining them. Notably, this makes such that java.lang package is not defined (i.e. basically getPackage on the VMClassLoader for java.lang is null) I spent my week end trying to hack cacao to call a new VMClassLoader method (definePackageIfNeeded) in the native implementation of VMClassLoader.loadClass. I had to skip this call when the loaded class was coming from java.lang.** since the definePackageIfNeeded was using java.lang.** classes and we would run into an infinite loop else. The definePackageIfNeeded is taking a class name as parameter and extract the package name and then defines the package using default values for vendor and such (like the reference clinit of VMClassLoader) if it's not defined yet. Since java.lang.** packages can not be defined by this method, I overrided the getBootPackages reference method to return the java.lang.** packages (which are then defined by the clinit) Please find attached the hack I did on my environment (which I do not consider to be usable but a working proof of concept) as a support of my explanations. So basically, I'm asking about your thought on how to make the boot class loader (which is out of range of classpath) defines packages as it load classes. TIA, cheers +Olivier P.S: the signature of definePackageIfNeeded is a String[] instead of a String because I did not manage to call the String version from cacao code, but it should be a simple String. Index: src/native/vm/VMClassLoader.c === --- src/native/vm/VMClassLoader.c (révision 4586) +++ src/native/vm/VMClassLoader.c (copie de travail) @@ -259,12 +259,45 @@ { classinfo *c; utf *u; - + methodinfo *m; + classinfo *vmclclass; + char askedname[1024]; + int i = 0; + java_objectarray *oa; + if (!name) { exceptions_throw_nullpointerexception(); return NULL; } + m = NULL; + + vmclclass = NULL; + + for (i = 0; i name-value-header.size; i++) { + askedname[i] = name-value-data[i]; + } + askedname[i] = '\0'; + + fprintf(stderr, - calling loadClass on %s -\n, askedname); + fflush(stderr); + + oa = builtin_anewarray(1, class_java_lang_String); + oa-data[0] = (java_objectheader *) javastring_new(utf_new_char(askedname)); + + if (strncmp(askedname, java.lang., 10)) + vmclclass = load_class_from_sysloader(utf_new_char(java.lang.VMClassLoader)); + + if (vmclclass) { + fprintf(stderr, Found VMClassLoader class\n); + fflush(stderr); + m = class_resolveclassmethod(vmclclass, + utf_new_char(definePackageIfNotDefined), + utf_new_char(([Ljava/lang/String;)V), + class_java_lang_Object, + false); + } + /* create utf string in which '.' is replaced by '/' */ u = javastring_toutf(name, true); @@ -274,6 +307,11 @@ if (!(c = load_class_bootstrap(u))) goto exception; + if (m) { + fprintf(stderr, Calling definePackageIfNotDefined for %s\n, askedname); + fflush(stderr); + vm_call_method(m, NULL, oa); + } /* resolve class -- if requested */ /* XXX TWISTI: we do not support REAL (at runtime) lazy linking */ /* if (resolve) { */ Index: src/lib/vm/reference/java/lang/VMClassLoader.java === --- src/lib/vm/reference/java/lang/VMClassLoader.java (révision 4586) +++ src/lib/vm/reference/java/lang/VMClassLoader.java (copie de travail) @@ -259,7 +259,7 @@ */ private static String[] getBootPackages() { -return new String[0]; +return new String[] {java.lang, java.lang.ref, java.lang.reflect}; } @@ -405,4 +405,35 @@ return defineClass(loader, name, data, offset, len, pd); //} } + + static final void definePackageIfNotDefined(String[] classNameArray) { + System.err.println(called definePackageIfNotDefined with an array of size + classNameArray.length); + for (int i = 0; i classNameArray.length; i++) { + String className = classNameArray[i]; + int lastDot = className.lastIndexOf('.'); + System.err.println(called definePackageIfNotDefined for + + className + , [ // + className.length() + + ] lastDot = + lastDot); + if (lastDot != -1 className.length() 0) { +String packageName = className.substring(0, lastDot); +// Look if the package already exists +if (getPackage(packageName) == null) { + String specName = SystemProperties + .getProperty(java.specification.name); + String vendor = SystemProperties + .getProperty(java.specification.vendor); + String version = SystemProperties + .getProperty(java.specification.version); + + Package p; + + p = new Package(packageName, specName, vendor, version, + GNU Classpath, GNU
Re: RFC: VMClassLoader changes proposition
Olivier Jolly wrote: So basically, I'm asking about your thought on how to make the boot class loader (which is out of range of classpath) defines packages as it load classes. JCVM doesn't have any support for Packages, so any general-use code that gets added to Classpath and can save me work has my vote :-) -Archie __ Archie Cobbs *CTO, Awarix* http://www.awarix.com
[commit-cp] classpath/vm/reference/java/lang VMClassLoader....
CVSROOT:/cvsroot/classpath Module name:classpath Branch: Changes by: Nicolas Geoffray [EMAIL PROTECTED]05/10/28 09:27:55 Modified files: vm/reference/java/lang: VMClassLoader.java Log message: 2005-10-28 Nicolas Geoffray [EMAIL PROTECTED] Reported by: Gael Thomas [EMAIL PROTECTED] * NEWS : added entry about new implementation of VMClassLoader.getPackage(s), and new method VMClassLoader.getBootPackages * vm/reference/java/lang/VMClassLoader.java: Added new definedPackages field to store packages loaded by the bootstrap classloader. Added new static initializer to create all packages which names are returned by getBootPackages (getBootPackages): new private method. Helper to get as a String[] the native package names (getPackage): uses the new definedPackages field (getPackages): uses the new definedPackages field * java/lang/Class.java: (getPackage): if the classloader of the class is null then call VMClassLoader.getPackage CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/vm/reference/java/lang/VMClassLoader.java.diff?tr1=1.32tr2=1.33r1=textr2=text
[commit-cp] classpath/vm/reference/java/lang VMClassLoader....
CVSROOT:/cvsroot/classpath Module name:classpath Branch: Changes by: Nicolas Geoffray [EMAIL PROTECTED]05/10/21 10:47:17 Modified files: vm/reference/java/lang: VMClassLoader.java Log message: 2005-10-21 Nicolas Geoffray [EMAIL PROTECTED] * vm/reference/java/lang/VMClassLoader.java (getResources): uses a new static field HashMap to store opened zip files from property java.boot.class.path. CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/vm/reference/java/lang/VMClassLoader.java.diff?tr1=1.31tr2=1.32r1=textr2=text
[commit-cp] classpath/vm/reference/java/lang VMClassLoader....
CVSROOT:/cvsroot/classpath Module name:classpath Branch: Changes by: Nicolas Geoffray [EMAIL PROTECTED]05/10/21 10:25:14 Modified files: vm/reference/java/lang: VMClassLoader.java Log message: 2005-10-21 Nicolas Geoffray [EMAIL PROTECTED] * vm/reference/java/lang/VMClassLoader.java (getRessources): In case the property java.boot.class.path contains directories, tests if the ressource exists before adding it to the vector result. CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/vm/reference/java/lang/VMClassLoader.java.diff?tr1=1.30tr2=1.31r1=textr2=text
[cp-patches] RFC: VMClassLoader : hashmap for jars from property java.boot.class.path
Hi, I improved the reference implementation of VMClassLoader.getRessources by adding a static HashMap which is filled when a boot zip is opened (typically glibj.zip). In the previous implementation, the code kept opening and closing the zip file. Another solution would be to have a static initializer for VMClassLoader which would parse the java.boot.class.path property, and puts the files into a static Enumeration object. I tried this solution too, but performance isn't improved and it results in all boot files opened. Comments welcomed 2005-10-06 Nicolas Geoffray [EMAIL PROTECTED] * vm/reference/java/lang/VMClassLoader.java (getResources): uses a new static field HashMap to store opened zip files from property java.boot.class.path. Cheers, Nicolas --- classpath-0.18/vm/reference/java/lang/VMClassLoader.java 2005-10-06 10:26:34.0 +0200 +++ classpath-0.18-jnjvm/vm/reference/java/lang/VMClassLoader.java 2005-10-06 14:47:02.0 +0200 @@ -119,6 +119,9 @@ return null; } + /** jars from property java.boot.class.path */ + static final HashMap bootjars = new HashMap(); + /** * Helper to get a list of resources from the bootstrap class loader. * @@ -139,8 +142,9 @@ { try { - v.add(new URL(file:// - + new File(file, name).getAbsolutePath())); +File f = new File(file, name); +if(!f.exists()) continue; +v.add(new URL(file:// + f.getAbsolutePath())); } catch (MalformedURLException e) { @@ -150,30 +154,28 @@ else if (file.isFile()) { ZipFile zip; - try - { - zip = new ZipFile(file); - } - catch (IOException e) - { - continue; - } - String zname = name.startsWith(/) ? name.substring(1) : name; - try - { - if (zip.getEntry(zname) == null) +synchronized(bootjars) + { +zip = (ZipFile) bootjars.get(file.getName()); + } +if(zip == null) + { +try + { +zip = new ZipFile(file); +synchronized(bootjars) + { +bootjars.put(file.getName(), zip); + } + } + catch (IOException e) + { continue; - } - finally - { - try - { - zip.close(); - } - catch (IOException e) - { - } - } + } + } + String zname = name.startsWith(/) ? name.substring(1) : name; + if (zip.getEntry(zname) == null) + continue; try { v.add(new URL(jar:file:// ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: VMClassLoader
Hi, On Thu, 2004-08-12 at 19:18, Tom Tromey wrote: I notice that VMClassLoader still has this: * strongFor backward compatibility, this just ignores the protection * domain; that is the wrong behavior, and you should directly implement * this method natively if you can./strong I suggest we pick a flag day to switch this. In particular I think we ought to simply remove the old form of defineClass() and only have the form that accepts a ProtectionDomain. I agree. And a since the old form of defineClass() isn't even used from the rest of GNU Claspath I think we can remove it immediatly. Runtimes will probably have provided their own VMClassLoader implementation already. If nobody objects I want to commit the attached patch next week. 2004-08-14 Mark Wielaard [EMAIL PROTECTED] * vm/reference/java/lang/VMClassLoader.java (defineClass): Removed version that didn't take a ProtectionDomain. Cheers, Mark signature.asc Description: This is a digitally signed message part ___ Classpath mailing list [EMAIL PROTECTED] http://lists.gnu.org/mailman/listinfo/classpath
Re: VMClassLoader
Hi, On Sun, 2004-08-15 at 12:07, Mark Wielaard wrote: If nobody objects I want to commit the attached patch next week. 2004-08-14 Mark Wielaard [EMAIL PROTECTED] * vm/reference/java/lang/VMClassLoader.java (defineClass): Removed version that didn't take a ProtectionDomain. That would be the attached patch. Cheers, Mark Index: NEWS === RCS file: /cvsroot/classpath/classpath/NEWS,v retrieving revision 1.47 diff -u -r1.47 NEWS --- NEWS 1 Aug 2004 21:31:11 - 1.47 +++ NEWS 15 Aug 2004 10:06:17 - @@ -14,6 +14,12 @@ * AWT 1.0 event model support. * GNU Classpath now comes with some example programs (see examples/README). +Runtime interface Changes: + +* Runtimes should implement the VMClassLoader.defineClass() that takes a + ProtectionDomain. The version that didn't take a ProtectionDomain has + been removed from the reference implementation. + New in release 0.10 (Jul 9, 2004) * java.net.URL now uses application classloader to load URLStreamHandlers Index: vm/reference/java/lang/VMClassLoader.java === RCS file: /cvsroot/classpath/classpath/vm/reference/java/lang/VMClassLoader.java,v retrieving revision 1.17 diff -u -r1.17 VMClassLoader.java --- vm/reference/java/lang/VMClassLoader.java 12 Aug 2004 17:40:24 - 1.17 +++ vm/reference/java/lang/VMClassLoader.java 15 Aug 2004 10:06:17 - @@ -62,30 +62,6 @@ /** * Helper to define a class using a string of bytes. This assumes that * the security checks have already been performed, if necessary. - * strongThis method will be removed in a future version of GNU - * Classpath/strong. - * - * @param name the name to give the class, or null if unknown - * @param data the data representing the classfile, in classfile format - * @param offset the offset into the data where the classfile starts - * @param len the length of the classfile data in the array - * @return the class that was defined - * @throws ClassFormatError if data is not in proper classfile format - * @deprecated Implement - * [EMAIL PROTECTED] #defineClass(ClassLoader, String, byte[], int, int, ProtectionDomain)} - * instead. - */ - static final native Class defineClass(ClassLoader cl, String name, -byte[] data, int offset, int len) -throws ClassFormatError; - - /** - * Helper to define a class using a string of bytes. This assumes that - * the security checks have already been performed, if necessary. - * - * strongFor backward compatibility, this just ignores the protection - * domain; that is the wrong behavior, and you should directly implement - * this method natively if you can./strong * * Implementations of this method are advised to consider the * situation where user code modifies the byte array after it has @@ -101,13 +77,10 @@ * @return the class that was defined * @throws ClassFormatError if data is not in proper classfile format */ - static final Class defineClass(ClassLoader cl, String name, - byte[] data, int offset, int len, - ProtectionDomain pd) -throws ClassFormatError - { -return defineClass(cl, name, data, offset, len); - } + static final native Class defineClass(ClassLoader cl, String name, + byte[] data, int offset, int len, + ProtectionDomain pd) +throws ClassFormatError; /** * Helper to resolve all references to other classes from this class. signature.asc Description: This is a digitally signed message part ___ Classpath mailing list [EMAIL PROTECTED] http://lists.gnu.org/mailman/listinfo/classpath
VMClassLoader
I notice that VMClassLoader still has this: * strongFor backward compatibility, this just ignores the protection * domain; that is the wrong behavior, and you should directly implement * this method natively if you can./strong I suggest we pick a flag day to switch this. In particular I think we ought to simply remove the old form of defineClass() and only have the form that accepts a ProtectionDomain. Tom ___ Classpath mailing list [EMAIL PROTECTED] http://lists.gnu.org/mailman/listinfo/classpath
RE: VMClassLoader
Tom Tromey wrote: I think the reference VMClassLoader is subtly incorrect. Is anybody using this code as-is? I am (in IKVM.NET). In particular, I think VMClassLoader.getSystemClassLoader must try to use the default system class loader to load the one specified in the java.system.class.loader property. Also, it should pass the default system loader as the argument to this loader's constructor. I base this on the Sun JDK docs for ClassLoader.getSystemClassLoader(). Any opinions? I would check in a cleanup here, but I don't know how I would test it... At the moment I rely on the current (incorrect) behavior. I wouldn't mind fixing it, but I would like it if we could also remove gnu.java.lang.SystemClassLoader and replace it with something that actually works. My current application (aka system) class loader is simply a URLClassLoader and it has the extension class loader (another URLClassLoader) as its parent. I don't see the need for gnu.java.lang.SystemClassLoader, but I might be missing something. My proposed implementation of VMClassLoader.getSystemClassLoader looks something like this (pseudo code): ClassLoader ext = new URLClassLoader(toURLS(System.getProperty(java.ext.dirs)), null); ClassLoader app = new URLClassLoader(toURLS(System.getProperty(java.class.path)), ext); String loader = System.getProperty(java.system.class.loader); if(loader != null) { Constructor c = Class.forName(loader, true, app).getConstructor( new Class[] { ClassLoader.class } ); return (ClassLoader)c.newInstance(new Object[] { app }); } else { return app; } Regards, Jeroen ___ Classpath mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/classpath
VMClassLoader
I think the reference VMClassLoader is subtly incorrect. Is anybody using this code as-is? In particular, I think VMClassLoader.getSystemClassLoader must try to use the default system class loader to load the one specified in the java.system.class.loader property. Also, it should pass the default system loader as the argument to this loader's constructor. I base this on the Sun JDK docs for ClassLoader.getSystemClassLoader(). Any opinions? I would check in a cleanup here, but I don't know how I would test it... Tom ___ Classpath mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/classpath
The commenting out of TYPE var VMClassLoader
Brian Jones [EMAIL PROTECTED] writes: So what is going on with java.lang.Float/Double/etc where public static final Class TYPE = VMClassLoader.getPrimitiveClass("float") has been commented out. This creates some compile problems of course. Brian -- |---|Software Engineer |Brian Jones|[EMAIL PROTECTED] |[EMAIL PROTECTED]|http://www.nortel.net |http://www.classpath.org/ |--