I've committed the attached patch to fix an infinite loop between VMStackWalker.getCallingClassLoader() and Class.getClassLoader().
2005-11-13 Archie Cobbs <[EMAIL PROTECTED]> * vm/reference/gnu/classpath/VMStackWalker.java (getClassLoader()): added to fix an infinite loop bug. * NEWS: note VM interface change. -Archie __________________________________________________________________________ Archie Cobbs * CTO, Awarix * http://www.awarix.com
Index: NEWS =================================================================== RCS file: /cvsroot/classpath/classpath/NEWS,v retrieving revision 1.104 diff -u -r1.104 NEWS --- NEWS 2 Nov 2005 22:31:47 -0000 1.104 +++ NEWS 13 Nov 2005 22:25:48 -0000 @@ -1,3 +1,10 @@ +New in release 0.20 + +Runtime interface changes: + +* New method VMStackWalker.getClassLoader() was added to avoid an infinite + loop between getCallingClassLoader() and Class.getClassLoader(). + New in release 0.19 (Nov 2, 2005) * The Swing RepaintManager has been reworked for more efficient painting, Index: vm/reference/gnu/classpath/VMStackWalker.java =================================================================== RCS file: /cvsroot/classpath/classpath/vm/reference/gnu/classpath/VMStackWalker.java,v retrieving revision 1.5 diff -u -r1.5 VMStackWalker.java --- vm/reference/gnu/classpath/VMStackWalker.java 2 Jul 2005 20:33:08 -0000 1.5 +++ vm/reference/gnu/classpath/VMStackWalker.java 13 Nov 2005 22:25:51 -0000 @@ -88,9 +88,9 @@ /** * Get the class loader associated with the Class returned by - * <code>getCallingClass()</code>, or <code>null</code> if no - * such class exists or it is the boot loader. This method is an optimization - * for the expression <code>getClassContext()[1].getClassLoader()</code> + * <code>getCallingClass()</code>, or <code>null</code> if no such class + * exists or it is the boot loader. This method is an optimization for the + * expression <code>VMStackWalker.getClassLoader(getClassContext()[1])</code> * and should return the same result. * * <p> @@ -102,7 +102,15 @@ Class[] ctx = getClassContext(); if (ctx.length < 3) return null; - return ctx[2].getClassLoader(); + return getClassLoader(ctx[2]); } + + /** + * Retrieve the class's ClassLoader, or <code>null</code> if loaded + * by the bootstrap loader. I.e., this should return the same thing + * as [EMAIL PROTECTED] java.lang.VMClass#getClassLoader}. This duplicate version + * is here to work around access permissions. + */ + public static native ClassLoader getClassLoader(Class cl); }
_______________________________________________ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches