Closed JerrySheaB4 closed 8 years ago
Yes, heap implementation should copy contents of charSeqs/stringBuilders, passed to set() method. I think it shouldn't copy contents of Strings, because they are immutable. Yes, the current implementation never copies. Looks like this is simply an omission, not wrong design/intention. I'm working on it.
The generated code for heap classes stores a reference to a CharSequence in a field and allows this to be changed whereas the generated flyweight copies chars in and out in the setter & getter. Generated code for the heap class:
Surely these should behave the same? Seems like heap class should change to behave like the flyweight. Assuming you agree, I'm happy to fork and fix.
Cheers
Please see below failing test