You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "spark shen (JIRA)" <ji...@apache.org> on 2006/09/19 05:37:22 UTC

[jira] Created: (HARMONY-1492) [classlib][luni] Constructor of HashMap throw unexpected exception

[classlib][luni] Constructor of HashMap throw unexpected exception
------------------------------------------------------------------

                 Key: HARMONY-1492
                 URL: http://issues.apache.org/jira/browse/HARMONY-1492
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: spark shen


Below tests pass on RI, but fails on Harmony:

public class SubMapTest extends TestCase {
    public void testSubclass() {
        HashMap map = new HashMap();
        map.put("a", "a");
        SubMap map2 = new SubMap(map);
    }
}

class SubMap<K, V> extends HashMap<K, V> {
    public SubMap(Map<? extends K, ? extends V> m) {
        super(m);
    }

    public V put(K key, V value) {
        throw new RuntimeException();
    }
}

I will attach a patch soon.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-1492) [classlib][luni] Constructor of HashMap throw unexpected exception

Posted by "Alexey Petrenko (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1492?page=comments#action_12435773 ] 
            
Alexey Petrenko commented on HARMONY-1492:
------------------------------------------

I'm not sure that this is a valid issue to.
As far as I understood the issue is that Harmony calls put method in constructor while RI does not. Right?

If so I do not see any issue here.

> [classlib][luni] Constructor of HashMap throw unexpected exception
> ------------------------------------------------------------------
>
>                 Key: HARMONY-1492
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1492
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: spark shen
>
> Below tests pass on RI, but fails on Harmony:
> public class SubMapTest extends TestCase {
>     public void testSubclass() {
>         HashMap map = new HashMap();
>         map.put("a", "a");
>         SubMap map2 = new SubMap(map);
>     }
> }
> class SubMap<K, V> extends HashMap<K, V> {
>     public SubMap(Map<? extends K, ? extends V> m) {
>         super(m);
>     }
>     public V put(K key, V value) {
>         throw new RuntimeException();
>     }
> }
> I will attach a patch soon.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-1492) [classlib][luni] Constructor of HashMap throw unexpected exception

Posted by "spark shen (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1492?page=all ]

spark shen updated HARMONY-1492:
--------------------------------

    Attachment: 1492.diff

The old patch of JIRA 1492 is outdated. I've updated the
patch for this JIRA. Would you please try it?

Best regards

> [classlib][luni] Constructor of HashMap throw unexpected exception
> ------------------------------------------------------------------
>
>                 Key: HARMONY-1492
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1492
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: spark shen
>         Attachments: 1492.diff
>
>
> Below tests pass on RI, but fails on Harmony:
> public class SubMapTest extends TestCase {
>     public void testSubclass() {
>         HashMap map = new HashMap();
>         map.put("a", "a");
>         SubMap map2 = new SubMap(map);
>     }
> }
> class SubMap<K, V> extends HashMap<K, V> {
>     public SubMap(Map<? extends K, ? extends V> m) {
>         super(m);
>     }
>     public V put(K key, V value) {
>         throw new RuntimeException();
>     }
> }
> I will attach a patch soon.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-1492) [classlib][luni] Constructor of HashMap throw unexpected exception

Posted by "spark shen (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1492?page=comments#action_12442228 ] 
            
spark shen commented on HARMONY-1492:
-------------------------------------


   [[ Old comment, sent by email on Tue, 19 Sep 2006 13:55:25 +0800 ]]

http://issues.apache.org/jira/browse/HARMONY-1492?page=comments#action_124356
31 ]
consider this a valid issue. What's a real use case for this type of
sub-classing?
What if change the RuntimeException into UnsupportedOperationException.
There are cases when put method is not supported by HashMap subclass.

Best regards



--
Spark Shen
China Software Development Lab, IBM


