From 1ea63ef8be1cc54dd0de9d82c684713a1dcf1e06 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 23 Sep 2005 21:31:04 +0000 Subject: Imported Classpath 0.18. * sources.am, Makefile.in: Updated. * Makefile.am (nat_source_files): Removed natProxy.cc. * java/lang/reflect/natProxy.cc: Removed. * gnu/classpath/jdwp/VMFrame.java, gnu/classpath/jdwp/VMIdManager.java, gnu/classpath/jdwp/VMVirtualMachine.java, java/lang/reflect/VMProxy.java: New files. 2005-09-23 Thomas Fitzsimmons * scripts/makemake.tcl (verbose): Add gnu/java/awt/peer/qt to BC list. 2005-09-23 Thomas Fitzsimmons * gnu/java/net/DefaultContentHandlerFactory.java (getContent): Remove ClasspathToolkit references. 2005-09-23 Thomas Fitzsimmons * gnu/awt/xlib/XCanvasPeer.java: Add new peer methods. * gnu/awt/xlib/XFramePeer.java: Likewise. * gnu/awt/xlib/XGraphicsConfiguration.java: Likewise. 2005-09-23 Thomas Fitzsimmons * Makefile.am (libgcjawt_la_SOURCES): Remove jawt.c. Add classpath/native/jawt/jawt.c. * Makefile.in: Regenerate. * jawt.c: Remove file. * include/Makefile.am (tool_include__HEADERS): Remove jawt.h and jawt_md.h. Add ../classpath/include/jawt.h and ../classpath/include/jawt_md.h. * include/Makefile.in: Regenerate. * include/jawt.h: Regenerate. * include/jawt_md.h: Regenerate. From-SVN: r104586 --- libjava/classpath/java/lang/reflect/Proxy.java | 133 ++----------------------- 1 file changed, 11 insertions(+), 122 deletions(-) (limited to 'libjava/classpath/java/lang/reflect/Proxy.java') diff --git a/libjava/classpath/java/lang/reflect/Proxy.java b/libjava/classpath/java/lang/reflect/Proxy.java index dc1ac87..7a5fd30 100644 --- a/libjava/classpath/java/lang/reflect/Proxy.java +++ b/libjava/classpath/java/lang/reflect/Proxy.java @@ -38,7 +38,6 @@ exception statement from your version. */ package java.lang.reflect; -import gnu.classpath.Configuration; import gnu.java.lang.reflect.TypeSignature; import java.io.Serializable; @@ -263,16 +262,16 @@ public class Proxy implements Serializable Class clazz = (Class) proxyClasses.get(pt); if (clazz == null) { - if (Configuration.HAVE_NATIVE_GET_PROXY_CLASS) - clazz = getProxyClass0(loader, interfaces); + if (VMProxy.HAVE_NATIVE_GET_PROXY_CLASS) + clazz = VMProxy.getProxyClass(loader, interfaces); else { - ProxyData data = (Configuration.HAVE_NATIVE_GET_PROXY_DATA - ? getProxyData0(loader, interfaces) + ProxyData data = (VMProxy.HAVE_NATIVE_GET_PROXY_DATA + ? VMProxy.getProxyData(loader, interfaces) : ProxyData.getProxyData(pt)); - clazz = (Configuration.HAVE_NATIVE_GENERATE_PROXY_CLASS - ? generateProxyClass0(loader, data) + clazz = (VMProxy.HAVE_NATIVE_GENERATE_PROXY_CLASS + ? VMProxy.generateProxyClass(loader, data) : new ClassFactory(data).generate(loader)); } @@ -388,74 +387,6 @@ public class Proxy implements Serializable } /** - * Optional native method to replace (and speed up) the pure Java - * implementation of getProxyClass. Only needed if - * Configuration.HAVE_NATIVE_GET_PROXY_CLASS is true, this does the - * work of both getProxyData0 and generateProxyClass0 with no - * intermediate form in Java. The native code may safely assume that - * this class must be created, and does not already exist. - * - * @param loader the class loader to define the proxy class in; null - * implies the bootstrap class loader - * @param interfaces the interfaces the class will extend - * @return the generated proxy class - * @throws IllegalArgumentException if the constraints for getProxyClass - * were violated, except for problems with null - * @throws NullPointerException if `interfaces' is null or contains - * a null entry, or if handler is null - * @see Configuration#HAVE_NATIVE_GET_PROXY_CLASS - * @see #getProxyClass(ClassLoader, Class[]) - * @see #getProxyData0(ClassLoader, Class[]) - * @see #generateProxyClass0(ProxyData) - */ - private static native Class getProxyClass0(ClassLoader loader, - Class[] interfaces); - - /** - * Optional native method to replace (and speed up) the pure Java - * implementation of getProxyData. Only needed if - * Configuration.HAVE_NATIVE_GET_PROXY_DATA is true. The native code - * may safely assume that a new ProxyData object must be created which - * does not duplicate any existing ones. - * - * @param loader the class loader to define the proxy class in; null - * implies the bootstrap class loader - * @param interfaces the interfaces the class will extend - * @return all data that is required to make this proxy class - * @throws IllegalArgumentException if the constraints for getProxyClass - * were violated, except for problems with null - * @throws NullPointerException if `interfaces' is null or contains - * a null entry, or if handler is null - * @see Configuration.HAVE_NATIVE_GET_PROXY_DATA - * @see #getProxyClass(ClassLoader, Class[]) - * @see #getProxyClass0(ClassLoader, Class[]) - * @see ProxyType#getProxyData() - */ - private static native ProxyData getProxyData0(ClassLoader loader, - Class[] interfaces); - - /** - * Optional native method to replace (and speed up) the pure Java - * implementation of generateProxyClass. Only needed if - * Configuration.HAVE_NATIVE_GENERATE_PROXY_CLASS is true. The native - * code may safely assume that a new Class must be created, and that - * the ProxyData object does not describe any existing class. - * - * @param loader the class loader to define the proxy class in; null - * implies the bootstrap class loader - * @param data the struct of information to convert to a Class. This - * has already been verified for all problems except exceeding - * VM limitations - * @return the newly generated class - * @throws IllegalArgumentException if VM limitations are exceeded - * @see #getProxyClass(ClassLoader, Class[]) - * @see #getProxyClass0(ClassLoader, Class[]) - * @see ProxyData#generateProxyClass(ClassLoader) - */ - private static native Class generateProxyClass0(ClassLoader loader, - ProxyData data); - - /** * Helper class for mapping unique ClassLoader and interface combinations * to proxy classes. * @@ -502,49 +433,6 @@ public class Proxy implements Serializable return hash; } - // A more comprehensive comparison of two arrays, - // ignore array element order, and - // ignore redundant elements - private static boolean sameTypes(Class arr1[], Class arr2[]) { - if (arr1.length == 1 && arr2.length == 1) { - return arr1[0] == arr2[0]; - } - - // total occurrance of elements of arr1 in arr2 - int total_occ_of_arr1_in_arr2 = 0; - each_type: - for (int i = arr1.length; --i >= 0; ) - { - Class t = arr1[i]; - for (int j = i; --j >= 0; ) - { - if (t == arr1[j]) - { //found duplicate type - continue each_type; - } - } - - // count c(a unique element of arr1)'s - // occurrences in arr2 - int occ_in_arr2 = 0; - for (int j = arr2.length; --j >= 0; ) - { - if (t == arr2[j]) - { - ++occ_in_arr2; - } - } - if (occ_in_arr2 == 0) - { // t does not occur in arr2 - return false; - } - - total_occ_of_arr1_in_arr2 += occ_in_arr2; - } - // now, each element of arr2 must have been visited - return total_occ_of_arr1_in_arr2 == arr2.length; - } - /** * Calculates equality. * @@ -556,7 +444,10 @@ public class Proxy implements Serializable ProxyType pt = (ProxyType) other; if (loader != pt.loader || interfaces.length != pt.interfaces.length) return false; - return sameTypes(interfaces, pt.interfaces); + for (int i = 0; i < interfaces.length; i++) + if (interfaces[i] != pt.interfaces[i]) + return false; + return true; } } // class ProxyType @@ -720,7 +611,7 @@ public class Proxy implements Serializable * * @author Eric Blake (ebb9@email.byu.edu) */ - private static final class ProxyData + static final class ProxyData { /** * The package this class is in including the trailing dot @@ -876,7 +767,6 @@ public class Proxy implements Serializable private static final class ClassFactory { /** Constants for assisting the compilation */ - private static final byte POOL = 0; private static final byte FIELD = 1; private static final byte METHOD = 2; private static final byte INTERFACE = 3; @@ -909,7 +799,6 @@ public class Proxy implements Serializable private static final char GETFIELD = 180; private static final char INVOKEVIRTUAL = 182; private static final char INVOKESPECIAL = 183; - private static final char INVOKESTATIC = 184; private static final char INVOKEINTERFACE = 185; private static final char NEW = 187; private static final char ANEWARRAY = 189; -- cgit v1.1