harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leo Li (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-1770) [classlib][math]BigInteger has an unexpected "protected clone()" method
Date Mon, 09 Oct 2006 07:17:19 GMT
[classlib][math]BigInteger has an unexpected "protected clone()" method  

                 Key: HARMONY-1770
                 URL: http://issues.apache.org/jira/browse/HARMONY-1770
             Project: Harmony
          Issue Type: Bug
            Reporter: Leo Li

BigInteger have a protected clone() method while as the spec says BigInteger itself does not
implement Cloneable. The clone() method just new an instance of itself instead of super().clone.Although
it is not public, the Clone() method might lead to side-effect if some Object extends from
it and implements Cloneable. 
Here is an testcase:

public class TestCloneable extends TestCase {

 public void testClone()
  MyBigInteger myBigInteger = new MyBigInteger("12345");
  myBigInteger = (MyBigInteger)myBigInteger.clone();

 class MyBigInteger extends BigInteger implements Cloneable { 

 public MyBigInteger(String val) {
 public Object clone()
  try {
   return super.clone();
  } catch (CloneNotSupportedException e) {
   return null;
RI passes.
Harmony Fails.

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


View raw message