> [classlib][luni] Constructor of HashMap throw unexpected exception
> ------------------------------------------------------------------
>
>                 Key: HARMONY-1492
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1492
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: spark shen
>         Attachments: 1492.diff
>
>
> Below tests pass on RI, but fails on Harmony:
> public class SubMapTest extends TestCase {
>     public void testSubclass() {
>         HashMap map = new HashMap();
>         map.put("a", "a");
>         SubMap map2 = new SubMap(map);
>     }
> }
> class SubMap<K, V> extends HashMap<K, V> {
>     public SubMap(Map<? extends K, ? extends V> m) {
>         super(m);
>     }
>     public V put(K key, V value) {
>         throw new RuntimeException();
>     }
> }
> I will attach a patch soon.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-1492) [classlib][luni] Constructor of HashMap throw unexpected exception

Posted by "Nathan Beyer (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1492?page=comments#action_12435631 ] 
            
Nathan Beyer commented on HARMONY-1492:
---------------------------------------

Harmony's behavior may be different in this case, but I'm not sure I would consider this a valid issue. What's a real use case for this type of sub-classing?

> [classlib][luni] Constructor of HashMap throw unexpected exception
> ------------------------------------------------------------------
>
>                 Key: HARMONY-1492
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1492
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: spark shen
>
> Below tests pass on RI, but fails on Harmony:
> public class SubMapTest extends TestCase {
>     public void testSubclass() {
>         HashMap map = new HashMap();
>         map.put("a", "a");
>         SubMap map2 = new SubMap(map);
>     }
> }
> class SubMap<K, V> extends HashMap<K, V> {
>     public SubMap(Map<? extends K, ? extends V> m) {
>         super(m);
>     }
>     public V put(K key, V value) {
>         throw new RuntimeException();
>     }
> }
> I will attach a patch soon.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-1492) [classlib][luni] Constructor of HashMap throw unexpected exception

Posted by "spark shen (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1492?page=comments#action_12435635 ] 
            
spark shen commented on HARMONY-1492:
-------------------------------------

What if change the RuntimeException to UnsupportedOperationException?

> [classlib][luni] Constructor of HashMap throw unexpected exception
> ------------------------------------------------------------------
>
>                 Key: HARMONY-1492
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1492
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: spark shen
>
> Below tests pass on RI, but fails on Harmony:
> public class SubMapTest extends TestCase {
>     public void testSubclass() {
>         HashMap map = new HashMap();
>         map.put("a", "a");
>         SubMap map2 = new SubMap(map);
>     }
> }
> class SubMap<K, V> extends HashMap<K, V> {
>     public SubMap(Map<? extends K, ? extends V> m) {
>         super(m);
>     }
>     public V put(K key, V value) {
>         throw new RuntimeException();
>     }
> }
> I will attach a patch soon.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-1492) [classlib][luni] Constructor of HashMap throw unexpected exception

Posted by "spark shen (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1492?page=comments#action_12442229 ] 
            
spark shen commented on HARMONY-1492:
-------------------------------------


   [[ Old comment, sent by email on Tue, 19 Sep 2006 15:40:33 +0800 ]]

http://issues.apache.org/jira/browse/HARMONY-1492?page=comments#action_124356
31 ]
consider this a valid issue. What's a real use case for this type of
sub-classing?
Sorry for the late apply, seems somthing wrong with my mail server( the
previous reply has been ignored).
My opinion here is that, what if RuntimeException is substituted by
UnsupportedOperationException. Is this more meanful?

class SubMap<K, V> extends HashMap<K, V> {
    public SubMap(Map<? extends K, ? extends V> m) {
        super(m);
    }
    public V put(K key, V value) {
        throw new UnsupportedOperationException();
    }
}

Best regards



--
Spark Shen
China Software Development Lab, IBM


> [classlib][luni] Constructor of HashMap throw unexpected exception
> ------------------------------------------------------------------
>
>                 Key: HARMONY-1492
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1492
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: spark shen
>         Attachments: 1492.diff
>
>
> Below tests pass on RI, but fails on Harmony:
> public class SubMapTest extends TestCase {
>     public void testSubclass() {
>         HashMap map = new HashMap();
>         map.put("a", "a");
>         SubMap map2 = new SubMap(map);
>     }
> }
> class SubMap<K, V> extends HashMap<K, V> {
>     public SubMap(Map<? extends K, ? extends V> m) {
>         super(m);
>     }
>     public V put(K key, V value) {
>         throw new RuntimeException();
>     }
> }
> I will attach a patch soon.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira