[Patch] Misc Japi clean up
Michael Koch
konqueror@gmx.de
Thu Nov 18 16:12:00 GMT 2004
Hi list,
I just commited the attached patch from Jeroen Frijters to merge it from
GNU classpath.
Michael
2004-11-18 Jeroen Frijters <address@bogus.example.com>
* java/lang/StackTraceElement.java: Made final.
* java/nio/channels/Channels.java: Added private constructor.
* java/rmi/Naming.java: Added private constructor.
* java/rmi/registry/LocateRegistry.java: Added private constructor.
* java/rmi/server/RMIClassLoader.java: Added private constructor.
* java/security/KeyPairGeneratorSpi.java
(clone): Made protected and simplified implementation.
* java/text/DateFormat.java
(allFields): Made package accessible.
* java/text/DecimalFormat.java
(formatInternal): Made private.
* java/text/Format.java
(formatInternal): Made private.
* java/util/logging/Handler.java: Made constructor protected.
* java/util/regex/Matcher.java: Made final.
* java/util/regex/Pattern.java: Made final.
* javax/crypto/CipherInputStream.java
(mark): Corrected mark parameter type (from long to int).
* javax/crypto/ExemptionMechanism.java
(finalize): Added.
* javax/crypto/Mac.java
(getMacLength): Made final.
(clone): Made final.
* javax/imageio/ImageIO.java: Added private constructor.
* javax/imageio/stream/ImageInputStreamImpl.java
(checkClosed): Made final.
* javax/net/ssl/SSLPermission.java: Made final.
* javax/print/DocFlavor.java
(hostEncoding): Added work-around to prevent the field from being
a compile time constant.
* javax/print/attribute/AttributeSetUtilities.java: Added private
constructor.
(UnmodifiableDocAttributeSet): Made private.
(UnmodifiablePrintJobAttributeSet): Made private.
(UnmodifiablePrintRequestAttributeSet): Made private.
(UnmodifiablePrintServiceAttributeSet): Made private.
(SynchronizedAttributeSet): Made private.
(SynchronizedDocAttributeSet): Made private.
(SynchronizedPrintJobAttributeSet): Made private.
(SynchronizedPrintRequestAttributeSet): Made private.
(SynchronizedPrintServiceAttributeSet): Made private.
* javax/security/auth/PrivateCredentialPermission.java: Made final.
-------------- next part --------------
Index: java/lang/StackTraceElement.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/StackTraceElement.java,v
retrieving revision 1.4
diff -u -r1.4 StackTraceElement.java
--- java/lang/StackTraceElement.java 22 Oct 2004 17:14:09 -0000 1.4
+++ java/lang/StackTraceElement.java 18 Nov 2004 15:23:58 -0000
@@ -51,7 +51,7 @@
* @since 1.4
* @status updated to 1.4
*/
-public class StackTraceElement implements Serializable
+public final class StackTraceElement implements Serializable
{
/**
* Compatible with JDK 1.4+.
Index: java/nio/channels/Channels.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/channels/Channels.java,v
retrieving revision 1.10
diff -u -r1.10 Channels.java
--- java/nio/channels/Channels.java 16 Oct 2004 18:06:02 -0000 1.10
+++ java/nio/channels/Channels.java 18 Nov 2004 15:23:58 -0000
@@ -60,6 +60,11 @@
public final class Channels
{
/**
+ * This class isn't intended to be instantiated.
+ */
+ private Channels() {}
+
+ /**
* Constructs a stream that reads bytes from the given channel.
*/
public static InputStream newInputStream(ReadableByteChannel ch)
Index: java/rmi/Naming.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/rmi/Naming.java,v
retrieving revision 1.7
diff -u -r1.7 Naming.java
--- java/rmi/Naming.java 21 Oct 2004 20:14:01 -0000 1.7
+++ java/rmi/Naming.java 18 Nov 2004 15:23:58 -0000
@@ -44,6 +44,10 @@
import java.rmi.registry.Registry;
public final class Naming {
+ /**
+ * This class isn't intended to be instantiated.
+ */
+ private Naming() {}
/**
* Looks for the remote object that is associated with the named service.
Index: java/rmi/registry/LocateRegistry.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/rmi/registry/LocateRegistry.java,v
retrieving revision 1.4
diff -u -r1.4 LocateRegistry.java
--- java/rmi/registry/LocateRegistry.java 21 Oct 2004 20:14:02 -0000 1.4
+++ java/rmi/registry/LocateRegistry.java 18 Nov 2004 15:23:58 -0000
@@ -50,6 +50,10 @@
import java.rmi.server.RemoteRef;
public final class LocateRegistry {
+ /**
+ * This class isn't intended to be instantiated.
+ */
+ private LocateRegistry() {}
public static Registry getRegistry() throws RemoteException {
return (getRegistry("localhost", Registry.REGISTRY_PORT));
Index: java/rmi/server/RMIClassLoader.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/rmi/server/RMIClassLoader.java,v
retrieving revision 1.13
diff -u -r1.13 RMIClassLoader.java
--- java/rmi/server/RMIClassLoader.java 6 Nov 2004 23:22:05 -0000 1.13
+++ java/rmi/server/RMIClassLoader.java 18 Nov 2004 15:23:58 -0000
@@ -55,6 +55,11 @@
*/
public class RMIClassLoader
{
+ /**
+ * This class isn't intended to be instantiated.
+ */
+ private RMIClassLoader() {}
+
private static class MyClassLoader extends URLClassLoader
{
// Package-private to avoid a trampoline constructor.
Index: java/security/KeyPairGeneratorSpi.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/security/KeyPairGeneratorSpi.java,v
retrieving revision 1.4
diff -u -r1.4 KeyPairGeneratorSpi.java
--- java/security/KeyPairGeneratorSpi.java 17 Nov 2002 00:10:24 -0000 1.4
+++ java/security/KeyPairGeneratorSpi.java 18 Nov 2004 15:23:58 -0000
@@ -92,18 +92,11 @@
public abstract KeyPair generateKeyPair();
/**
- Returns a clone of this class.
-
- If cloning is not supported, then by default the class throws a
- CloneNotSupportedException. The MessageDigestSpi provider
- implementation has to overload this class in order to be
- cloneable.
+ * We override clone here to make it accessible for use by
+ * DummyKeyPairGenerator.
*/
- public Object clone() throws CloneNotSupportedException
+ protected Object clone() throws CloneNotSupportedException
{
- if (this instanceof Cloneable)
- return super.clone();
- else
- throw new CloneNotSupportedException();
+ return super.clone();
}
}
Index: java/text/DateFormat.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/text/DateFormat.java,v
retrieving revision 1.17
diff -u -r1.17 DateFormat.java
--- java/text/DateFormat.java 22 Oct 2004 17:14:23 -0000 1.17
+++ java/text/DateFormat.java 18 Nov 2004 15:23:58 -0000
@@ -137,7 +137,7 @@
public static final DateFormat.Field TIME_ZONE
= new Field("timezone", Calendar.ZONE_OFFSET);
- public static final DateFormat.Field[] allFields =
+ static final DateFormat.Field[] allFields =
{
ERA, YEAR, MONTH, DAY_OF_MONTH, HOUR_OF_DAY1,
HOUR_OF_DAY0, MINUTE, SECOND, MILLISECOND,
Index: java/text/DecimalFormat.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/text/DecimalFormat.java,v
retrieving revision 1.19
diff -u -r1.19 DecimalFormat.java
--- java/text/DecimalFormat.java 22 Oct 2004 17:14:23 -0000 1.19
+++ java/text/DecimalFormat.java 18 Nov 2004 15:23:58 -0000
@@ -447,8 +447,8 @@
&& useExponentialNotation == dup.useExponentialNotation);
}
- protected void formatInternal (double number, FormatBuffer dest,
- FieldPosition fieldPos)
+ private void formatInternal (double number, FormatBuffer dest,
+ FieldPosition fieldPos)
{
// A very special case.
if (Double.isNaN(number))
Index: java/text/Format.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/text/Format.java,v
retrieving revision 1.15
diff -u -r1.15 Format.java
--- java/text/Format.java 21 Oct 2004 21:00:06 -0000 1.15
+++ java/text/Format.java 18 Nov 2004 15:23:58 -0000
@@ -70,7 +70,7 @@
{
static final long serialVersionUID = 276966692217360283L;
- public Field(String name)
+ protected Field(String name)
{
super(name);
}
Index: java/util/logging/Handler.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/logging/Handler.java,v
retrieving revision 1.5
diff -u -r1.5 Handler.java
--- java/util/logging/Handler.java 20 Oct 2004 07:53:27 -0000 1.5
+++ java/util/logging/Handler.java 18 Nov 2004 15:23:58 -0000
@@ -85,6 +85,7 @@
* supposed to provide a Formatter, but this is what the specification
* says.
*/
+ protected Handler()
{
level = Level.ALL;
}
Index: java/util/regex/Matcher.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/regex/Matcher.java,v
retrieving revision 1.4
diff -u -r1.4 Matcher.java
--- java/util/regex/Matcher.java 22 Apr 2004 06:46:18 -0000 1.4
+++ java/util/regex/Matcher.java 18 Nov 2004 15:23:58 -0000
@@ -45,7 +45,7 @@
*
* @since 1.4
*/
-public class Matcher
+public final class Matcher
{
private Pattern pattern;
private CharSequence input;
Index: java/util/regex/Pattern.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/regex/Pattern.java,v
retrieving revision 1.6
diff -u -r1.6 Pattern.java
--- java/util/regex/Pattern.java 5 May 2004 06:52:56 -0000 1.6
+++ java/util/regex/Pattern.java 18 Nov 2004 15:23:58 -0000
@@ -50,7 +50,7 @@
*
* @since 1.4
*/
-public class Pattern implements Serializable
+public final class Pattern implements Serializable
{
private static final long serialVersionUID = 5073258162644648461L;
Index: javax/crypto/CipherInputStream.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/crypto/CipherInputStream.java,v
retrieving revision 1.1
diff -u -r1.1 CipherInputStream.java
--- javax/crypto/CipherInputStream.java 21 Sep 2004 08:33:31 -0000 1.1
+++ javax/crypto/CipherInputStream.java 18 Nov 2004 15:23:58 -0000
@@ -294,7 +294,7 @@
*
* @param mark Is ignored.
*/
- public void mark(long mark)
+ public void mark(int mark)
{
}
Index: javax/crypto/ExemptionMechanism.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/crypto/ExemptionMechanism.java,v
retrieving revision 1.2
diff -u -r1.2 ExemptionMechanism.java
--- javax/crypto/ExemptionMechanism.java 21 Oct 2004 20:38:29 -0000 1.2
+++ javax/crypto/ExemptionMechanism.java 18 Nov 2004 15:23:58 -0000
@@ -222,4 +222,8 @@
{
return true;
}
+
+ protected void finalize()
+ {
+ }
}
Index: javax/crypto/Mac.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/crypto/Mac.java,v
retrieving revision 1.2
diff -u -r1.2 Mac.java
--- javax/crypto/Mac.java 21 Oct 2004 20:38:29 -0000 1.2
+++ javax/crypto/Mac.java 18 Nov 2004 15:23:58 -0000
@@ -290,7 +290,7 @@
*
* @return The MAC length.
*/
- public int getMacLength()
+ public final int getMacLength()
{
return macSpi.engineGetMacLength();
}
@@ -404,7 +404,7 @@
* @throws java.lang.CloneNotSupportedException If the underlying
* implementation is not cloneable.
*/
- public Object clone() throws CloneNotSupportedException
+ public final Object clone() throws CloneNotSupportedException
{
Mac result = new Mac((MacSpi) macSpi.clone(), provider, algorithm);
result.virgin = virgin;
Index: javax/imageio/ImageIO.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/imageio/ImageIO.java,v
retrieving revision 1.1
diff -u -r1.1 ImageIO.java
--- javax/imageio/ImageIO.java 6 Nov 2004 18:08:58 -0000 1.1
+++ javax/imageio/ImageIO.java 18 Nov 2004 15:23:58 -0000
@@ -51,6 +51,11 @@
public final class ImageIO
{
+ /**
+ * This class isn't intended to be instantiated.
+ */
+ private ImageIO() {}
+
private static final class ReaderFormatFilter implements ServiceRegistry.Filter
{
private String formatName;
Index: javax/imageio/stream/ImageInputStreamImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/imageio/stream/ImageInputStreamImpl.java,v
retrieving revision 1.1
diff -u -r1.1 ImageInputStreamImpl.java
--- javax/imageio/stream/ImageInputStreamImpl.java 6 Nov 2004 18:09:00 -0000 1.1
+++ javax/imageio/stream/ImageInputStreamImpl.java 18 Nov 2004 15:23:58 -0000
@@ -58,7 +58,7 @@
// Do nothing here.
}
- protected void checkClosed()
+ protected final void checkClosed()
throws IOException
{
if (closed)
Index: javax/net/ssl/SSLPermission.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/net/ssl/SSLPermission.java,v
retrieving revision 1.1
diff -u -r1.1 SSLPermission.java
--- javax/net/ssl/SSLPermission.java 21 Sep 2004 08:33:32 -0000 1.1
+++ javax/net/ssl/SSLPermission.java 18 Nov 2004 15:23:58 -0000
@@ -43,7 +43,7 @@
/**
* A permission used for accessing SSL classes.
*/
-public class SSLPermission extends BasicPermission
+public final class SSLPermission extends BasicPermission
{
// Constant.
Index: javax/print/DocFlavor.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/print/DocFlavor.java,v
retrieving revision 1.2
diff -u -r1.2 DocFlavor.java
--- javax/print/DocFlavor.java 23 Oct 2004 20:06:12 -0000 1.2
+++ javax/print/DocFlavor.java 18 Nov 2004 15:23:59 -0000
@@ -217,7 +217,9 @@
private static final long serialVersionUID = -4512080796965449721L;
- public static final String hostEncoding = "US-ASCII";
+ // FIXME: Get the host encoding from somewhere. Note that the new String is to make
+ // sure the field won't be a compile time constant.
+ public static final String hostEncoding = new String("US-ASCII");
private String mediaSubtype;
private String mediaType;
Index: javax/print/attribute/AttributeSetUtilities.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/print/attribute/AttributeSetUtilities.java,v
retrieving revision 1.3
diff -u -r1.3 AttributeSetUtilities.java
--- javax/print/attribute/AttributeSetUtilities.java 15 May 2004 20:39:09 -0000 1.3
+++ javax/print/attribute/AttributeSetUtilities.java 18 Nov 2004 15:23:59 -0000
@@ -41,6 +41,11 @@
public final class AttributeSetUtilities
{
+ /**
+ * This class isn't intended to be instantiated.
+ */
+ private AttributeSetUtilities() {}
+
private static class UnmodifiableAttributeSet
implements AttributeSet, Serializable
{
@@ -120,7 +125,7 @@
}
}
- public static class UnmodifiableDocAttributeSet
+ private static class UnmodifiableDocAttributeSet
extends UnmodifiableAttributeSet
implements DocAttributeSet, Serializable
{
@@ -130,7 +135,7 @@
}
}
- public static class UnmodifiablePrintJobAttributeSet
+ private static class UnmodifiablePrintJobAttributeSet
extends UnmodifiableAttributeSet
implements PrintJobAttributeSet, Serializable
{
@@ -140,7 +145,7 @@
}
}
- public static class UnmodifiablePrintRequestAttributeSet
+ private static class UnmodifiablePrintRequestAttributeSet
extends UnmodifiableAttributeSet
implements PrintRequestAttributeSet, Serializable
{
@@ -150,7 +155,7 @@
}
}
- public static class UnmodifiablePrintServiceAttributeSet
+ private static class UnmodifiablePrintServiceAttributeSet
extends UnmodifiableAttributeSet
implements PrintServiceAttributeSet, Serializable
{
@@ -160,7 +165,7 @@
}
}
- public static class SynchronizedAttributeSet
+ private static class SynchronizedAttributeSet
implements AttributeSet, Serializable
{
private AttributeSet set;
@@ -239,7 +244,7 @@
}
}
- public static class SynchronizedDocAttributeSet
+ private static class SynchronizedDocAttributeSet
extends SynchronizedAttributeSet
implements DocAttributeSet, Serializable
{
@@ -249,7 +254,7 @@
}
}
- public static class SynchronizedPrintJobAttributeSet
+ private static class SynchronizedPrintJobAttributeSet
extends SynchronizedAttributeSet
implements PrintJobAttributeSet, Serializable
{
@@ -259,7 +264,7 @@
}
}
- public static class SynchronizedPrintRequestAttributeSet
+ private static class SynchronizedPrintRequestAttributeSet
extends SynchronizedAttributeSet
implements PrintRequestAttributeSet, Serializable
{
@@ -269,7 +274,7 @@
}
}
- public static class SynchronizedPrintServiceAttributeSet
+ private static class SynchronizedPrintServiceAttributeSet
extends SynchronizedAttributeSet
implements PrintServiceAttributeSet, Serializable
{
Index: javax/security/auth/PrivateCredentialPermission.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/security/auth/PrivateCredentialPermission.java,v
retrieving revision 1.2
diff -u -r1.2 PrivateCredentialPermission.java
--- javax/security/auth/PrivateCredentialPermission.java 24 Sep 2004 13:25:24 -0000 1.2
+++ javax/security/auth/PrivateCredentialPermission.java 18 Nov 2004 15:23:59 -0000
@@ -63,7 +63,7 @@
* <i>PrincipalName</i> is a string representing the principal, or the
* wildcard character.</p>
*/
-public class PrivateCredentialPermission extends Permission
+public final class PrivateCredentialPermission extends Permission
implements Serializable
{
/**
More information about the Java-patches
mailing list