Author: henning
Date: Mon Oct 21 08:44:33 2013
New Revision: 1534064
URL: http://svn.apache.org/r1534064
Log:
[CONFIGURATION-558] Configuration no longer accepts List<String> as default for
getList()
Similar to CONFIGURATION-557, the getList(String, List) method was
generified to be getList(String, List<Object>) but needs to be
getList(String, List<?>) so that code that used a more specific list
(such as a List<String>) still compiles against the new API.
Added:
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/test/java/org/apache/commons/configuration/TestConfiguration.java
(with props)
Modified:
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/RELEASE-NOTES.txt
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/CompositeConfiguration.java
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/Configuration.java
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/DynamicCombinedConfiguration.java
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/MultiFileHierarchicalConfiguration.java
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java
Modified:
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/RELEASE-NOTES.txt
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/RELEASE-NOTES.txt?rev=1534064&r1=1534063&r2=1534064&view=diff
==============================================================================
---
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/RELEASE-NOTES.txt
(original)
+++
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/RELEASE-NOTES.txt
Mon Oct 21 08:44:33 2013
@@ -47,6 +47,13 @@ BUG FIXES IN 1.10
All of this is purely a compiler issue, the runtime itself does not see any
of the generics
due to the Java type erasure.
+* [CONFIGURATION-558] Configuration no longer accepts List<String> as default
for getList()
+
+ Similar to CONFIGURATION-557, the getList(String, List) method was
generified to be
+ getList(String, List<Object>) but needs to be getList(String, List<?>) so
that code that
+ used a more specific list (such as a List<String>) still compiles against
the new API.
+
+
IMPROVEMENTS AND NEW FEATURES IN 1.10
=====================================
Modified:
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java?rev=1534064&r1=1534063&r2=1534064&view=diff
==============================================================================
---
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java
(original)
+++
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java
Mon Oct 21 08:44:33 2013
@@ -1117,7 +1117,7 @@ public abstract class AbstractConfigurat
return getList(key, new ArrayList<Object>());
}
- public List<Object> getList(String key, List<Object> defaultValue)
+ public List<Object> getList(String key, List<?> defaultValue)
{
Object value = getProperty(key);
List<Object> list;
@@ -1140,7 +1140,7 @@ public abstract class AbstractConfigurat
}
else if (value == null)
{
- list = defaultValue;
+ list = (List<Object>) defaultValue;
}
else if (value.getClass().isArray())
{
Modified:
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/CompositeConfiguration.java
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/CompositeConfiguration.java?rev=1534064&r1=1534063&r2=1534064&view=diff
==============================================================================
---
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/CompositeConfiguration.java
(original)
+++
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/CompositeConfiguration.java
Mon Oct 21 08:44:33 2013
@@ -339,7 +339,7 @@ implements Cloneable
}
@Override
- public List<Object> getList(String key, List<Object> defaultValue)
+ public List<Object> getList(String key, List<?> defaultValue)
{
List<Object> list = new ArrayList<Object>();
@@ -359,7 +359,7 @@ implements Cloneable
if (list.isEmpty())
{
- return defaultValue;
+ return (List<Object>) defaultValue;
}
ListIterator<Object> lit = list.listIterator();
Modified:
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/Configuration.java
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/Configuration.java?rev=1534064&r1=1534063&r2=1534064&view=diff
==============================================================================
---
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/Configuration.java
(original)
+++
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/Configuration.java
Mon Oct 21 08:44:33 2013
@@ -594,5 +594,5 @@ public interface Configuration
* @throws ConversionException is thrown if the key maps to an
* object that is not a List.
*/
- List<Object> getList(String key, List<Object> defaultValue);
+ List<Object> getList(String key, List<?> defaultValue);
}
Modified:
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/DynamicCombinedConfiguration.java
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/DynamicCombinedConfiguration.java?rev=1534064&r1=1534063&r2=1534064&view=diff
==============================================================================
---
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/DynamicCombinedConfiguration.java
(original)
+++
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/DynamicCombinedConfiguration.java
Mon Oct 21 08:44:33 2013
@@ -481,7 +481,7 @@ public class DynamicCombinedConfiguratio
}
@Override
- public List<Object> getList(String key, List<Object> defaultValue)
+ public List<Object> getList(String key, List<?> defaultValue)
{
return this.getCurrentConfig().getList(key, defaultValue);
}
Modified:
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/MultiFileHierarchicalConfiguration.java
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/MultiFileHierarchicalConfiguration.java?rev=1534064&r1=1534063&r2=1534064&view=diff
==============================================================================
---
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/MultiFileHierarchicalConfiguration.java
(original)
+++
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/MultiFileHierarchicalConfiguration.java
Mon Oct 21 08:44:33 2013
@@ -357,7 +357,7 @@ public class MultiFileHierarchicalConfig
}
@Override
- public List<Object> getList(String key, List<Object> defaultValue)
+ public List<Object> getList(String key, List<?> defaultValue)
{
return this.getConfiguration().getList(key, defaultValue);
}
Modified:
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java?rev=1534064&r1=1534063&r2=1534064&view=diff
==============================================================================
---
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java
(original)
+++
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java
Mon Oct 21 08:44:33 2013
@@ -236,7 +236,7 @@ public class PatternSubtreeConfiguration
}
@Override
- public List<Object> getList(String key, List<Object> defaultValue)
+ public List<Object> getList(String key, List<?> defaultValue)
{
return config.getList(makePath(key), defaultValue);
}
Added:
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/test/java/org/apache/commons/configuration/TestConfiguration.java
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/test/java/org/apache/commons/configuration/TestConfiguration.java?rev=1534064&view=auto
==============================================================================
---
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/test/java/org/apache/commons/configuration/TestConfiguration.java
(added)
+++
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/test/java/org/apache/commons/configuration/TestConfiguration.java
Mon Oct 21 08:44:33 2013
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.configuration;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.UUID;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestConfiguration
+{
+ @Test
+ public void testConfigurationGetList()
+ {
+ final List<String> defaults = new ArrayList<String>();
+
+ String key = UUID.randomUUID().toString();
+ for (int i = 0; i < 10; i++) {
+ defaults.add(UUID.randomUUID().toString());
+ }
+
+ final Configuration c = new MapConfiguration(Collections.<String,
String>emptyMap());
+
+ final List<Object> values = c.getList(key, defaults);
+
+ Assert.assertEquals(defaults, values);
+ }
+}
Propchange:
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/test/java/org/apache/commons/configuration/TestConfiguration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/test/java/org/apache/commons/configuration/TestConfiguration.java
------------------------------------------------------------------------------
svn:keywords = Id Author Date Revision