Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
0.9.2
-
None
Description
Consider the following structures:
thrift
typedef set<i32> sset; struct Test { 1: set<i32> myset; } struct Test2 { 1: sset myset; }
The generated code for Test's copy constructor looks fine, it deep copies the set. However, Test2, which should be equivalent, actually does not deep-copy the set and instead simply does a shallow assignment like if it was a POD type.
Test.java – deep
/** * Performs a deep copy on <i>other</i>. */ public Test(Test other) { if (other.isSetMyset()) { Set<Integer> __this__myset = new HashSet<Integer>(other.myset); this.myset = __this__myset; } }
VS
Test2.java – shallow..?
/** * Performs a deep copy on <i>other</i>. */ public Test2(Test2 other) { if (other.isSetMyset()) { this.myset = other.myset; } }