diff options
Diffstat (limited to 'libjava/classpath/java/lang')
-rw-r--r-- | libjava/classpath/java/lang/Character.java | 165 | ||||
-rw-r--r-- | libjava/classpath/java/lang/Class.java | 24 | ||||
-rw-r--r-- | libjava/classpath/java/lang/ClassLoader.java | 36 | ||||
-rw-r--r-- | libjava/classpath/java/lang/IllegalArgumentException.java | 56 | ||||
-rw-r--r-- | libjava/classpath/java/lang/IllegalStateException.java | 57 | ||||
-rw-r--r-- | libjava/classpath/java/lang/Integer.java | 10 | ||||
-rw-r--r-- | libjava/classpath/java/lang/SecurityException.java | 56 | ||||
-rw-r--r-- | libjava/classpath/java/lang/UnsupportedOperationException.java | 56 | ||||
-rw-r--r-- | libjava/classpath/java/lang/reflect/Proxy.java | 133 |
9 files changed, 423 insertions, 170 deletions
diff --git a/libjava/classpath/java/lang/Character.java b/libjava/classpath/java/lang/Character.java index 4eac1476184..1e4f219a15f 100644 --- a/libjava/classpath/java/lang/Character.java +++ b/libjava/classpath/java/lang/Character.java @@ -1457,6 +1457,57 @@ public final class Character implements Serializable, Comparable private static final int MIRROR_MASK = 0x40; /** + * Min value for supplementary code point. + * + * @since 1.5 + */ + public static final int MIN_SUPPLEMENTARY_CODE_POINT = 0x10000; + + /** + * Min value for code point. + * + * @since 1.5 + */ + public static final int MIN_CODE_POINT = 0; + + + /** + * Max value for code point. + * + * @since 1.5 + */ + public static final int MAX_CODE_POINT = 0x010ffff; + + + /** + * Minimum high surrrogate code in UTF-16 encoding. + * + * @since 1.5 + */ + public static final char MIN_HIGH_SURROGATE = '\ud800'; + + /** + * Maximum high surrrogate code in UTF-16 encoding. + * + * @since 1.5 + */ + public static final char MAX_HIGH_SURROGATE = '\udbff'; + + /** + * Minimum low surrrogate code in UTF-16 encoding. + * + * @since 1.5 + */ + public static final char MIN_LOW_SURROGATE = '\udc00'; + + /** + * Maximum low surrrogate code in UTF-16 encoding. + * + * @since 1.5 + */ + public static final char MAX_LOW_SURROGATE = '\udfff'; + + /** * Grabs an attribute offset from the Unicode attribute database. The lower * 5 bits are the character type, the next 2 bits are flags, and the top * 9 bits are the offset into the attribute tables. @@ -2250,4 +2301,118 @@ public final class Character implements Serializable, Comparable { return compareTo((Character) o); } + + /** + * Converts a unicode code point to a UTF-16 representation of that + * code point. + * + * @param codePoint the unicode code point + * + * @return the UTF-16 representation of that code point + * + * @throws IllegalArgumentException if the code point is not a valid + * unicode code point + * + * @since 1.5 + */ + public static char[] toChars(int codePoint) + { + char[] result = new char[charCount(codePoint)]; + int ignore = toChars(codePoint, result, 0); + return result; + } + + /** + * Converts a unicode code point to its UTF-16 representation. + * + * @param codePoint the unicode code point + * @param dst the target char array + * @param dstIndex the start index for the target + * + * @return number of characters written to <code>dst</code> + * + * @throws IllegalArgumentException if <code>codePoint</code> is not a + * valid unicode code point + * @throws NullPointerException if <code>dst</code> is <code>null</code> + * @throws IndexOutOfBoundsException if <code>dstIndex</code> is not valid + * in <code>dst</code> or if the UTF-16 representation does not + * fit into <code>dst</code> + * + * @since 1.5 + */ + public static int toChars(int codePoint, char[] dst, int dstIndex) + { + if (!isValidCodePoint(codePoint)) + { + throw new IllegalArgumentException("not a valid code point: " + + codePoint); + } + + int result; + if (isSupplementaryCodePoint(codePoint)) + { + // Write second char first to cause IndexOutOfBoundsException + // immediately. + dst[dstIndex + 1] = (char) ((codePoint & 0x3ff) + + (int) MIN_LOW_SURROGATE ); + dst[dstIndex] = (char) ((codePoint >> 10) + (int) MIN_HIGH_SURROGATE); + result = 2; + } + else + { + dst[dstIndex] = (char) codePoint; + result = 1; + } + return result; + } + + /** + * Return number of 16-bit characters required to represent the given + * code point. + * + * @param codePoint a uncode code point + * + * @return 2 if codePoint >= 0x10000, 1 otherwise. + * + * @since 1.5 + */ + public static int charCount(int codePoint) + { + return + (codePoint >= MIN_SUPPLEMENTARY_CODE_POINT) + ? 2 + : 1; + } + + /** + * Determines whether the specified code point is + * in the range 0x10000 .. 0x10FFFF, i.e. the character is within the Unicode + * supplementary character range. + * + * @param codePoint a Unicode code point + * + * @return <code>true</code> if code point is in supplementary range + * + * @since 1.5 + */ + public static boolean isSupplementaryCodePoint(int codePoint) + { + return codePoint >= MIN_SUPPLEMENTARY_CODE_POINT + && codePoint <= MAX_CODE_POINT; + } + + /** + * Determines whether the specified code point is + * in the range 0x0000 .. 0x10FFFF, i.e. it is a valid Unicode code point. + * + * @param codePoint a Unicode code point + * + * @return <code>true</code> if code point is valid + * + * @since 1.5 + */ + public static boolean isValidCodePoint(int codePoint) + { + return codePoint >= MIN_CODE_POINT && codePoint <= MAX_CODE_POINT; + } } // class Character diff --git a/libjava/classpath/java/lang/Class.java b/libjava/classpath/java/lang/Class.java index 6b8bc93ae63..22f148e9136 100644 --- a/libjava/classpath/java/lang/Class.java +++ b/libjava/classpath/java/lang/Class.java @@ -156,11 +156,7 @@ public final class Class implements Serializable */ public static Class forName(String name) throws ClassNotFoundException { - Class result = VMClass.forName (name); - if (result == null) - result = Class.forName(name, true, - VMStackWalker.getCallingClassLoader()); - return result; + return VMClass.forName(name, true, VMStackWalker.getCallingClassLoader()); } /** @@ -205,24 +201,8 @@ public final class Class implements Serializable if (cl != null) sm.checkPermission(new RuntimePermission("getClassLoader")); } - if (name.startsWith("[")) - return VMClass.loadArrayClass(name, null); - Class c = VMClassLoader.loadClass(name, true); - if (c != null) - { - if (initialize) - VMClass.initialize(c); - return c; - } - throw new ClassNotFoundException(name); } - if (name.startsWith("[")) - return VMClass.loadArrayClass(name, classloader); - Class c = classloader.loadClass(name); - classloader.resolveClass(c); - if (initialize) - VMClass.initialize(c); - return c; + return VMClass.forName(name, initialize, classloader); } /** diff --git a/libjava/classpath/java/lang/ClassLoader.java b/libjava/classpath/java/lang/ClassLoader.java index b644511cf27..0d50a6e005d 100644 --- a/libjava/classpath/java/lang/ClassLoader.java +++ b/libjava/classpath/java/lang/ClassLoader.java @@ -124,14 +124,6 @@ import java.util.StringTokenizer; public abstract class ClassLoader { /** - * All classes loaded by this classloader. VM's may choose to implement - * this cache natively; but it is here available for use if necessary. It - * is not private in order to allow native code (and trusted subclasses) - * access to this field. - */ - final HashMap loadedClasses = new HashMap(); - - /** * All packages defined by this classloader. It is not private in order to * allow native code (and trusted subclasses) access to this field. */ @@ -472,15 +464,11 @@ public abstract class ClassLoader ProtectionDomain domain) throws ClassFormatError { + checkInitialized(); if (domain == null) domain = StaticData.defaultProtectionDomain; - if (! initialized) - throw new SecurityException("attempt to define class from uninitialized class loader"); - Class retval = VMClassLoader.defineClass(this, name, data, - offset, len, domain); - loadedClasses.put(retval.getName(), retval); - return retval; + return VMClassLoader.defineClass(this, name, data, offset, len, domain); } /** @@ -493,6 +481,7 @@ public abstract class ClassLoader */ protected final void resolveClass(Class c) { + checkInitialized(); VMClassLoader.resolveClass(c); } @@ -508,6 +497,7 @@ public abstract class ClassLoader protected final Class findSystemClass(String name) throws ClassNotFoundException { + checkInitialized(); return Class.forName(name, false, StaticData.systemClassLoader); } @@ -544,6 +534,7 @@ public abstract class ClassLoader */ protected final void setSigners(Class c, Object[] signers) { + checkInitialized(); c.setSigners(signers); } @@ -556,9 +547,8 @@ public abstract class ClassLoader */ protected final synchronized Class findLoadedClass(String name) { - // NOTE: If the VM is keeping its own cache, it may make sense to have - // this method be native. - return (Class) loadedClasses.get(name); + checkInitialized(); + return VMClassLoader.findLoadedClass(this, name); } /** @@ -1113,4 +1103,16 @@ public abstract class ClassLoader .initCause(e); } } + + /** + * Before doing anything "dangerous" please call this method to make sure + * this class loader instance was properly constructed (and not obtained + * by exploiting the finalizer attack) + * @see #initialized + */ + private void checkInitialized() + { + if (! initialized) + throw new SecurityException("attempt to use uninitialized class loader"); + } } diff --git a/libjava/classpath/java/lang/IllegalArgumentException.java b/libjava/classpath/java/lang/IllegalArgumentException.java index 7b822b91665..75a0b8bfe38 100644 --- a/libjava/classpath/java/lang/IllegalArgumentException.java +++ b/libjava/classpath/java/lang/IllegalArgumentException.java @@ -47,7 +47,8 @@ package java.lang; * * @author Brian Jones * @author Warren Levy (warrenl@cygnus.com) - * @status updated to 1.4 + * @author Andrew John Hughes (gnu_andrew@member.fsf.org) + * @status updated to 1.5 */ public class IllegalArgumentException extends RuntimeException { @@ -72,4 +73,57 @@ public class IllegalArgumentException extends RuntimeException { super(s); } + + /** + * <p> + * Constructs a <code>IllegalArgumentException</code> using + * the specified error message, which should give further details + * as to the reason for this exception. The specified cause + * <code>Throwable</code> may be used to provide additional history, + * with regards to the root of the problem. It is perfectly valid + * for this to be null, if the cause of the problem is unknown. + * </p> + * <p> + * <strong>Note</strong>: the detail message from the cause is not + * automatically incorporated into the resulting detail message of + * this exception. + * </p> + * + * @param message the detail message, which should give the reason for + * this exception being thrown. + * @param cause the cause of this exception, or null if the cause + * is unknown. + * @since 1.5 + */ + public IllegalArgumentException(String message, Throwable cause) + { + super(message, cause); + } + + /** + * <p> + * Constructs a <code>IllegalArgumentException</code> using + * the specified cause <code>Throwable</code>, which may be used + * to provide additional history, with regards to the root of the + * problem. It is perfectly valid for this to be null, if the + * cause of the problem is unknown. + * </p> + * <p> + * The detail message is automatically constructed from the detail + * message of the supplied causal exception. If the cause is null, + * then the detail message will also be null. Otherwise, the detail + * message of this exception will be that of the causal exception. + * This makes this constructor very useful for simply wrapping another + * exception. + * </p> + * + * @param cause the cause of this exception, or null if the cause + * is unknown. + * @since 1.5 + */ + public IllegalArgumentException(Throwable cause) + { + super(cause); + } + } diff --git a/libjava/classpath/java/lang/IllegalStateException.java b/libjava/classpath/java/lang/IllegalStateException.java index 5c2bbad37a2..6b4e5f8428a 100644 --- a/libjava/classpath/java/lang/IllegalStateException.java +++ b/libjava/classpath/java/lang/IllegalStateException.java @@ -51,8 +51,9 @@ package java.lang; * * @author Brian Jones * @author Warren Levy (warrenl@cygnus.com) + * @author Andrew John Hughes (gnu_andrew@member.fsf.org) * @since 1.1 - * @status updated to 1.4 + * @status updated to 1.5 */ public class IllegalStateException extends RuntimeException { @@ -77,4 +78,58 @@ public class IllegalStateException extends RuntimeException { super(s); } + + /** + * <p> + * Constructs a <code>IllegalStateException</code> using + * the specified error message, which should give further details + * as to the reason for this exception. The specified cause + * <code>Throwable</code> may be used to provide additional history, + * with regards to the root of the problem. It is perfectly valid + * for this to be null, if the cause of the problem is unknown. + * </p> + * <p> + * <strong>Note</strong>: the detail message from the cause is not + * automatically incorporated into the resulting detail message of + * this exception. + * </p> + * + * @param message the detail message, which should give the reason for + * this exception being thrown. + * @param cause the cause of this exception, or null if the cause + * is unknown. + * @since 1.5 + */ + public IllegalStateException(String message, Throwable cause) + { + super(message, cause); + } + + /** + * <p> + * Constructs a <code>IllegalStateException</code> using + * the specified cause <code>Throwable</code>, which may be used + * to provide additional history, with regards to the root of the + * problem. It is perfectly valid for this to be null, if the + * cause of the problem is unknown. + * </p> + * <p> + * The detail message is automatically constructed from the detail + * message of the supplied causal exception. If the cause is null, + * then the detail message will also be null. Otherwise, the detail + * message of this exception will be that of the causal exception. + * This makes this constructor very useful for simply wrapping another + * exception. + * </p> + * + * @param cause the cause of this exception, or null if the cause + * is unknown. + * @since 1.5 + */ + public IllegalStateException(Throwable cause) + { + super(cause); + } + } + diff --git a/libjava/classpath/java/lang/Integer.java b/libjava/classpath/java/lang/Integer.java index 07be4e30728..53de9ab9667 100644 --- a/libjava/classpath/java/lang/Integer.java +++ b/libjava/classpath/java/lang/Integer.java @@ -718,12 +718,12 @@ public final class Integer extends Number implements Comparable int len = str.length(); boolean isNeg = false; if (len == 0) - throw new NumberFormatException(); + throw new NumberFormatException("string length is null"); int ch = str.charAt(index); if (ch == '-') { if (len == 1) - throw new NumberFormatException(); + throw new NumberFormatException("pure '-'"); isNeg = true; ch = str.charAt(++index); } @@ -748,7 +748,7 @@ public final class Integer extends Number implements Comparable } } if (index == len) - throw new NumberFormatException(); + throw new NumberFormatException("non terminated number: " + str); int max = MAX_VALUE / radix; // We can't directly write `max = (MAX_VALUE + 1) / radix'. @@ -760,12 +760,12 @@ public final class Integer extends Number implements Comparable while (index < len) { if (val < 0 || val > max) - throw new NumberFormatException(); + throw new NumberFormatException("number overflow (pos=" + index + ") : " + str); ch = Character.digit(str.charAt(index++), radix); val = val * radix + ch; if (ch < 0 || (val < 0 && (! isNeg || val != MIN_VALUE))) - throw new NumberFormatException(); + throw new NumberFormatException("invalid character at position " + index + " in " + str); } return isNeg ? -val : val; } diff --git a/libjava/classpath/java/lang/SecurityException.java b/libjava/classpath/java/lang/SecurityException.java index a95d797054f..84be33ce026 100644 --- a/libjava/classpath/java/lang/SecurityException.java +++ b/libjava/classpath/java/lang/SecurityException.java @@ -45,8 +45,9 @@ package java.lang; * * @author Brian Jones * @author Warren Levy (warrenl@cygnus.com) + * @author Andrew John Hughes (gnu_andrew@member.fsf.org) * @see SecurityManager - * @status updated to 1.4 + * @status updated to 1.5 */ public class SecurityException extends RuntimeException { @@ -71,4 +72,57 @@ public class SecurityException extends RuntimeException { super(s); } + + /** + * <p> + * Constructs a <code>SecurityException</code> using + * the specified error message, which should give further details + * as to the reason for this exception. The specified cause + * <code>Throwable</code> may be used to provide additional history, + * with regards to the root of the problem. It is perfectly valid + * for this to be null, if the cause of the problem is unknown. + * </p> + * <p> + * <strong>Note</strong>: the detail message from the cause is not + * automatically incorporated into the resulting detail message of + * this exception. + * </p> + * + * @param message the detail message, which should give the reason for + * this exception being thrown. + * @param cause the cause of this exception, or null if the cause + * is unknown. + * @since 1.5 + */ + public SecurityException(String message, Throwable cause) + { + super(message, cause); + } + + /** + * <p> + * Constructs a <code>SecurityException</code> using + * the specified cause <code>Throwable</code>, which may be used + * to provide additional history, with regards to the root of the + * problem. It is perfectly valid for this to be null, if the + * cause of the problem is unknown. + * </p> + * <p> + * The detail message is automatically constructed from the detail + * message of the supplied causal exception. If the cause is null, + * then the detail message will also be null. Otherwise, the detail + * message of this exception will be that of the causal exception. + * This makes this constructor very useful for simply wrapping another + * exception. + * </p> + * + * @param cause the cause of this exception, or null if the cause + * is unknown. + * @since 1.5 + */ + public SecurityException(Throwable cause) + { + super(cause); + } + } diff --git a/libjava/classpath/java/lang/UnsupportedOperationException.java b/libjava/classpath/java/lang/UnsupportedOperationException.java index 0387d0ee29d..e691cc7c9ec 100644 --- a/libjava/classpath/java/lang/UnsupportedOperationException.java +++ b/libjava/classpath/java/lang/UnsupportedOperationException.java @@ -44,8 +44,9 @@ package java.lang; * requested of it that it does not support. * * @author Warren Levy (warrenl@cygnus.com) + * @author Andrew John Hughes (gnu_andrew@member.fsf.org) * @since 1.2 - * @status updated to 1.4 + * @status updated to 1.5 */ public class UnsupportedOperationException extends RuntimeException { @@ -70,4 +71,57 @@ public class UnsupportedOperationException extends RuntimeException { super(s); } + + /** + * <p> + * Constructs a <code>UnsupportedOperationException</code> using + * the specified error message, which should give further details + * as to the reason for this exception. The specified cause + * <code>Throwable</code> may be used to provide additional history, + * with regards to the root of the problem. It is perfectly valid + * for this to be null, if the cause of the problem is unknown. + * </p> + * <p> + * <strong>Note</strong>: the detail message from the cause is not + * automatically incorporated into the resulting detail message of + * this exception. + * </p> + * + * @param message the detail message, which should give the reason for + * this exception being thrown. + * @param cause the cause of this exception, or null if the cause + * is unknown. + * @since 1.5 + */ + public UnsupportedOperationException(String message, Throwable cause) + { + super(message, cause); + } + + /** + * <p> + * Constructs a <code>UnsupportedOperationException</code> using + * the specified cause <code>Throwable</code>, which may be used + * to provide additional history, with regards to the root of the + * problem. It is perfectly valid for this to be null, if the + * cause of the problem is unknown. + * </p> + * <p> + * The detail message is automatically constructed from the detail + * message of the supplied causal exception. If the cause is null, + * then the detail message will also be null. Otherwise, the detail + * message of this exception will be that of the causal exception. + * This makes this constructor very useful for simply wrapping another + * exception. + * </p> + * + * @param cause the cause of this exception, or null if the cause + * is unknown. + * @since 1.5 + */ + public UnsupportedOperationException(Throwable cause) + { + super(cause); + } + } diff --git a/libjava/classpath/java/lang/reflect/Proxy.java b/libjava/classpath/java/lang/reflect/Proxy.java index dc1ac87e4e1..7a5fd30de16 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 <b>including the trailing dot</b> @@ -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; |