On 10 September 2014 07:19, Philippe Mouawad <[email protected]> wrote: > well that's what I initially thought, first commit removed it. > Then sebb made a comment saying why I removed final. > I added it back to see if it worked , and it did. > > Although reading litterature it was said it would be an issue during > deserialization. > > According to this it seems you are right: > http://blog.clempinch.com/transient-and-final-instance-variables-in-java/ > > I think it works thougj because we rebuild an object from the deserialized > one.
In this case we could not use standard deserialisation techniques with the original non-transient final field anyway. That is one of the problems of serialisation - it's hard to use it on immutable fields which are built in their constructors. Adding the transient marker just stops the field from being serialised. AFAICT a non-constant final field cannot be serialised, regardless of the transient marker. > But your analysis and a ref article on this would help me learn new things > and have a definite position on this. > > Thanks for checking > > On Wednesday, September 10, 2014, Felix Schumacher < > [email protected] > <javascript:_e(%7B%7D,'cvml','[email protected]');>> wrote: > >> >> >> On 9. September 2014 13:25:39 MESZ, [email protected] wrote: >> >Author: pmouawad >> >Date: Tue Sep 9 11:25:38 2014 >> >New Revision: 1623759 >> > >> >URL: http://svn.apache.org/r1623759 >> >Log: >> >Bug 54648 - JMeter GUI on OS X crashes when using CMD+C (keyboard >> >shortcut or UI menu entry) on an element from the tree >> >Put back final. >> >Bugzilla Id: 54648 >> > >> >Modified: >> > jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java >> > >> >Modified: >> >jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java >> >URL: >> > >> http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java?rev=1623759&r1=1623758&r2=1623759&view=diff >> >> >============================================================================== >> >--- >> >jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java >> >(original) >> >+++ >> >jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java >> >Tue Sep 9 11:25:38 2014 >> >@@ -47,7 +47,7 @@ public class JMeterTreeNode extends Defa >> > private static final int TEST_PLAN_LEVEL = 1; >> > >> > // See Bug 54648 >> >- private transient JMeterTreeModel treeModel; >> >+ private final transient JMeterTreeModel treeModel; >> I don't believe that fields can be transient and final at the same time. >> >> Since transient is for serialization and final fields have to be set >> during construction. But deserialization will not call the constructor. >> >> Regards >> Felix >> > >> > private boolean markedBySearch; >> > >> >> > > -- > Cordialement. > Philippe Mouawad.
