|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Untamed: Selfless objects have no eq-identity -- only value-based identity. There are two varieties of Selfless objects: 1) Transparent Selfless objects are those implement the interface 'Selfless'. 2) Honorary Selfless object are instances of the classes listed in the list of honorary classes below (and therefore instances of any subclasses of those classes). In addition, null and all arrays are honorary Selfless objects.
Transparent Selfless objects are tested and hashed for sameness based only on their getSpreadUncall(). Two transparent Selfless object are the same exactly when their getSpreadUncall()s are the same. Two honorary Selfless objects are tested and hashed for sameness based on their Java .equals() and .hashCode() methods, which is trusted to be commutative. By contrast, selfish objects are tested and hashed for sameness using Java's EQ (Java's "==") and System.identityHashCode(). See Equalizer.same() for the authoritative sameness semantics.
Selfless object tend to be PassByConstruction, but this is not mandated. For example, Equalizer instances are Selfless but not PassByConstruction.
Arrays and null are also effectively Selfless objects, even though they can't be listed by honorary class below. Honorary selfless objects tend to be transparent, but SturdyRef and Equalizer are not.
PassByProxy objects (actual or HONORARY) may not be Selfless (actual or HONORARY). XXX Must find a way to enforce this.
org.erights.e.elib.ref.Ref#isSameEver
,
net.captp.jcomm.SturdyRef
Field Summary | |
static ConstSubclassSet |
HONORARY
Enabled: HONORARY (effectively) contains all the classes named in HONORED_NAMES and all their subclasses. |
static String[] |
HONORED_NAMES
Enabled: List of Java library classes that are compared using equals() and hashCode(). |
Method Summary | |
Object[] |
getSpreadUncall()
Enabled: Two Selfless objects are the same iff their getSpreadUncall()s are the same. |
Field Detail |
public static final String[] HONORED_NAMES
This is because, since they are JavaSoft's, we obviously can't go back and modify them to implement the Selfless interface, but we also obviously want people to be able to use them as if we had.
public static final ConstSubclassSet HONORARY
Method Detail |
public Object[] getSpreadUncall()
To make this work, we need an adequately strong convention as to what should be placed in this array. The convention is an element array describing the canonical expression for recreating the object. The elements are recipient, verb, and then the args. The described invocation
recipient.verb(args...)should create an object identical to this one. This should avoid collisions, since an object that isn't the same as this one could not correctly choose the same expression. Since the TCB depends on the correctness of getSpreadUncall(), all the implementors are considered in the TCB.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |