RuntimeException.java: Re-merge with Classpath.

* java/lang/RuntimeException.java: Re-merge with Classpath.
	* java/util/ArrayList.java: Likewise.
	* java/util/Arrays.java: Likewise.
	* java/util/BitSet.java: Likewise.
	* java/util/Dictionary.java: Likewise.
	* java/util/IdentityHashMap.java: Likewise.
	* java/util/MissingResourceException.java: Likewise.
	* java/util/Observer.java: Likewise.
	* java/util/TooManyListenersException.java: Likewise.
	* java/util/zip/DataFormatException.java: Likewise.
	* java/util/zip/ZipException.java: Likewise.

From-SVN: r54680
This commit is contained in:
Tom Tromey 2002-06-16 21:15:44 +00:00 committed by Tom Tromey
parent 3d05b15f10
commit 548ce8be4a
12 changed files with 202 additions and 130 deletions

View file

@ -1,3 +1,17 @@
2002-06-16 Tom Tromey <tromey@redhat.com>
* java/lang/RuntimeException.java: Re-merge with Classpath.
* java/util/ArrayList.java: Likewise.
* java/util/Arrays.java: Likewise.
* java/util/BitSet.java: Likewise.
* java/util/Dictionary.java: Likewise.
* java/util/IdentityHashMap.java: Likewise.
* java/util/MissingResourceException.java: Likewise.
* java/util/Observer.java: Likewise.
* java/util/TooManyListenersException.java: Likewise.
* java/util/zip/DataFormatException.java: Likewise.
* java/util/zip/ZipException.java: Likewise.
2002-06-16 Nathanael Nerode <neroden@twcny.rr.com>
* java/rmi/AccessException.java: Remerge from Classpath.

View file

@ -1,6 +1,5 @@
/* RuntimeException.java -- all exceptions which are subclasses of this class
can be thrown at any time during the execution of a Java virtual machine.
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
/* RuntimeException.java -- root of all unchecked exceptions
Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -8,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@ -39,43 +38,65 @@ exception statement from your version. */
package java.lang;
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
* "The Java Language Specification", ISBN 0-201-63451-1
* plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: Believed complete and correct.
*/
/**
* Exceptions may be thrown by one part of a Java program and caught
* by another in order to deal with exceptional conditions.
* All exceptions which are subclasses of <code>RuntimeException</code>
* can be thrown at any time during the execution of a Java virtual machine.
* Methods which throw these exceptions are not required to declare them
* in their throws clause.
*
* @since JDK 1.0
*
* @author Brian Jones
* @author Warren Levy <warrenl@cygnus.com>
* @date September 18, 1998.
* @author Eric Blake <ebb9@email.byu.edu>
* @status updated to 1.4
*/
public class RuntimeException extends Exception
{
static final long serialVersionUID = -7034897190745766939L;
/**
* Compatible with JDK 1.0+.
*/
private static final long serialVersionUID = -7034897190745766939L;
/**
* Create an exception without a message.
* Create an exception without a message. The cause remains uninitialized.
*
* @see #initCause(Throwable)
*/
public RuntimeException()
{
super();
}
{
}
/**
* Create an exception with a message.
* Create an exception with a message. The cause remains uninitialized.
*
* @param s the message string
* @see #initCause(Throwable)
*/
public RuntimeException(String s)
{
super(s);
}
{
super(s);
}
/**
* Create an exception with a message and a cause.
*
* @param s the message string
* @param cause the cause of this exception
* @since 1.4
*/
public RuntimeException(String s, Throwable cause)
{
super(s, cause);
}
/**
* Create an exception with the given cause, and a message of
* <code>cause == null ? null : cause.toString()</code>.
*
* @param cause the cause of this exception
* @since 1.4
*/
public RuntimeException(Throwable cause)
{
super(cause);
}
}

View file

