DESCRIPTION

ctf: make BitBuffer's ByteBuffer final

No more chances of someone swapping it while you're reading.

Change-Id: I344ed316489918dc0751c09c464fada3d4ac02ab
Signed-off-by: Ivy Mitchell xxx@xxx.xxx


COMMENTS

author: Ivy Mitchell
date: 2014-06-18 17:10:13.000000000

Uploaded patch set 3.

-------------------------------------
author: Brenden Conley
date: 2014-06-18 18:10:41.000000000

Patch Set 3:

Build Started https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/7423/

-------------------------------------
author: Brenden Conley
date: 2014-06-18 18:29:53.000000000

Patch Set 3: Verified-1

Build Failed 

https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/7423/ : FAILURE

-------------------------------------
author: Braxton Mccarthy
date: 2014-06-18 20:16:44.000000000

Patch Set 3: Code-Review-1

(8 comments)

Some comments, and also, why not make BitBuffer's ByteOrder final too?

Line:120, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFStreamInput.java -> hmm, ugly workaround. If it is not / cannot be final, leave the field nullable and mark it null here. It would be more representative.

Line:122, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFStreamInput.java -> no point doing setByteOrder if you won't use this instance

Line:50, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFStreamInputPacketReader.java -> remove this annotation, and use = null instead. See comment below.

This will give appropriate warnings, where the bitbuffer should be extracted to local variables and nullchecked before being used. Right now, one could start using a bitbuffer that is pointto the EMPTY_BUFFER.

Line:172, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFStreamInputPacketReader.java -> I'm not convinced this is really needed to free file descriptors... you don't close ByteBuffers, they're only something in memory.

Anyway, to be safe, we could keep it as it is. However, it's be more simple/representative to make the fBitBuffer null here.

Line:278, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFStreamInputPacketReader.java -> = null

Line:50, lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/io/BitBufferIntTest.java -> spacing

Line:55, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/io/BitBuffer.java xxx@xxx.xxx after final

but anyway, what is the point of this?

Line:672, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/io/BitBuffer.java -> no need for this comment, we xxx@xxx.xxx to avoid breaking the API

-------------------------------------
author: Braxton Mccarthy
date: 2014-06-18 20:17:17.000000000

Patch Set 3:

(1 comment)

Line:60, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/io/BitBuffer.java -> This should become final too (set at the constructor only)

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