LogManager.java (loggers): Genericized.
authorTom Tromey <tromey@redhat.com>
Thu, 1 Feb 2007 21:36:01 +0000 (21:36 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Thu, 1 Feb 2007 21:36:01 +0000 (21:36 +0000)
* java/util/logging/LogManager.java (loggers): Genericized.
(addLogger): Merged.
(findAncestor): Likewise.
(getLogger): Likewise.
(getLoggerNames): Genericized.
(reset): Merged.
(getLevelProperty): Likewise.
* java/lang/reflect/Method.java (getDeclaringClass): Genericized.
* java/lang/reflect/Constructor.java (getParameterTypes):
Genericized.
(getExceptionTypes): Likewise.
(newInstance): Likewise.
* java/lang/reflect/Array.java (newInstance): Genericized.
* java/lang/Object.java (getClass): Genericized.
* java/nio/charset/spi/CharsetProvider.java (charsets):
Genericized.
* java/text/Collator.java: Implement Comparable<Object>.

From-SVN: r121473

16 files changed:
libjava/ChangeLog
libjava/classpath/lib/java/lang/Object.class
libjava/classpath/lib/java/lang/reflect/Array.class
libjava/classpath/lib/java/lang/reflect/Constructor.class
libjava/classpath/lib/java/lang/reflect/Method.class
libjava/classpath/lib/java/nio/charset/spi/CharsetProvider.class
libjava/classpath/lib/java/text/Collator.class
libjava/classpath/lib/java/util/logging/LogManager$1.class
libjava/classpath/lib/java/util/logging/LogManager.class
libjava/java/lang/Object.java
libjava/java/lang/reflect/Array.java
libjava/java/lang/reflect/Constructor.java
libjava/java/lang/reflect/Method.java
libjava/java/nio/charset/spi/CharsetProvider.java
libjava/java/text/Collator.java
libjava/java/util/logging/LogManager.java

index a19a97c57ae5cff10838f12840694cb03b5c665e..6e62fff7ce3ee82d2f9f3a678ce204fea8d47394 100644 (file)
@@ -1,3 +1,23 @@
+2007-02-01  Tom Tromey  <tromey@redhat.com>
+
+       * java/util/logging/LogManager.java (loggers): Genericized.
+       (addLogger): Merged.
+       (findAncestor): Likewise.
+       (getLogger): Likewise.
+       (getLoggerNames): Genericized.
+       (reset): Merged.
+       (getLevelProperty): Likewise.
+       * java/lang/reflect/Method.java (getDeclaringClass): Genericized.
+       * java/lang/reflect/Constructor.java (getParameterTypes):
+       Genericized.
+       (getExceptionTypes): Likewise.
+       (newInstance): Likewise.
+       * java/lang/reflect/Array.java (newInstance): Genericized.
+       * java/lang/Object.java (getClass): Genericized.
+       * java/nio/charset/spi/CharsetProvider.java (charsets):
+       Genericized.
+       * java/text/Collator.java: Implement Comparable<Object>.
+
 2007-02-01  Tom Tromey  <tromey@redhat.com>
 
        * java/util/Calendar.java: Implement Comparable<Calendar>.  Update
index 40563bf154986ad9d85d4fe2e6d98c79e3b3ff8f..a2755d819b60458db08a8715116525f9b3daece4 100644 (file)
Binary files a/libjava/classpath/lib/java/lang/Object.class and b/libjava/classpath/lib/java/lang/Object.class differ
index 62952c3d14cede8f1d094a8e8f6bbcfc44c8b56e..e2ef1a09d60a0f00802af517492144e456cfa5ac 100644 (file)
Binary files a/libjava/classpath/lib/java/lang/reflect/Array.class and b/libjava/classpath/lib/java/lang/reflect/Array.class differ
index a54f69aeec07745626cf6c67fa335a800688dcec..637c5b87bd770a994c2d00e76c64a1ba6bde8df1 100644 (file)
Binary files a/libjava/classpath/lib/java/lang/reflect/Constructor.class and b/libjava/classpath/lib/java/lang/reflect/Constructor.class differ
index 0a0b45cd51449f2c0f1f3833a2c636f0809bf392..0eda2ee759029c1bd99fe8e1f248d5aa42d2e63c 100644 (file)
Binary files a/libjava/classpath/lib/java/lang/reflect/Method.class and b/libjava/classpath/lib/java/lang/reflect/Method.class differ
index cdf4cbb912a02df720d899139e2ab89488812856..2b9736833732968fd4e2cff762395dd3325aeb7d 100644 (file)
Binary files a/libjava/classpath/lib/java/nio/charset/spi/CharsetProvider.class and b/libjava/classpath/lib/java/nio/charset/spi/CharsetProvider.class differ
index a997460fbe936bed59ddfe7a05661e4d406c12ac..655c4fca8477ae8de9323416dcdc6315690b8331 100644 (file)
Binary files a/libjava/classpath/lib/java/text/Collator.class and b/libjava/classpath/lib/java/text/Collator.class differ
index 39d0992a0abf00b44e7738d1c8acd818f4fb10db..927c28c7872e7417e1480b88de1553b1b3050740 100644 (file)
Binary files a/libjava/classpath/lib/java/util/logging/LogManager$1.class and b/libjava/classpath/lib/java/util/logging/LogManager$1.class differ
index 7f93b8af931f706f1fad1414fc3a806ddb8ea86b..92da8e3a249b735b445851d5f7247296e3318fd3 100644 (file)
Binary files a/libjava/classpath/lib/java/util/logging/LogManager.class and b/libjava/classpath/lib/java/util/logging/LogManager.class differ
index e81a48a9fb7f389b5fd49ecbaf9cb1c6a6967a02..740a7c78e7529e8e6cdd2163f2a3e2394f5c08a7 100644 (file)
@@ -1,5 +1,5 @@
 /* java.lang.Object - The universal superclass in Java
-   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2007
    Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -129,7 +129,7 @@ public class Object
    *
    * @return the class of this Object
    */
-  public final native Class getClass();
+  public final native Class<? extends Object> getClass();
 
   /**
    * Get a value that represents this Object, as uniquely as
index 32bed06ee02b976be598e365876f5583d5a978e2..639cc0e02dbe87a2edcf884652a310c6d8b46bec 100644 (file)
@@ -1,5 +1,5 @@
 /* java.lang.reflect.Array - manipulate arrays by reflection
-   Copyright (C) 1998, 1999, 2001, 2003, 2005  Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2001, 2003, 2005, 2007  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -104,7 +104,7 @@ public final class Array
    * @throws NegativeArraySizeException when length is less than 0
    * @throws OutOfMemoryError if memory allocation fails
    */
-  public static native Object newInstance(Class componentType, int length);
+  public static native Object newInstance(Class<?> componentType, int length);
 
   /**
    * Creates a new multi-dimensioned array.  The new array has the same
@@ -130,7 +130,7 @@ public final class Array
    *         than 0
    * @throws OutOfMemoryError if memory allocation fails
    */
-  public static native Object newInstance(Class elementType, int[] dimensions);
+  public static native Object newInstance(Class<?> elementType, int[] dimensions);
 
   /**
    * Gets the array length.
index 83aae3b48ce4bc93be2122273640e8425b3133c4..adebc600a67fe4f369fad42640ccc1e7e929b7d6 100644 (file)
@@ -1,5 +1,5 @@
 /* java.lang.reflect.Constructor - reflection of Java constructors
-   Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006
+   Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007
    Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -155,11 +155,11 @@ public final class Constructor<T> extends AccessibleObject
    *
    * @return a list of the types of the constructor's parameters
    */
-  public Class[] getParameterTypes ()
+  public Class<?>[] getParameterTypes ()
   {
     if (parameter_types == null)
       getType ();
-    return (Class[]) parameter_types.clone();
+    return (Class<?>[]) parameter_types.clone();
   }
 
   /**
@@ -169,11 +169,11 @@ public final class Constructor<T> extends AccessibleObject
    *
    * @return a list of the types in the constructor's throws clause
    */
-  public Class[] getExceptionTypes ()
+  public Class<?>[] getExceptionTypes ()
   {
     if (exception_types == null)
       getType();
-    return (Class[]) exception_types.clone();
+    return (Class<?>[]) exception_types.clone();
   }
 
   /**
@@ -305,7 +305,7 @@ public final class Constructor<T> extends AccessibleObject
    * @throws ExceptionInInitializerError if construction triggered class
    *         initialization, which then failed
    */
-  public native Object newInstance (Object[] args)
+  public native T newInstance (Object... args)
     throws InstantiationException, IllegalAccessException,
     IllegalArgumentException, InvocationTargetException;
 
index fc0bf10644085f5d352cb9fc729fb7ed14d84335..6fa2956e40e825aa666efab306a56e1b472f3b60 100644 (file)
@@ -1,6 +1,6 @@
 // Method.java - Represent method of class or interface.
 
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2006  Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2006, 2007  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -68,7 +68,7 @@ public final class Method
    * is a non-inherited member.
    * @return the class that declared this member
    */
-  public Class getDeclaringClass()
+  public Class<?> getDeclaringClass()
   {
     return declaringClass;
   }
index e15153fe9e6872cfda64b134b5066727bff0fabb..d56723c3f433da68eb412f32f1cb1df5197c96e8 100644 (file)
@@ -1,5 +1,5 @@
 /* CharsetProvider.java -- charset service provider interface
-   Copyright (C) 2002, 2006 Free Software Foundation
+   Copyright (C) 2002, 2006, 2007 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -83,7 +83,7 @@ public abstract class CharsetProvider
    * @return the iterator
    * @see Charset#availableCharsets()
    */
-  public abstract Iterator charsets();
+  public abstract Iterator<Charset> charsets();
 
   /**
    * Returns the named charset, by canonical name or alias.
index c1ba87e93b996429590e830eeff941c1999cdb84..aa643163943fff098260d35713a2ff4cec0a0bcd 100644 (file)
@@ -1,5 +1,5 @@
 /* Collator.java -- Perform locale dependent String comparisons.
-   Copyright (C) 1998, 1999, 2000, 2001, 2004, 2005  Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000, 2001, 2004, 2005, 2007  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -68,11 +68,7 @@ import java.util.ResourceBundle;
  * @author Aaron M. Renn (arenn@urbanophile.com)
  * @date March 18, 1999
  */
-/* Written using "Java Class Libraries", 2nd edition, plus online
- * API docs for JDK 1.2 from http://www.javasoft.com.
- * Status: Mostly complete, but parts stubbed out.  Look for FIXME.
- */
-public abstract class Collator implements Comparator, Cloneable
+public abstract class Collator implements Comparator<Object>, Cloneable
 {
   /**
    * This constant is a strength value which indicates that only primary
@@ -292,7 +288,7 @@ public abstract class Collator implements Comparator, Cloneable
    * specified locale.  If no <code>Collator</code> exists for the desired
    * locale, a <code>Collator</code> for the default locale will be returned.
    *
-   * @param loc The desired localed to load a <code>Collator</code> for.
+   * @param loc The desired locale to load a <code>Collator</code> for.
    *
    * @return A <code>Collator</code> for the requested locale
    */
index b8b31c43cb6fe52b8922b0b9da61fc90bab250b3..1e0192e3f3497f9ca5fd689c9b9ed98d0b8a501a 100644 (file)
@@ -1,6 +1,6 @@
 /* LogManager.java -- a class for maintaining Loggers and managing
    configuration properties
-   Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2005, 2006, 2007 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -129,7 +129,7 @@ public class LogManager
    * The registered named loggers; maps the name of a Logger to
    * a WeakReference to it.
    */
-  private Map loggers;
+  private Map<String, WeakReference<Logger>> loggers;
 
   /**
    * The properties for the logging framework which have been
@@ -269,7 +269,7 @@ public class LogManager
      */
     name = logger.getName();
 
-    ref = (WeakReference) loggers.get(name);
+    ref = loggers.get(name);
     if (ref != null)
       {
        if (ref.get() != null)
@@ -286,7 +286,7 @@ public class LogManager
       checkAccess();
 
     Logger parent = findAncestor(logger);
-    loggers.put(name, new WeakReference(logger));
+    loggers.put(name, new WeakReference<Logger>(logger));
     if (parent != logger.getParent())
       logger.setParent(parent);
 
@@ -362,15 +362,13 @@ public class LogManager
     int bestNameLength = 0;
 
     Logger cand;
-    String candName;
     int candNameLength;
 
     if (child == Logger.root)
       return null;
 
-    for (Iterator iter = loggers.keySet().iterator(); iter.hasNext();)
+    for (String candName : loggers.keySet())
       {
-       candName = (String) iter.next();
        candNameLength = candName.length();
 
        if (candNameLength > bestNameLength
@@ -378,7 +376,7 @@ public class LogManager
            && childName.startsWith(candName)
            && childName.charAt(candNameLength) == '.')
          {
-           cand = (Logger) ((WeakReference) loggers.get(candName)).get();
+           cand = loggers.get(candName).get();
            if ((cand == null) || (cand == child))
              continue;
 
@@ -403,14 +401,14 @@ public class LogManager
    */
   public synchronized Logger getLogger(String name)
   {
-    WeakReference ref;
+    WeakReference<Logger> ref;
 
     /* Throw a NullPointerException if name is null. */
     name.getClass();
 
-    ref = (WeakReference) loggers.get(name);
+    ref = loggers.get(name);
     if (ref != null)
-      return (Logger) ref.get();
+      return ref.get();
     else
       return null;
   }
@@ -423,7 +421,7 @@ public class LogManager
    * @return an Enumeration with the names of the currently
    *    registered Loggers.
    */
-  public synchronized Enumeration getLoggerNames()
+  public synchronized Enumeration<String> getLoggerNames()
   {
     return Collections.enumeration(loggers.keySet());
   }
@@ -446,16 +444,16 @@ public class LogManager
 
     properties = new Properties();
 
-    Iterator iter = loggers.values().iterator();
+    Iterator<WeakReference<Logger>> iter = loggers.values().iterator();
     while (iter.hasNext())
       {
-       WeakReference ref;
+       WeakReference<Logger> ref;
        Logger logger;
 
-       ref = (WeakReference) iter.next();
+       ref = iter.next();
        if (ref != null)
          {
-           logger = (Logger) ref.get();
+           logger = ref.get();
 
            if (logger == null)
              iter.remove();
@@ -710,7 +708,11 @@ public class LogManager
   {
     try
       {
-       return Level.parse(getLogManager().getProperty(propertyName));
+        String value = getLogManager().getProperty(propertyName);
+       if (value != null)
+         return Level.parse(getLogManager().getProperty(propertyName));
+        else
+          return defaultValue;
       }
     catch (Exception ex)
       {