classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Pre-submit for serialization


From: Dalibor Topic
Subject: Re: [PATCH] Pre-submit for serialization
Date: Sat, 29 Nov 2003 20:37:59 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030312

Salut Guilhem,

Guilhem Lavaux wrote:
Hi,

I think I will have to begin the split of the serialization patch at a time or another. I'm beginning with this really simple patch for TypeSignature. It is needed so class can resolved by name using a specific class loader and not using a default class loader as it was the case with the previous API.

Looks fine to me. Could you add some docs for getClassForEncoding(String, boolean, ClassLoader):

/**
 * This function is the inverse of <code>getEncodingOfClass</code>. This
 * accepts both object and descriptor formats, but must know which style
 * of string is being passed in (usually, descriptor should be true).In
 * descriptor format, "I" is treated as int.class, in object format, it
 * is treated as a class named I in the unnamed package. It also
 * accepts a <code>ClassLoader</code>, which is used to load the class.
 *
 * @param type_code the class name to decode
 * @param descriptor if the string is in descriptor format
 * @param loader the class loader used to load the class
 * @return the corresponding Class object
 * @throws ClassNotFoundException if the class cannot be located
 * @see #getEncodingOfClass(Class, boolean)
 * @see #getClassForEncoding(String, boolean)
 */

cheers,
dalibor topic

2003-11-26 Guilhem Lavaux <address@hidden>, Helmer Kraemer <address@hidden>

    * gnu/java/lang/reflect/TypeSignature.java
(getClassForEncoding) Splitted the method so we can specify an explicit boot loader.


------------------------------------------------------------------------

Index: gnu/java/lang/reflect/TypeSignature.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/lang/reflect/TypeSignature.java,v
retrieving revision 1.10
diff -u -r1.10 TypeSignature.java
--- gnu/java/lang/reflect/TypeSignature.java    22 Mar 2002 21:25:20 -0000      
1.10
+++ gnu/java/lang/reflect/TypeSignature.java    16 Nov 2003 16:27:05 -0000
@@ -150,6 +150,12 @@
   public static Class getClassForEncoding(String type_code, boolean descriptor)
     throws ClassNotFoundException
   {
+    return getClassForEncoding(type_code, descriptor, null);
+  }
+
+  public static Class getClassForEncoding(String type_code, boolean 
descriptor, ClassLoader loader)
+    throws ClassNotFoundException
+  {
     if (descriptor)
       {
         switch (type_code.charAt(0))
@@ -181,7 +187,7 @@
           case '[':
           }
       }
-    return Class.forName(type_code.replace('/', '.'));
+    return Class.forName(type_code.replace('/', '.'), true, loader);
   }
/**


------------------------------------------------------------------------

_______________________________________________
Classpath mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/classpath






reply via email to

[Prev in Thread] Current Thread [Next in Thread]