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

Mykhailo Kozik commented on THRIFT-3674:
----------------------------------------

No, THRIFT-3377 is about typedef which are not resolved to real type.

> Java generated deep copy is shallow
> -----------------------------------
>
>                 Key: THRIFT-3674
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3674
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Compiler
>    Affects Versions: 0.9.2
>            Reporter: Mykhailo Kozik
>
> Minimum reproducible scenario
> I have an IDL called test.thrift
> {code}
> struct A {
>   1: required B b;
> }
> struct B {
>   1: required string id;
> }
> {code}
> Then I generate java file
> {code}
> thrift -gen java -out src/main/java/gen src/main/resources/test.thrift
> {code}
> Generated object for A contains method called deepCopy, which is calling copy 
> constructor, which is actually just shallow copy (copy references)
> {code}
> class A {
> //...
> public A(A other) {
>     if (other.isSetB()) {
>       this.b = other.b;
>     }
>   }
>   public A deepCopy() {
>     return new A(this);
>   }
> //...
> }
> {code}
> Instead of copying references we need copy deepCopy recursively.



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

Reply via email to