DESCRIPTION

tmf: Make TmfTimestamp and TmfTimeRange immutable

Mark the fields in TmfTimestamp/TmfTimeRange final, to ensure they
do not get modified after the object is created.

This required re-working the copy constructor in TmfSimpleTimestamp,
so we trade a IllegalArgumentException for a NullPointerException.
Both are run-time exceptions, so I don't think this is a big problem.

Other than that, the setter methods didn't seem to be used anywhere
so the impacts are minimal.

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


COMMENTS

author: Braxton Mccarthy
date: 2012-10-04 14:53:15.000000000

Uploaded patch set 2.

-------------------------------------
author: Brenden Conley
date: 2012-10-04 14:53:20.000000000

Patch Set 2:

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

-------------------------------------
author: Brenden Conley
date: 2012-10-04 15:05:26.000000000

Patch Set 2: Verified

Build Successful 

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

-------------------------------------
author: Janet Compton
date: 2012-10-30 19:04:34.000000000

Patch Set 2: IP review completed

(4 inline comments)



Line:57, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTimestamp.java -> After rebasing with the TmfTimestampFormat patch, you could replace "-9" by ITmfTimestamp.NANOSECOND_SCALE

Line:31, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/ITmfTimestamp.java -> Maybe bump the version to 2.0

Line:50, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/TmfSimpleTimestamp.java -> I'm having second thought on this one: maybe we should not throw an exception but use this as a conversion function i.e. normalize to scale=0 and drop the precision.

Line:54, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/TmfTimeRange.java -> Keep this. Like in C++, java will generate a public no-arg constructor if none is specified. Someone could use it by mistake and get null start/end times.

-------------------------------------
author: Luciana Barry
date: 2012-10-30 19:54:40.000000000

Patch Set 2: (1 inline comment)



Line:185, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/TmfTimestamp.java -> Now that it's immutable we could just return 'this' here.

-------------------------------------
author: Braxton Mccarthy
date: 2012-10-31 01:36:13.000000000

Patch Set 2: (5 inline comments)



Line:57, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTimestamp.java -> Done

Line:185, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/TmfTimestamp.java -> Yep, good catch

Line:31, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/ITmfTimestamp.java -> already done by rebasing

Line:50, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/TmfSimpleTimestamp.java -> sounds good, I'll drop the if

Line:54, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/TmfTimeRange.java -> Ok, I'll have it instantiate a new null range then.

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