On 2017-12-14 13:29, Alan Bateman wrote:
On 14/12/2017 12:25, Claes Redestad wrote:
We need the cleanable = null case for the FinalizableZStreamRef case,
otherwise we'd go into spin. The cleanable is implicitly checked for
null in the ZStreamRef.get method, which is the only one
used outside of these classes.
Okay but can the clean method at least check if cleanable is null to
avoid needing to wonder if it's possible.
It isn't possible: cleanable can be null only when we're a
FinalizableZStreamRef, which overrides clean and ignores cleanable. This
awkwardness stems from the fact that we *don't* want ZStreamRef to have
a finalizer,
so we need to inherit in the "unnatural" direction. We could possibly
model this more cleanly with an interface and two disjoint
implementations, but I don't want to attempt such a refactoring now.
Also can the constructors be grouped as it's very confusing to not
have them grouped together (dropping the space in "ZStreamRef (" would
help too. Otherwise I think the approach is okay.
I've dropped the ZStreamRef(long) constructors and fixed a few
whitespace issues in the latest webrev.
/Claes