[LOGBack-dev] svn commit: r387 - in logback/core/trunk/src: main/java/ch/qos/logback/core main/java/ch/qos/logback/core/joran main/java/ch/qos/logback/core/joran/action main/java/ch/qos/logback/core/joran/spi main/java/ch/qos/logback/core/pattern main/java/ch/qos/logback/core/util test/java/ch/qos/logback/core/appender test/java/ch/qos/logback/core/pattern/parser

noreply.ceki at qos.ch noreply.ceki at qos.ch
Mon Jul 31 20:14:21 CEST 2006


Author: ceki
Date: Mon Jul 31 20:14:14 2006
New Revision: 387

Modified:
   logback/core/trunk/src/main/java/ch/qos/logback/core/Context.java
   logback/core/trunk/src/main/java/ch/qos/logback/core/ContextBase.java
   logback/core/trunk/src/main/java/ch/qos/logback/core/joran/JoranConfiguratorBase.java
   logback/core/trunk/src/main/java/ch/qos/logback/core/joran/action/AbstractEventEvaluatorAction.java
   logback/core/trunk/src/main/java/ch/qos/logback/core/joran/action/AppenderAction.java
   logback/core/trunk/src/main/java/ch/qos/logback/core/joran/action/ConversionRuleAction.java
   logback/core/trunk/src/main/java/ch/qos/logback/core/joran/action/RepositoryPropertyAction.java
   logback/core/trunk/src/main/java/ch/qos/logback/core/joran/spi/ExecutionContext.java
   logback/core/trunk/src/main/java/ch/qos/logback/core/joran/spi/Interpreter.java
   logback/core/trunk/src/main/java/ch/qos/logback/core/pattern/PatternLayoutBase.java
   logback/core/trunk/src/main/java/ch/qos/logback/core/util/OptionHelper.java
   logback/core/trunk/src/main/java/ch/qos/logback/core/util/PropertySetter.java
   logback/core/trunk/src/test/java/ch/qos/logback/core/appender/ListAppender.java
   logback/core/trunk/src/test/java/ch/qos/logback/core/pattern/parser/SamplePatternLayout.java
Log:
minor changes correcting type safety issues

Modified: logback/core/trunk/src/main/java/ch/qos/logback/core/Context.java
==============================================================================
--- logback/core/trunk/src/main/java/ch/qos/logback/core/Context.java	(original)
+++ logback/core/trunk/src/main/java/ch/qos/logback/core/Context.java	Mon Jul 31 20:14:14 2006
@@ -56,7 +56,7 @@
    * LB contexts have a notion of context-specific converter maps.
    * @return
    */
