You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "James E. King, III (JIRA)" <ji...@apache.org> on 2016/07/29 21:05:20 UTC

[jira] [Comment Edited] (THRIFT-3889) Generated java code declared things Cloneable but does not provide a clone() method

    [ https://issues.apache.org/jira/browse/THRIFT-3889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15400000#comment-15400000 ] 

James E. King, III edited comment on THRIFT-3889 at 7/29/16 9:04 PM:
---------------------------------------------------------------------

It looks like the code generator is emitting deepCopy() instead of clone() - this is from 0.8.0 sources, probably still in the tip:
{noformat}
  // clone method, so that you can deep copy an object when you don't know its class.
  indent(out) << "public " << tstruct->get_name() << " deepCopy() {" << endl;
  indent(out) << "  return new " << tstruct->get_name() << "(this);" << endl;
  indent(out) << "}" << endl << endl;
{noformat}


was (Author: jking3):
It looks like the code generator is emitting deepCopy() instead of clone():
{noformat}
  // clone method, so that you can deep copy an object when you don't know its class.
  indent(out) << "public " << tstruct->get_name() << " deepCopy() {" << endl;
  indent(out) << "  return new " << tstruct->get_name() << "(this);" << endl;
  indent(out) << "}" << endl << endl;
{noformat}

> Generated java code declared things Cloneable but does not provide a clone() method
> -----------------------------------------------------------------------------------
>
>                 Key: THRIFT-3889
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3889
>             Project: Thrift
>          Issue Type: Bug
>            Reporter: James E. King, III
>
> This appeared on a local coverity scan using thrift-0.8.0 generated code.  It appears the code is not in the trunk either.
> According to [~jfarrell] this support was added quite some time ago in THRIFT-138 however most of this code including the DeepCopyTest.java seems to be gone.
> This work should be revived; or Cloneable should no longer be declared in the generated classes.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)