logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1405226 - in /logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender: AbstractManager.java ConsoleAppender.java OutputStreamManager.java
Date Sat, 03 Nov 2012 00:03:37 GMT
Author: ggregory
Date: Sat Nov  3 00:03:37 2012
New Revision: 1405226

URL: http://svn.apache.org/viewvc?rev=1405226&view=rev
Log:
Use generics and fix compile warnings.

Modified:
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java?rev=1405226&r1=1405225&r2=1405226&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java
Sat Nov  3 00:03:37 2012
@@ -57,14 +57,13 @@ public abstract class AbstractManager {
      * @param name The name of the Manager to retrieve.
      * @param factory The Factory to use to create the Manager.
      * @param data An Object that should be passed to the factory when creating the Manager.
-     * @param <T> The Type of the Manager to be created.
+     * @param <M> The Type of the Manager to be created.
      * @return A Manager with the specified name and type.
      */
-    public static <T extends AbstractManager> T getManager(String name, ManagerFactory<T,
Object> factory,
-                                                 Object data) {
+    public static <M extends AbstractManager, T> M getManager(String name, ManagerFactory<M,
T> factory, T data) {
         lock.lock();
         try {
-            T manager = (T) map.get(name);
+            M manager = (M) map.get(name);
             if (manager == null) {
                 manager = factory.createManager(name, data);
                 if (manager == null) {

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java?rev=1405226&r1=1405225&r2=1405226&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java
Sat Nov  3 00:03:37 2012
@@ -42,7 +42,7 @@ import java.lang.reflect.Constructor;
 @Plugin(name = "Console", type = "Core", elementType = "appender", printObject = true)
 public final class ConsoleAppender extends OutputStreamAppender {
 
-    private static ManagerFactory factory = new ConsoleManagerFactory();
+    private static ConsoleManagerFactory factory = new ConsoleManagerFactory();
 
     /**
      * Enumeration of console destinations.

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java?rev=1405226&r1=1405225&r2=1405226&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java
Sat Nov  3 00:03:37 2012
@@ -42,8 +42,8 @@ public class OutputStreamManager extends
      * @param factory The factory to use to create the Manager.
      * @return An OutputStreamManager.
      */
-    public static OutputStreamManager getManager(String name, Object data,
-                                                 ManagerFactory<OutputStreamManager, Object>
factory) {
+    public static <T> OutputStreamManager getManager(String name, T data,
+                                                 ManagerFactory<OutputStreamManager, T>
factory) {
         return AbstractManager.getManager(name, factory, data);
     }
 



Mime
View raw message