DESCRIPTION

tmf: Make TmfEvent abstract and immutable

The immediate benefit of immutable events is that we can avoid
doing copies in many places in the framework (for indexing,
checkpoints, et al.). It also alleviates many potential
concurrency issues.

For specific sub-classes that need to have mutable (non-final)
fields, the recommended approach is to re-define the fields
in question and override the getters to make sure the extended
class's versions are used.
This was done for CustomEvent in this patch.

Change-Id: I6a9ec635eaa68b03d1c5a6875f60ece7d47cb024
Signed-off-by: Braxton Mccarthy xxx@xxx.xxx


COMMENTS

author: Brenden Conley
date: 2013-02-01 22:42:49.000000000

Patch Set 1:

Build Started https://hudson.eclipse.org/sandbox/job/linuxtools/1273/ 

-------------------------------------
author: Brenden Conley
date: 2013-02-01 22:54:27.000000000

Patch Set 1: Verified

Build Successful 

https://hudson.eclipse.org/sandbox/job/linuxtools/1273/ : SUCCESS

-------------------------------------
author: Luciana Barry
date: 2013-02-05 19:55:41.000000000

Patch Set 1: I would prefer that you didn't submit this

(4 inline comments)



Line:32, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/TmfEvent.java -> I don't see the benefit of making it abstract.

Line:222, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomEvent.java -> Needs to consider the new custom fields.

Line:247, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomEvent.java -> Needs to consider the new custom fields.

Line:250, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomEvent.java -> Needs to override toString().

-------------------------------------
author: Braxton Mccarthy
date: 2013-02-05 20:02:09.000000000

Patch Set 1: (2 inline comments)



Line:247, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomEvent.java -> Good point, will add those.

Line:250, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomEvent.java -> The behaviour should remain the same, since TmfEvent's toString() now calls the getters (it would call the overriden getters for subclasses).

And for the object name itself (TmfEvent=...) could we just call this.getClass().getName() ? So we would stop having to override the toString() in every single implementation...

-------------------------------------
author: Luciana Barry
date: 2013-02-05 20:39:36.000000000

Patch Set 1: (2 inline comments)



Line:109, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomEvent.java -> I think we either need to store the relevant parameters in the new custom fields, or remove them from the constructor (pass null to super) and solely rely on the setters. Maybe even pass null to super regardless of the option chosen, to be sure they are not used...

Line:250, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/custom/CustomEvent.java -> True, missed that change!

Good idea to use the class name in the base toString.

-------------------------------------