-  public Map getConverterMap();
+  public Map<String, String> getConverterMap();
   
   /**
    * Contexts are named objects.

Modified: logback/core/trunk/src/main/java/ch/qos/logback/core/ContextBase.java
==============================================================================
--- logback/core/trunk/src/main/java/ch/qos/logback/core/ContextBase.java	(original)
+++ logback/core/trunk/src/main/java/ch/qos/logback/core/ContextBase.java	Mon Jul 31 20:14:14 2006
@@ -23,14 +23,14 @@
   StatusManager sm = new BasicStatusManager();
   Map<String, String> propertyMap = new HashMap<String, String>();
   Map<String, Object> objectMap = new HashMap<String, Object>();
-  Map converterMap = new HashMap();
+  Map<String, String> converterMap = new HashMap<String, String>();
   private FilterAttachableImpl fai = new FilterAttachableImpl();
   
   public StatusManager getStatusManager() {
     return sm;
   }
   
-  public Map getPropertyMap() {
+  public Map<String, String> getPropertyMap() {
     return propertyMap;
   }
 
@@ -50,7 +50,7 @@
     objectMap.put(key, value);
   }
   
-  public Map getConverterMap() {
+  public Map<String, String> getConverterMap() {
     return converterMap;
   }
 

Modified: logback/core/trunk/src/main/java/ch/qos/logback/core/joran/JoranConfiguratorBase.java
==============================================================================
--- logback/core/trunk/src/main/java/ch/qos/logback/core/joran/JoranConfiguratorBase.java	(original)
+++ logback/core/trunk/src/main/java/ch/qos/logback/core/joran/JoranConfiguratorBase.java	Mon Jul 31 20:14:14 2006
@@ -176,7 +176,7 @@
     nestedIA.setContext(context);
     joranInterpreter.addImplicitAction(nestedSimpleIA);
 
-    Map omap = ec.getObjectMap();
+    Map<String, Object> omap = ec.getObjectMap();
     omap.put(ActionConst.APPENDER_BAG, new HashMap());
     omap.put(ActionConst.FILTER_CHAIN_BAG, new HashMap());
   }

Modified: logback/core/trunk/src/main/java/ch/qos/logback/core/joran/action/AbstractEventEvaluatorAction.java
==============================================================================
--- logback/core/trunk/src/main/java/ch/qos/logback/core/joran/action/AbstractEventEvaluatorAction.java	(original)
+++ logback/core/trunk/src/main/java/ch/qos/logback/core/joran/action/AbstractEventEvaluatorAction.java	Mon Jul 31 20:14:14 2006
@@ -113,7 +113,7 @@
       ec.popObject();
 
       try {
-        Map evaluatorMap = (Map) context.getObject(CoreGlobal.EVALUATOR_MAP);
+        Map<String, EventEvaluator> evaluatorMap = (Map) context.getObject(CoreGlobal.EVALUATOR_MAP);
         evaluatorMap.put(evaluator.getName(), evaluator);
       } catch (Exception ex) {
         addError(

Modified: logback/core/trunk/src/main/java/ch/qos/logback/core/joran/action/AppenderAction.java
==============================================================================
--- logback/core/trunk/src/main/java/ch/qos/logback/core/joran/action/AppenderAction.java	(original)
+++ logback/core/trunk/src/main/java/ch/qos/logback/core/joran/action/AppenderAction.java	Mon Jul 31 20:14:14 2006
@@ -59,7 +59,7 @@
 
       // The execution context contains a bag which contains the appenders
       // created thus far.
-      HashMap appenderBag =
+      HashMap<String, Appender> appenderBag =
         (HashMap) ec.getObjectMap().get(ActionConst.APPENDER_BAG);
 
       // add the appender just created to the appender bag.

Modified: logback/core/trunk/src/main/java/ch/qos/logback/core/joran/action/ConversionRuleAction.java
==============================================================================
--- logback/core/trunk/src/main/java/ch/qos/logback/core/joran/action/ConversionRuleAction.java	(original)
+++ logback/core/trunk/src/main/java/ch/qos/logback/core/joran/action/ConversionRuleAction.java	Mon Jul 31 20:14:14 2006
@@ -60,9 +60,9 @@
 
       //LoggerRepository repository = (LoggerRepository) ec.getObjectStack().get(0);
 
-      Map ruleRegistry = (Map) context.getObject(CoreGlobal.PATTERN_RULE_REGISTRY);
+      Map<String, String> ruleRegistry = (Map) context.getObject(CoreGlobal.PATTERN_RULE_REGISTRY);
       if(ruleRegistry == null) {
-        ruleRegistry = new HashMap();
+        ruleRegistry = new HashMap<String, String>();
         context.putObject(CoreGlobal.PATTERN_RULE_REGISTRY, ruleRegistry);
       }
       // put the new rule into the rule registry

Modified: logback/core/trunk/src/main/java/ch/qos/logback/core/joran/action/RepositoryPropertyAction.java
==============================================================================
--- logback/core/trunk/src/main/java/ch/qos/logback/core/joran/action/RepositoryPropertyAction.java	(original)
+++ logback/core/trunk/src/main/java/ch/qos/logback/core/joran/action/RepositoryPropertyAction.java	Mon Jul 31 20:14:14 2006
@@ -11,6 +11,11 @@
  */
 public class RepositoryPropertyAction extends PropertyAction {
   
+  /**
+   * Add all the properties found in the argument named 'props' to an ExecutionContext.
+   * 
+   */
+  @SuppressWarnings("unchecked")
   public void setProperties(ExecutionContext ec, Properties props) {
     this.context.getPropertyMap().putAll(props);
   }

Modified: logback/core/trunk/src/main/java/ch/qos/logback/core/joran/spi/ExecutionContext.java
==============================================================================
--- logback/core/trunk/src/main/java/ch/qos/logback/core/joran/spi/ExecutionContext.java	(original)
+++ logback/core/trunk/src/main/java/ch/qos/logback/core/joran/spi/ExecutionContext.java	Mon Jul 31 20:14:14 2006
@@ -34,15 +34,15 @@
  * @author Ceki G&uuml;lc&uuml;
  */
 public class ExecutionContext extends ContextAwareBase {
-  Stack objectStack;
-  Map objectMap;
+  Stack<Object> objectStack;
+  Map<String, Object> objectMap;
   Properties substitutionProperties;
   Interpreter joranInterpreter;
 
   public ExecutionContext(Interpreter joranInterpreter) {
     this.joranInterpreter = joranInterpreter;
-    objectStack = new Stack();
-    objectMap = new HashMap(5);
+    objectStack = new Stack<Object> ();
+    objectMap = new HashMap<String, Object>(5);
     substitutionProperties = new Properties();
   }
 
@@ -101,7 +101,7 @@
     return joranInterpreter;
   }
 
-  public Stack getObjectStack() {
+  public Stack<Object> getObjectStack() {
     return objectStack;
   }
 
@@ -121,7 +121,7 @@
     return objectStack.get(i);
   }
 
-  public Map getObjectMap() {
+  public Map<String, Object> getObjectMap() {
     return objectMap;
   }
 

Modified: logback/core/trunk/src/main/java/ch/qos/logback/core/joran/spi/Interpreter.java
==============================================================================
--- logback/core/trunk/src/main/java/ch/qos/logback/core/joran/spi/Interpreter.java	(original)
+++ logback/core/trunk/src/main/java/ch/qos/logback/core/joran/spi/Interpreter.java	Mon Jul 31 20:14:14 2006
@@ -62,7 +62,7 @@
   private static List EMPTY_LIST = new Vector(0);
   private RuleStore ruleStore;
   private ExecutionContext ec;
-  private ArrayList implicitActions;
+  private ArrayList<ImplicitAction> implicitActions;
   Pattern pattern;
   Locator locator;
 
@@ -74,7 +74,7 @@
    * {@link #endElement}.
    * 
    */
-  Stack actionListStack;
+  Stack<List> actionListStack;
 
   /**
    * If the skip nested is set, then we skip all its nested elements until it is
@@ -85,9 +85,9 @@
   public Interpreter(RuleStore rs) {
     ruleStore = rs;
     ec = new ExecutionContext(this);
-    implicitActions = new ArrayList(3);
+    implicitActions = new ArrayList<ImplicitAction>(3);
     pattern = new Pattern();
-    actionListStack = new Stack();
+    actionListStack = new Stack<List>();
   }
 
   public ExecutionContext getExecutionContext() {
@@ -192,7 +192,7 @@
       ImplicitAction ia = (ImplicitAction) implicitActions.get(i);
 
       if (ia.isApplicable(pattern, attributes, ec)) {
-        List actionList = new ArrayList(1);
+        List<Action> actionList = new ArrayList<Action>(1);
         actionList.add(ia);
 
         return actionList;

Modified: logback/core/trunk/src/main/java/ch/qos/logback/core/pattern/PatternLayoutBase.java
==============================================================================
--- logback/core/trunk/src/main/java/ch/qos/logback/core/pattern/PatternLayoutBase.java	(original)
+++ logback/core/trunk/src/main/java/ch/qos/logback/core/pattern/PatternLayoutBase.java	Mon Jul 31 20:14:14 2006
@@ -33,21 +33,21 @@
    * 
    * @return A map associating pattern words to the names of converter classes
    */
-  abstract public Map getDefaultConverterMap();
+  abstract public Map<String, String> getDefaultConverterMap();
 
   /**
    * Returns a map where the default converter map is merged with the map
    * contained in the context.
    */
-  public Map getConverterMap() {
-    Map map = new HashMap();
-    Map defaultMap = getDefaultConverterMap();
+  public Map<String, String> getConverterMap() {
+    Map<String, String> map = new HashMap<String, String>();
+    Map<String, String> defaultMap = getDefaultConverterMap();
     if (defaultMap != null) {
       map.putAll(defaultMap);
     }
     Context context = getContext();
     if (context != null) {
-      Map contextMap = context.getConverterMap();
+      Map<String, String> contextMap = context.getConverterMap();
       if (contextMap != null) {
         map.putAll(contextMap);
       }

Modified: logback/core/trunk/src/main/java/ch/qos/logback/core/util/OptionHelper.java
==============================================================================
--- logback/core/trunk/src/main/java/ch/qos/logback/core/util/OptionHelper.java	(original)
+++ logback/core/trunk/src/main/java/ch/qos/logback/core/util/OptionHelper.java	Mon Jul 31 20:14:14 2006
@@ -19,6 +19,7 @@
  */
 public class OptionHelper {
 
+  @SuppressWarnings("unchecked")
   public static Object instantiateByClassName(String className, Class superClass)
       throws ClassNotFoundException, IncompatibleClassException,
       InstantiationException, IllegalAccessException {

Modified: logback/core/trunk/src/main/java/ch/qos/logback/core/util/PropertySetter.java
==============================================================================
--- logback/core/trunk/src/main/java/ch/qos/logback/core/util/PropertySetter.java	(original)
+++ logback/core/trunk/src/main/java/ch/qos/logback/core/util/PropertySetter.java	Mon Jul 31 20:14:14 2006
@@ -261,6 +261,7 @@
     return objClass;
   }
 
+  @SuppressWarnings("unchecked")
   public void addComponent(String name, Object childComponent) {
     Class ccc = childComponent.getClass();
     name = capitalizeFirstLetter(name);

Modified: logback/core/trunk/src/test/java/ch/qos/logback/core/appender/ListAppender.java
==============================================================================
--- logback/core/trunk/src/test/java/ch/qos/logback/core/appender/ListAppender.java	(original)
+++ logback/core/trunk/src/test/java/ch/qos/logback/core/appender/ListAppender.java	Mon Jul 31 20:14:14 2006
@@ -19,6 +19,7 @@
 
   public List list = new ArrayList();
   
+  @SuppressWarnings("unchecked")
   protected void append(Object o) {
     list.add(o);
   }

Modified: logback/core/trunk/src/test/java/ch/qos/logback/core/pattern/parser/SamplePatternLayout.java
==============================================================================
--- logback/core/trunk/src/test/java/ch/qos/logback/core/pattern/parser/SamplePatternLayout.java	(original)
+++ logback/core/trunk/src/test/java/ch/qos/logback/core/pattern/parser/SamplePatternLayout.java	Mon Jul 31 20:14:14 2006
@@ -27,7 +27,7 @@
     converterMap.put("hello", ConverterHello.class.getName());
   }
   
-  public  Map getDefaultConverterMap() {
+  public  Map<String, String> getDefaultConverterMap() {
     return converterMap;
   }
 



More information about the logback-dev mailing list