summaryrefslogtreecommitdiff
path: root/gnu/java/util
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2002-03-22 21:25:19 +0000
committerEric Blake <ebb9@byu.net>2002-03-22 21:25:19 +0000
commit370cbe434846cdc69ba8ce28b1c05843c4639b54 (patch)
tree71d00e855a4d904c6d90fe1797569754c3aa3abb /gnu/java/util
parent80ff2d2e56c4197f143ad2eef85e9173e2be5423 (diff)
downloadclasspath-370cbe434846cdc69ba8ce28b1c05843c4639b54.tar.gz
2002-03-22 Eric Blake <ebb9@email.byu.edu>
Portions of Patch 70: * gnu/java/lang/ClassLoaderHelper.java: Remove special casing for String, which no longer uses this. * gnu/java/lang/Makefile.am (EXTRA_DIST) Add SystemClassLoader.java. * gnu/java/lang/SystemClassLoader.java: New file. * gnu/java/lang/reflect/TypeSignature.java: Clean up, borrowing ideas from java.lang.reflect.Proxy. * gnu/java/util/EmptyEnumeration.java: Improve formatting. * java/lang/ClassLoader.java: Use the new gnu.java.lang.SystemClassLoader, plus support for loading an alternative at startup. * java/lang/reflect/Proxy.java: Fix some off-by-one bugs, use gnu.java.lang.reflect.TypeSignature. * java/sql/DriverManager.java: Throw appropriate exception. * java/util/ResourceBundle.java: Rearrange code to favor common case; use string buffers for speed. * vm/reference/java/lang/Class.java (getClassLoader): Perform security checks. (getComponentType): Fix bugs. * vm/reference/java/lang/Runtime.java: Include "." in search path.
Diffstat (limited to 'gnu/java/util')
-rw-r--r--gnu/java/util/EmptyEnumeration.java86
1 files changed, 47 insertions, 39 deletions
diff --git a/gnu/java/util/EmptyEnumeration.java b/gnu/java/util/EmptyEnumeration.java
index 68aa15a98..4e80499c8 100644
--- a/gnu/java/util/EmptyEnumeration.java
+++ b/gnu/java/util/EmptyEnumeration.java
@@ -1,5 +1,5 @@
-/* gnu.java.util.EmptyEnumeration
- Copyright (C) 2001 Free Software Foundation, Inc.
+/* EmptyEnumeration.java -- a constant empty enumeration
+ Copyright (C) 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -7,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
@@ -37,52 +37,60 @@ exception statement from your version. */
package gnu.java.util;
+import java.io.Serializable;
import java.util.Enumeration;
import java.util.NoSuchElementException;
/**
- * This is a helper class that produces an empty Enumerations.
- * There is only one instance of this class that can be used whenever one
- * needs a non-null but empty enumeration. Using this class prevents multiple
+ * This is a helper class that produces an empty Enumerations. There is only
+ * one instance of this class that can be used whenever one needs a
+ * non-null but empty enumeration. Using this class prevents multiple
* small objects and inner classes. <code>getInstance()</code> returns
* the only instance of this class. It can be shared by multiple objects and
- * threads
- * <p>
- * <code>hasMoreElements()</code> always returns <code>false</code>.
- * <code>nextElement()</code> always throws <code>NoSuchElementException</code>.
- *
+ * threads.
+ *
* @author Mark Wielaard (mark@klomp.org)
*/
-public final class EmptyEnumeration implements Enumeration {
-
- /** The only instance of this class */
- private static final EmptyEnumeration instance = new EmptyEnumeration();
+public final class EmptyEnumeration implements Enumeration, Serializable
+{
+ /** The only instance of this class */
+ private static final EmptyEnumeration instance = new EmptyEnumeration();
- /**
- * Private constructor that creates a new empty Enumeration.
- */
- private EmptyEnumeration() {
- }
+ /**
+ * Private constructor that creates a new empty Enumeration.
+ */
+ private EmptyEnumeration()
+ {
+ }
- /**
- * Returns the only instance of this class.
- * It can be shared by multiple objects and threads.
- */
- public static EmptyEnumeration getInstance() {
- return instance;
- }
+ /**
+ * Returns the only instance of this class.
+ * It can be shared by multiple objects and threads.
+ *
+ * @return the common empty enumeration
+ */
+ public static EmptyEnumeration getInstance()
+ {
+ return instance;
+ }
- /**
- * Always returns <code>false</code>.
- */
- public boolean hasMoreElements() {
- return false;
- }
+ /**
+ * Returns false, since there are no elements.
+ *
+ * @return false
+ */
+ public boolean hasMoreElements()
+ {
+ return false;
+ }
- /**
- * Always throws <code>NoSuchElementException</code>.
- */
- public Object nextElement() throws NoSuchElementException {
- throw new NoSuchElementException();
- }
+ /**
+ * Always throws <code>NoSuchElementException</code>, since it is empty.
+ *
+ * @throws NoSuchElementException this is empty
+ */
+ public Object nextElement()
+ {
+ throw new NoSuchElementException();
+ }
}