Patches for unnesesary checked exceptions
Aaron Place
beavis at ihug.co.nz
Fri Jul 16 21:06:18 PDT 1999
Here are some patches to change modifiers and checked exceptions to be
more inline with the spec.
Aaron.
-------------- next part --------------
Index: libraries/javalib/java/io/ObjectInputStream.java
===================================================================
RCS file: /home/cvspublic/kaffe/libraries/javalib/java/io/ObjectInputStream.java,v
retrieving revision 1.9
diff -u -r1.9 ObjectInputStream.java
--- ObjectInputStream.java 1999/02/10 05:01:36 1.9
+++ ObjectInputStream.java 1999/07/11 08:57:05
@@ -51,7 +51,7 @@
in.close();
}
-protected final boolean enableResolveObject(boolean enable) throws SecurityException
+protected boolean enableResolveObject(boolean enable) throws SecurityException
{
boolean old = enableResolve;
enableResolve = enable;
@@ -180,7 +180,7 @@
return (obj);
}
-public final void defaultReadObject() throws IOException, ClassNotFoundException, NotActiveException
+public void defaultReadObject() throws IOException, ClassNotFoundException, NotActiveException
{
if (currentObject == null || currentStreamClass == null) {
throw new NotActiveException();
Index: libraries/javalib/java/io/ObjectOutputStream.java
===================================================================
RCS file: /home/cvspublic/kaffe/libraries/javalib/java/io/ObjectOutputStream.java,v
retrieving revision 1.5
diff -u -r1.5 ObjectOutputStream.java
--- ObjectOutputStream.java 1999/02/10 05:01:36 1.5
+++ ObjectOutputStream.java 1999/07/11 08:57:05
@@ -45,7 +45,7 @@
out.close();
}
-protected final boolean enableReplaceObject(boolean enable) throws SecurityException {
+protected boolean enableReplaceObject(boolean enable) throws SecurityException {
boolean old = enableReplace;
enableReplace = enable;
return (old);
@@ -135,7 +135,7 @@
out.writeObject(obj);
}
-public final void defaultWriteObject() throws IOException {
+public void defaultWriteObject() throws IOException {
if (currentObject == null || currentStreamClass == null) {
throw new NotActiveException();
}
Index: libraries/javalib/java/io/StringReader.java
===================================================================
RCS file: /home/cvspublic/kaffe/libraries/javalib/java/io/StringReader.java,v
retrieving revision 1.2
diff -u -r1.2 StringReader.java
--- StringReader.java 1998/12/09 23:20:13 1.2
+++ StringReader.java 1999/07/11 08:57:05
@@ -65,7 +65,7 @@
}
}
-public boolean ready()
+public boolean ready() throws IOException
{
return (true);
}
Index: libraries/javalib/java/io/StringWriter.java
===================================================================
RCS file: /home/cvspublic/kaffe/libraries/javalib/java/io/StringWriter.java,v
retrieving revision 1.3
diff -u -r1.3 StringWriter.java
--- StringWriter.java 1999/04/25 13:42:22 1.3
+++ StringWriter.java 1999/07/11 08:57:05
@@ -62,7 +62,7 @@
// Does nothing.
}
- public void close()
+ public void close() throws IOException
{
// Does nothing.
}
Index: libraries/javalib/java/lang/ClassLoader.java
===================================================================
RCS file: /home/cvspublic/kaffe/libraries/javalib/java/lang/ClassLoader.java,v
retrieving revision 1.13
diff -u -r1.13 ClassLoader.java
--- ClassLoader.java 1999/06/10 19:40:22 1.13
+++ ClassLoader.java 1999/07/11 08:57:06
@@ -37,7 +37,7 @@
this.parent = parent;
}
-final protected Class defineClass(String name, byte data[], int offset, int length) {
+final protected Class defineClass(String name, byte data[], int offset, int length) throws ClassFormatError {
Class clazz =defineClass0(name, data, offset, length);
if (name != null) {
loadedClasses.put(name, clazz);
@@ -50,7 +50,7 @@
/**
* @deprecated
*/
-final protected Class defineClass(byte data[], int offset, int length) {
+final protected Class defineClass(byte data[], int offset, int length) throws ClassFormatError {
return (defineClass(null, data, offset, length));
}
@@ -70,7 +70,7 @@
return (null); // Default implementation just returns null
}
-final public static URL getSystemResource(String name) {
+public static URL getSystemResource(String name) {
try {
return (new URL("system", "", 0, name));
}
@@ -79,7 +79,7 @@
}
}
-public static final InputStream getSystemResourceAsStream(String name) {
+public static InputStream getSystemResourceAsStream(String name) {
byte[] data = getSystemResourceAsBytes0(name);
return (data != null) ? new ByteArrayInputStream(data) : null;
}
Index: libraries/javalib/java/math/BigDecimal.java
===================================================================
RCS file: /home/cvspublic/kaffe/libraries/javalib/java/math/BigDecimal.java,v
retrieving revision 1.3
diff -u -r1.3 BigDecimal.java
--- BigDecimal.java 1999/07/08 18:06:26 1.3
+++ BigDecimal.java 1999/07/11 08:57:07
@@ -22,11 +22,11 @@
public static final int ROUND_HALF_EVEN = 7;
public static final int ROUND_UNNECESSARY = 8;
-public BigDecimal(String val) throws NumberFormatException {
+public BigDecimal(String val) {
throw new kaffe.util.NotImplemented();
}
-public BigDecimal(double val) throws NumberFormatException {
+public BigDecimal(double val) {
throw new kaffe.util.NotImplemented();
}
@@ -34,11 +34,11 @@
throw new kaffe.util.NotImplemented();
}
-public BigDecimal(BigInteger val, int scale) throws NumberFormatException {
+public BigDecimal(BigInteger val, int scale) {
throw new kaffe.util.NotImplemented();
}
-public static BigDecimal valueOf(long val, int scale) throws NumberFormatException {
+public static BigDecimal valueOf(long val, int scale) {
throw new kaffe.util.NotImplemented();
}
@@ -58,11 +58,11 @@
throw new kaffe.util.NotImplemented();
}
-public BigDecimal divide(BigDecimal val, int scale, int roundingMode) throws ArithmeticException, IllegalArgumentException {
+public BigDecimal divide(BigDecimal val, int scale, int roundingMode) {
throw new kaffe.util.NotImplemented();
}
-public BigDecimal divide(BigDecimal val, int roundingMode) throws ArithmeticException, IllegalArgumentException {
+public BigDecimal divide(BigDecimal val, int roundingMode) {
throw new kaffe.util.NotImplemented();
}
@@ -82,11 +82,11 @@
throw new kaffe.util.NotImplemented();
}
-public BigDecimal setScale(int scale, int roundingMode) throws ArithmeticException, IllegalArgumentException {
+public BigDecimal setScale(int scale, int roundingMode) {
throw new kaffe.util.NotImplemented();
}
-public BigDecimal setScale(int scale) throws ArithmeticException, IllegalArgumentException {
+public BigDecimal setScale(int scale) {
throw new kaffe.util.NotImplemented();
}
Index: libraries/javalib/java/math/BigInteger.java
===================================================================
RCS file: /home/cvspublic/kaffe/libraries/javalib/java/math/BigInteger.java,v
retrieving revision 1.12
diff -u -r1.12 BigInteger.java
--- BigInteger.java 1999/07/08 18:06:26 1.12
+++ BigInteger.java 1999/07/11 08:57:10
@@ -35,7 +35,7 @@
ONE = new BigInteger(1L);
}
-public BigInteger(byte val[]) throws NumberFormatException {
+public BigInteger(byte val[]) {
this();
if (val.length == 0)
throw new NumberFormatException("val.length == 0");
@@ -51,7 +51,7 @@
}
}
-public BigInteger(int signum, byte magnitude[]) throws NumberFormatException {
+public BigInteger(int signum, byte magnitude[]) {
this();
switch (signum) {
case -1:
@@ -68,21 +68,20 @@
}
}
-public BigInteger(String val, int radix) throws NumberFormatException {
+public BigInteger(String val, int radix) {
this();
assignString0(val, radix);
}
-public BigInteger(String val) throws NumberFormatException {
+public BigInteger(String val) {
this(val, 10);
}
-public BigInteger(int numBits, Random rndSrc) throws IllegalArgumentException {
+public BigInteger(int numBits, Random rndSrc) {
this(1, randBytes(numBits, rndSrc));
}
-private static byte[] randBytes(int numBits, Random rndSrc)
- throws IllegalArgumentException {
+private static byte[] randBytes(int numBits, Random rndSrc) {
if (numBits < 0)
throw new IllegalArgumentException("numBits < 0");
int extra = numBits % 8;
@@ -145,7 +144,7 @@
return (new BigInteger(val));
}
-public BigInteger add(BigInteger val) throws ArithmeticException {
+public BigInteger add(BigInteger val) {
BigInteger r = new BigInteger();
r.add0(this, val);
return (r);
@@ -163,26 +162,26 @@
return (r);
}
-public BigInteger divide(BigInteger val) throws ArithmeticException {
+public BigInteger divide(BigInteger val) {
BigInteger r = new BigInteger();
r.div0(this, val);
return (r);
}
-public BigInteger remainder(BigInteger val) throws ArithmeticException {
+public BigInteger remainder(BigInteger val) {
BigInteger r = new BigInteger();
r.rem0(this, val);
return (r);
}
-public BigInteger[] divideAndRemainder(BigInteger val) throws ArithmeticException {
+public BigInteger[] divideAndRemainder(BigInteger val) {
BigInteger q = new BigInteger();
BigInteger r = new BigInteger();
divrem0(q, r, this, val);
return (new BigInteger[]{ q, r });
}
-public BigInteger pow(int exponent) throws ArithmeticException {
+public BigInteger pow(int exponent) {
BigInteger r = new BigInteger();
r.pow0(this, exponent);
return (r);
@@ -222,7 +221,7 @@
return (r);
}
-public BigInteger modInverse(BigInteger mod) throws ArithmeticException {
+public BigInteger modInverse(BigInteger mod) {
BigInteger r = new BigInteger();
r.modinv0(this, mod);
return (r);
@@ -273,7 +272,7 @@
return (r);
}
-public boolean testBit(int n) throws ArithmeticException {
+public boolean testBit(int n) {
BigInteger b = new BigInteger();
b.setbit0(this, n);
if (cmp0(b, this) == 0) {
@@ -284,19 +283,19 @@
}
}
-public BigInteger setBit(int n) throws ArithmeticException {
+public BigInteger setBit(int n) {
BigInteger r = new BigInteger();
r.setbit0(this, n);
return (r);
}
-public BigInteger clearBit(int n) throws ArithmeticException {
+public BigInteger clearBit(int n) {
BigInteger r = new BigInteger();
r.clrbit0(this, n);
return (r);
}
-public BigInteger flipBit(int n) throws ArithmeticException {
+public BigInteger flipBit(int n) {
BigInteger r = new BigInteger();
r.setbit0(r, n);
r.xor0(r, this);
Index: libraries/javalib/java/net/ServerSocket.java
===================================================================
RCS file: /home/cvspublic/kaffe/libraries/javalib/java/net/ServerSocket.java,v
retrieving revision 1.7
diff -u -r1.7 ServerSocket.java
--- ServerSocket.java 1999/02/10 21:34:47 1.7
+++ ServerSocket.java 1999/07/11 08:57:11
@@ -87,7 +87,7 @@
return (impl.getLocalPort());
}
-public synchronized int getSoTimeout() throws SocketException {
+public synchronized int getSoTimeout() throws IOException {
return ((Integer) impl.getOption(SocketOptions.SO_TIMEOUT)).intValue();
}
Index: libraries/javalib/java/text/DecimalFormatSymbols.java
===================================================================
RCS file: /home/cvspublic/kaffe/libraries/javalib/java/text/DecimalFormatSymbols.java,v
retrieving revision 1.8
diff -u -r1.8 DecimalFormatSymbols.java
--- DecimalFormatSymbols.java 1999/07/05 20:50:55 1.8
+++ DecimalFormatSymbols.java 1999/07/11 08:57:12
@@ -15,7 +15,7 @@
import java.util.ResourceBundle;
import java.util.Locale;
-public class DecimalFormatSymbols implements Serializable, Cloneable {
+public final class DecimalFormatSymbols implements Serializable, Cloneable {
private static final long serialVersionUID = 5772796243397350300L;
char digit;
Index: libraries/javalib/java/util/BitSet.java
===================================================================
RCS file: /home/cvspublic/kaffe/libraries/javalib/java/util/BitSet.java,v
retrieving revision 1.10
diff -u -r1.10 BitSet.java
--- BitSet.java 1999/07/05 20:50:56 1.10
+++ BitSet.java 1999/07/11 08:57:14
@@ -15,7 +15,7 @@
import java.lang.System;
import java.io.Serializable;
-final public class BitSet
+public class BitSet
implements Cloneable, Serializable
{
private static final long serialVersionUID = 7997698588986878753L;
Index: libraries/javalib/java/util/Random.java
===================================================================
RCS file: /home/cvspublic/kaffe/libraries/javalib/java/util/Random.java,v
retrieving revision 1.6
diff -u -r1.6 Random.java
--- Random.java 1999/03/24 01:14:50 1.6
+++ Random.java 1999/07/11 08:57:14
@@ -21,9 +21,9 @@
*/
public class Random implements Serializable
{
- protected long seed;
- protected boolean haveNextNextGaussian;
- protected double nextNextGaussian;
+ private long seed;
+ private boolean haveNextNextGaussian;
+ private double nextNextGaussian;
private static final long serialVersionUID = 3905348978240129619L;
final private long p1 = 0x5DEECE66DL;
Index: libraries/javalib/java/util/Vector.java
===================================================================
RCS file: /home/cvspublic/kaffe/libraries/javalib/java/util/Vector.java,v
retrieving revision 1.13
diff -u -r1.13 Vector.java
--- Vector.java 1999/03/24 01:14:51 1.13
+++ Vector.java 1999/07/11 08:57:15
@@ -56,14 +56,14 @@
capacityIncrement = increment;
}
-final public synchronized void addElement(Object obj) {
+public synchronized void addElement(Object obj) {
if (elementCount == elementData.length) {
increaseCapacity();
}
elementData[elementCount++] = obj;
}
-final public int capacity() {
+public int capacity() {
return elementData.length;
}
@@ -83,11 +83,11 @@
}
}
-final public boolean contains(Object elem) {
+public boolean contains(Object elem) {
return (indexOf(elem) != -1);
}
-final public synchronized void copyInto ( Object anArray[] ) {
+public synchronized void copyInto ( Object anArray[] ) {
System.arraycopy( elementData, 0, anArray, 0, elementCount);
}
@@ -110,7 +110,7 @@
return anArray;
}
-final public synchronized Object elementAt ( int index ) {
+public synchronized Object elementAt ( int index ) {
// required because we might have a large enough, pre-allocated, empty element
// array that doesn't give us (physical) access errors
if ( index >= elementCount )
@@ -119,11 +119,11 @@
return elementData[index];
}
-final public synchronized Enumeration elements () {
+public synchronized Enumeration elements () {
return new Vector.Enumerator();
}
-final public synchronized void ensureCapacity(int newCapacity) {
+public synchronized void ensureCapacity(int newCapacity) {
if (elementData.length < newCapacity) {
Object oldBuffer[] = elementData;
elementData = new Object[newCapacity];
@@ -131,7 +131,7 @@
}
}
-final public synchronized Object firstElement () {
+public synchronized Object firstElement () {
if ( elementCount <= 0 ) {
throw new NoSuchElementException();
}
@@ -158,11 +158,11 @@
System.arraycopy(oldBuffer, 0, elementData, 0, elementCount);
}
-final public int indexOf(Object elem) {
+public int indexOf(Object elem) {
return indexOf(elem, 0);
}
-final public synchronized int indexOf(Object elem, int index) {
+public synchronized int indexOf(Object elem, int index) {
for (int pos = index; pos < elementCount; pos++) {
Object obj = elementData[pos];
if (elem == obj || elem.equals(obj)) {
@@ -172,7 +172,7 @@
return (-1);
}
-final public synchronized void insertElementAt ( Object obj, int index ) {
+public synchronized void insertElementAt ( Object obj, int index ) {
if ( elementCount == elementData.length ) {
increaseCapacity();
@@ -189,22 +189,22 @@
elementCount++;
}
-final public boolean isEmpty () {
+public boolean isEmpty () {
return (elementCount == 0);
}
-final public synchronized Object lastElement () {
+public synchronized Object lastElement () {
if ( elementCount == 0 ) {
throw new NoSuchElementException();
}
return elementData[elementCount-1];
}
-final public int lastIndexOf(Object elem) {
+public int lastIndexOf(Object elem) {
return (lastIndexOf(elem, size()-1));
}
-final public synchronized int lastIndexOf(Object elem, int index) {
+public synchronized int lastIndexOf(Object elem, int index) {
for (int pos = index; pos >= 0; pos--) {
Object obj = elementData[pos];
if (elem == obj || elem.equals(obj)) {
@@ -220,14 +220,14 @@
return (obj);
}
-final public synchronized void removeAllElements () {
+public synchronized void removeAllElements () {
for ( int i=elementCount-1; i>= 0; i-- ) {
elementData[i] = null;
}
elementCount = 0;
}
-final public synchronized boolean removeElement(Object obj) {
+public synchronized boolean removeElement(Object obj) {
if (contains(obj)) {
removeElementAt(indexOf(obj));
return (true);
@@ -237,7 +237,7 @@
}
}
-final public synchronized void removeElementAt ( int index ) {
+public synchronized void removeElementAt ( int index ) {
if ( index >= elementCount ) {
throw new ArrayIndexOutOfBoundsException();
}
@@ -248,7 +248,7 @@
elementData[elementCount] = null;
}
-final public synchronized void setElementAt(Object obj, int index)
+public synchronized void setElementAt(Object obj, int index)
{
if (index >= elementCount) {
throw new ArrayIndexOutOfBoundsException();
@@ -256,16 +256,16 @@
elementData[index] = obj;
}
-final public synchronized void setSize(int newSize) {
+public synchronized void setSize(int newSize) {
ensureCapacity(newSize);
elementCount = newSize;
}
-final public int size() {
+public int size() {
return elementCount;
}
-final public synchronized String toString() {
+public synchronized String toString() {
StringBuffer result = new StringBuffer();
result.append("[");
@@ -279,7 +279,7 @@
return (result.toString());
}
-final public synchronized void trimToSize() {
+public synchronized void trimToSize() {
if (elementCount != elementData.length) {
Object oldBuffer[] = elementData;
elementData = new Object[elementCount];
More information about the kaffe
mailing list