Author: fmeschbe
Date: Thu Jan 17 23:13:06 2008
New Revision: 613081

URL: http://svn.apache.org/viewvc?rev=613081&view=rev
Log:
SLING-172 Taking generic objects must be wildcarded because e.g. 
Collection<Object>
does not match ArrayList<String> because type hierarchy of generic types is not
taken into account just the primary type.

Modified:
    
incubator/sling/trunk/commons/json/src/main/java/org/apache/sling/commons/json/JSONArray.java
    
incubator/sling/trunk/commons/json/src/main/java/org/apache/sling/commons/json/JSONObject.java

Modified: 
incubator/sling/trunk/commons/json/src/main/java/org/apache/sling/commons/json/JSONArray.java
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/commons/json/src/main/java/org/apache/sling/commons/json/JSONArray.java?rev=613081&r1=613080&r2=613081&view=diff
==============================================================================
--- 
incubator/sling/trunk/commons/json/src/main/java/org/apache/sling/commons/json/JSONArray.java
 (original)
+++ 
incubator/sling/trunk/commons/json/src/main/java/org/apache/sling/commons/json/JSONArray.java
 Thu Jan 17 23:13:06 2008
@@ -151,7 +151,7 @@
      * Construct a JSONArray from a Collection.
      * @param collection     A Collection.
      */
-    public JSONArray(Collection<Object> collection) {
+    public JSONArray(Collection<?> collection) {
         this.myArrayList = (collection == null) ?
                new ArrayList<Object>() :
                new ArrayList<Object>(collection);
@@ -542,7 +542,7 @@
      * @param value    A Collection value.
      * @return         this.
      */
-    public JSONArray put(Collection<Object> value) {
+    public JSONArray put(Collection<?> value) {
         put(new JSONArray(value));
         return this;
     }
@@ -593,7 +593,7 @@
      * @param value    A Map value.
      * @return         this.
      */
-    public JSONArray put(Map<String, Object> value) {
+    public JSONArray put(Map<String, ?> value) {
         put(new JSONObject(value));
         return this;
     }
@@ -636,7 +636,7 @@
      * @throws JSONException If the index is negative or if the value is
      * not finite.
      */
-    public JSONArray put(int index, Collection<Object> value) throws 
JSONException {
+    public JSONArray put(int index, Collection<?> value) throws JSONException {
         put(index, new JSONArray(value));
         return this;
     }
@@ -697,7 +697,7 @@
      * @throws JSONException If the index is negative or if the the value is
      *  an invalid number.
      */
-    public JSONArray put(int index, Map<String, Object> value) throws 
JSONException {
+    public JSONArray put(int index, Map<String, ?> value) throws JSONException 
{
         put(index, new JSONObject(value));
         return this;
     }

Modified: 
incubator/sling/trunk/commons/json/src/main/java/org/apache/sling/commons/json/JSONObject.java
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/commons/json/src/main/java/org/apache/sling/commons/json/JSONObject.java?rev=613081&r1=613080&r2=613081&view=diff
==============================================================================
--- 
incubator/sling/trunk/commons/json/src/main/java/org/apache/sling/commons/json/JSONObject.java
 (original)
+++ 
incubator/sling/trunk/commons/json/src/main/java/org/apache/sling/commons/json/JSONObject.java
 Thu Jan 17 23:13:06 2008
@@ -231,7 +231,7 @@
      * @param map A map object that can be used to initialize the contents of
      *  the JSONObject.
      */
-    public JSONObject(Map<String, Object> map) {
+    public JSONObject(Map<String, ?> map) {
         this.myHashMap = (map == null) ?
                new LinkedHashMap<String, Object>() :
                new LinkedHashMap<String, Object>(map);
@@ -634,7 +634,7 @@
      * @return         this.
      * @throws JSONException
      */
-    public JSONObject put(String key, Collection<Object> value) throws 
JSONException {
+    public JSONObject put(String key, Collection<?> value) throws 
JSONException {
         put(key, new JSONArray(value));
         return this;
     }
@@ -860,7 +860,7 @@
      * @return         this.
      * @throws JSONException
      */
-    public JSONObject put(String key, Map<String, Object> value) throws 
JSONException {
+    public JSONObject put(String key, Map<String, ?> value) throws 
JSONException {
         put(key, new JSONObject(value));
         return this;
     }


Reply via email to