@ -160,7 +160,7 @@ public class ArrayList extends AbstractList
/**
* Guarantees that this list will have at least enough capacity to
* hold minCapacity elements. This implementation will grow the list to
* max(current * 2, minCapacity) if (minCapacity > current). The JCL says
* max(current * 2, minCapacity) if (minCapacity &gt; current). The JCL says
* explictly that "this method increases its capacity to minCap", while
* the JDK 1.3 online docs specify that the list will grow to at least the
* size specified.

View file

@ -2205,9 +2205,9 @@ public class Arrays
* comparable
* @throws NullPointerException if an element is null (since
* null.compareTo cannot work)
* @throws ArrayIndexOutOfBoundsException, if fromIndex and toIndex
* @throws ArrayIndexOutOfBoundsException if fromIndex and toIndex
* are not in range.
* @throws IllegalArgumentException if fromIndex > toIndex
* @throws IllegalArgumentException if fromIndex &gt; toIndex
*/
public static void sort(Object[] a, int fromIndex, int toIndex)
{
@ -2229,9 +2229,9 @@ public class Arrays
* the elements' natural order
* @throws ClassCastException if any two elements are not mutually
* comparable by the Comparator provided
* @throws ArrayIndexOutOfBoundsException, if fromIndex and toIndex
* @throws ArrayIndexOutOfBoundsException if fromIndex and toIndex
* are not in range.
* @throws IllegalArgumentException if fromIndex > toIndex
* @throws IllegalArgumentException if fromIndex &gt; toIndex
* @throws NullPointerException if a null element is compared with natural
* ordering (only possible when c is null)
*/

View file

@ -398,22 +398,24 @@ public class BitSet implements Cloneable, Serializable
* bit <code>k</code> is set in the BitSet (for non-negative values
* of <code>k</code>) if and only if
*
* <pre>
* ((k/64) < bits.length) && ((bits[k/64] & (1L << (bit % 64))) != 0)
* </pre>
* <code>((k/64) &lt; bits.length)
* && ((bits[k/64] & (1L &lt;&lt; (bit % 64))) != 0)
* </code>
*
* Then the following definition of the hashCode method
* would be a correct implementation of the actual algorithm:
*
* <pre>
* public int hashCode() {
* long h = 1234;
* for (int i = bits.length-1; i>=0; i--) {
* h ^= bits[i] * (i + 1);
* }
* return (int)((h >> 32) ^ h);
* }
* </pre>
*
<pre>public int hashCode()
{
long h = 1234;
for (int i = bits.length-1; i &gt;= 0; i--)
{
h ^= bits[i] * (i + 1);
}
return (int)((h >> 32) ^ h);
}</pre>
*
* Note that the hash code values changes, if the set is changed.
*
@ -526,10 +528,11 @@ public class BitSet implements Cloneable, Serializable
* Returns the index of the next true bit, from the specified bit
* (inclusive). If there is none, -1 is returned. You can iterate over
* all true bits with this loop:<br>
* <pre>
* for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1))
* { // operate on i here }
* </pre>
*
<pre>for (int i = bs.nextSetBit(0); i &gt;= 0; i = bs.nextSetBit(i + 1))
{
// operate on i here
}</pre>
*
* @param from the start location
* @return the first true bit, or -1

View file

@ -1,6 +1,6 @@
/* Dictionary.java -- an abstract (and essentially worthless)
class which is Hashtable's superclass
Copyright (C) 1998, 2001 Free Software Foundation, Inc.
Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -47,18 +47,21 @@ package java.util;
* People at Javasoft are probably embarrassed by it. At this point,
* it might as well be an interface rather than a class, but it remains
* this poor, laughable skeleton for the sake of backwards compatibility.
* At any rate, this was what came before the <pre>Map</pre> interface
* At any rate, this was what came before the {@link Map} interface
* in the Collections framework.
*
* @author Jon Zeppieri
* @author Eric Blake <ebb9@email.byu.edu>
* @author Eric Blake (ebb9@email.byu.edu)
* @see Map
* @see Hashtable
* @since 1.0
* @status updated to 1.4
*/
public abstract class Dictionary extends Object
public abstract class Dictionary
{
// WARNING: Dictionary is a CORE class in the bootstrap cycle. See the
// comments in vm/reference/java/lang/Runtime for implications of this fact.
/**
* Sole constructor (often called implicitly).
*/
@ -130,4 +133,4 @@ public abstract class Dictionary extends Object
* @return the number of keys in the Dictionary
*/
public abstract int size();
}
} // class Dictionary

View file

@ -162,9 +162,9 @@ public class IdentityHashMap extends AbstractMap
// Need at least two slots, or hash() will break.
if (max < 2)
max = 2;
table = new Object[2 * max];
table = new Object[max << 1];
Arrays.fill(table, emptyslot);
threshold = max / 4 * 3;
threshold = (max >> 2) * 3;
}
/**
@ -176,7 +176,7 @@ public class IdentityHashMap extends AbstractMap
*/
public IdentityHashMap(Map m)
{
this(Math.max(m.size() * 2, DEFAULT_CAPACITY));
this(Math.max(m.size() << 1, DEFAULT_CAPACITY));
putAll(m);
}
@ -341,12 +341,14 @@ public class IdentityHashMap extends AbstractMap
}
/**
* Return the value in this Map associated with the supplied key,
* or <pre>null</pre> if the key maps to nothing. NOTE: Since the value
* could also be null, you must use containsKey to see if this key
* actually maps to something. Unlike normal maps, this tests for the key
* with <code>entry == key</code> instead of
* <code>entry == null ? key == null : entry.equals(key)</code>.
* Return the value in this Map associated with the supplied key, or
* <code>null</code> if the key maps to nothing.
*
* <p>NOTE: Since the value could also be null, you must use
* containsKey to see if this key actually maps to something.
* Unlike normal maps, this tests for the key with <code>entry ==
* key</code> instead of <code>entry == null ? key == null :
* entry.equals(key)</code>.
*
* @param key the key for which to fetch an associated value
* @return what the key maps to, if present
@ -487,10 +489,10 @@ public class IdentityHashMap extends AbstractMap
Object[] old = table;
// This isn't necessarily prime, but it is an odd number of key/value
// slots, which has a higher probability of fewer collisions.
table = new Object[old.length * 2 + 2];
table = new Object[old.length << 1 + 2];
Arrays.fill(table, emptyslot);
size = 0;
threshold = (table.length / 2) / 4 * 3;
threshold = (table.length >>> 3) * 3;
for (int i = old.length - 2; i >= 0; i -= 2)
{
@ -531,13 +533,15 @@ public class IdentityHashMap extends AbstractMap
}
/**
* Removes from the HashMap and returns the value which is mapped by the
* supplied key. If the key maps to nothing, then the HashMap remains
* unchanged, and <pre>null</pre> is returned. NOTE: Since the value
* could also be null, you must use containsKey to see if you are
* actually removing a mapping. Unlike normal maps, this tests for the
* key with <code>entry == key</code> instead of
* <code>entry == null ? key == null : entry.equals(key)</code>.
* Removes from the HashMap and returns the value which is mapped by
* the supplied key. If the key maps to nothing, then the HashMap
* remains unchanged, and <code>null</code> is returned.
*
* NOTE: Since the value could also be null, you must use
* containsKey to see if you are actually removing a mapping.
* Unlike normal maps, this tests for the key with <code>entry ==
* key</code> instead of <code>entry == null ? key == null :
* entry.equals(key)</code>.
*
* @param key the key used to locate the value to remove
* @return whatever the key mapped to, if present
@ -642,7 +646,7 @@ public class IdentityHashMap extends AbstractMap
// By requiring at least 2 key/value slots, and rehashing at 75%
// capacity, we guarantee that there will always be either an emptyslot
// or a tombstone somewhere in the table.
int h = 2 * Math.abs(System.identityHashCode(key) % (table.length / 2));
int h = Math.abs(System.identityHashCode(key) % (table.length >> 1)) << 1;
int del = -1;
int save = h;
@ -735,7 +739,8 @@ public class IdentityHashMap extends AbstractMap
/**
* Removes from the backing Map the last element which was fetched
* with the <pre>next()</pre> method.
* with the <code>next()</code> method.
*
* @throws ConcurrentModificationException if the Map was modified
* @throws IllegalStateException if called when there is no last element
*/
@ -894,7 +899,7 @@ public class IdentityHashMap extends AbstractMap
s.defaultReadObject();
int num = s.readInt();
table = new Object[2 * Math.max(num * 2, DEFAULT_CAPACITY)];
table = new Object[Math.max(num << 1, DEFAULT_CAPACITY) << 1];
// Read key/value pairs.
while (--num >= 0)
put(s.readObject(), s.readObject());

View file

@ -1,5 +1,5 @@
/* java.util.MissingResourceException
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
/* MissingResourceException.java -- thrown for a missing resource
Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -38,38 +38,42 @@ exception statement from your version. */
package java.util;
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
* "The Java Language Specification", ISBN 0-201-63451-1
* plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: Believed complete and correct.
*/
/**
* This exception is thrown when a resource is missing.
*
* @see ResourceBundle
* @author Jochen Hoenicke
* @author Warren Levy <warrenl@cygnus.com>
* @see ResourceBundle
* @since 1.1
* @status updated to 1.4
*/
public class MissingResourceException extends RuntimeException
{
/**
* Compatible with JDK 1.1+.
*/
private static final long serialVersionUID = -4876345176062000401L;
/**
* The name of the resource bundle requested by user.
*
* @serial the class name of the resource bundle
*/
private String className;
private final String className;
/**
* The key of the resource in the bundle requested by user.
*
* @serial the name of the resouce
*/
private String key;
private final String key;
/**
* Creates a new exception, with the specified parameters.
* @param s the detail message.
* @param className the name of the resource bundle.
* @param key the key of the missing resource.
*
* @param s the detail message
* @param className the name of the resource bundle
* @param key the key of the missing resource
*/
public MissingResourceException(String s, String className, String key)
{
@ -80,7 +84,8 @@ public class MissingResourceException extends RuntimeException
/**
* Gets the name of the resource bundle, for which a resource is missing.
* @return the name of the resource bundle.
*
* @return the name of the resource bundle
*/
public String getClassName()
{
@ -90,7 +95,8 @@ public class MissingResourceException extends RuntimeException
/**
* Gets the key of the resource that is missing bundle, this is an empty
* string if the whole resource bundle is missing.
* @return the name of the resource bundle.
*
* @return the name of the resource bundle
*/
public String getKey()
{

View file

@ -1,6 +1,5 @@
/* Implemented when a class wants to be informed of changes in Observable
objects.
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
/* Observer.java -- an object that will be informed of changes in an Observable
Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -39,21 +38,23 @@ exception statement from your version. */
package java.util;
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
* "The Java Language Specification", ISBN 0-201-63451-1
* plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: Believed complete and correct
*/
/**
* Interface that is implemented when a class wants to be informed of changes
* in Observable objects.
*
* @see java.util.Observable
* @author Warren Levy <warrenl@cygnus.com>
* @date August 25, 1998.
* @see Observable
* @status updated to 1.4
*/
public interface Observer
{
/**
* This method is called whenever the observable object changes, and has
* called <code>notifyObservers</code>. The Observable object can pass
* arbitrary information in the second parameter.
*
* @param observable the Observable object that changed
* @param arg arbitrary information, usually relating to the change
*/
public void update(Observable observable, Object arg);
}

View file

@ -1,5 +1,6 @@
/* java.util.TooManyListenersException
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
/* TooManyListenersException.java -- thrown when a unicast event can't accept
another Listener
Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -38,26 +39,24 @@ exception statement from your version. */
package java.util;
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
* "The Java Language Specification", ISBN 0-201-63451-1
* plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: Believed complete and correct.
*/
/**
* This exception is part of the java event model. It is thrown if an
* event listener is added via the addXyzEventListener method, but the
* object doesn't support any more listeners, e.g. it only supports a
* single event listener.
*
* @author Jochen Hoenicke
* @author Warren Levy <warrenl@cygnus.com>
* @see EventListener
* @see EventObject
* @author Jochen Hoenicke
* @author Warren Levy <warrenl@cygnus.com>
* @since 1.1
* @status updated to 1.4
*/
public class TooManyListenersException extends Exception
{
/**
* Compatible with JDK 1.1+.
*/
private static final long serialVersionUID = 5074640544770687831L;
/**
@ -69,7 +68,8 @@ public class TooManyListenersException extends Exception
/**
* Constructs a TooManyListenersException with a detail message.
* @param detail the detail message.
*
* @param detail the detail message
*/
public TooManyListenersException(String detail)
{

View file

@ -1,5 +1,5 @@
/* DataformatException.java - Exception thrown when compressed data is corrupt
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
/* DataformatException.java -- thrown when compressed data is corrupt
Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -37,25 +37,34 @@ exception statement from your version. */
package java.util.zip;
/* Written using on-line Java Platform 1.2 API Specification.
* Believed complete and correct.
*/
/**
* Exception thrown when compressed data is corrupt.
*
* @author Tom Tromey
* @author John Leuner
* @since JDK 1.1
* @since 1.1
* @status updated to 1.4
*/
public class DataFormatException extends Exception
{
public DataFormatException ()
/**
* Compatible with JDK 1.1+.
*/
private static final long serialVersionUID = 2219632870893641452L;
/**
* Create an exception without a message.
*/
public DataFormatException()
{
super();
}
public DataFormatException (String msg)
/**
* Create an exception with a message.
*
* @param msg the message
*/
public DataFormatException(String msg)
{
super(msg);
}

View file

@ -1,5 +1,5 @@
/* ZipException.java - Exception representing a zip related error
Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
/* ZipException.java - exception representing a zip related error
Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -37,24 +37,34 @@ exception statement from your version. */
package java.util.zip;
/* Written using on-line Java Platform 1.2 API Specification.
* Believed complete and correct.
*/
import java.io.IOException;
/**
* Is thrown during the creation or input of a zip file.
* Thrown during the creation or input of a zip file.
*
* @author Jochen Hoenicke
* @author Per Bothner
* @since JDK 1.1
* @status updated to 1.4
*/
public class ZipException extends java.io.IOException
public class ZipException extends IOException
{
public ZipException ()
/**
* Compatible with JDK 1.0+.
*/
private static final long serialVersionUID = 8000196834066748623L;
/**
* Create an exception without a message.
*/
public ZipException()
{
super();
}
/**
* Create an exception with a message.
*
* @param msg the message
*/
public ZipException (String msg)
{
super(msg);