Are you trying to say that the methods in Harmony can use only methods used in corresponding RI implementations? 2006/9/20, Spark Shen : > Spark Shen 写道: > > Hi : > > Following is the discussion about JIRA 1492, shall we discuss it here? > > > > public class SubMapTest extends TestCase { > > public void testSubclass() { > > HashMap map = new HashMap(); > > map.put("a", "a"); > > SubMap map2 = new SubMap(map); // Harmony will throw an unexpected > > exception here. > > } > > } > > > > class SubMap extends HashMap { > > > > public V put(K key, V value) { > > throw new RuntimeException(); > > } > > } > > > > > > >Nathan Beyer > > >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? > > [ Show » ] > > Nathan Beyer > > > > [18/Sep/06 08:41 PM] 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? > > > > >Spark > > Shen > > >What if change the RuntimeException to UnsupportedOperationException? > > [ Show » ] > > spark shen > > > > [18/Sep/06 08:48 PM] What if change the RuntimeException to > > UnsupportedOperationException? > > > > >Alexey Petrenko > > >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. > > > I can not figure out what RI does. And please refer to JIRA 839, it > reports similar use case. > My point here is > 1. we may not be able to predict how users will use our library. > 2. Users could guess our implementation w/o difficulty, which > contradicts the encapulation priciple. > So I prefer to follow RI on this behavior. > > When changing to UnsupportedOperationException, the use case is more > practical, since it is highly like that put operation is not supported. > But it seems not so practical that this sub-hashMap can not be > instantiated. May be one more assertion can convince you that this is bug. > > public class SubMapTest extends TestCase { > public void testSubclass() { > HashMap map = new HashMap(); > map.put("a", "a"); > SubMap map2 = new SubMap(map); > assertEquals(1, map2.size()); > } > } > > class SubMap extends HashMap { > public SubMap(Map m) { > super(m); > } > > public V put(K key, V value) { > throw new RuntimeException(); > } > } > > Best regards > > -- > Spark Shen > China Software Development Lab, IBM > > > --------------------------------------------------------------------- > Terms of use : http://incubator.apache.org/harmony/mailing.html > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org > For additional commands, e-mail: harmony-dev-help@incubator.apache.org > > -- Alexey A. Petrenko Intel Middleware Products Division