org.joe_e
Interface Selfless

All Known Implementing Classes:
BooleanArray, ByteArray, CharArray, ConstArray, DoubleArray, FloatArray, ImmutableArray, IntArray, LongArray, PowerlessArray, ShortArray, Struct

public interface Selfless

Marker interface for annotating classes that are indistinguishable from a shallow copy of themselves.

Joe-E requires that classes that implement this interface must meet all of the following obligations:

  1. All instance fields must be final.
  2. The class cannot be equatable.
  3. The object identity of instances of the class is not visible This can be satisfied by either of:
    1. The superclass implements Selfless; or,
    2. The class's superclass is java.lang.Object, the class overrides equals(), and doesn't call super.equals().
  4. The object provides a hash code that does not reveal object identity. This requirement is enforced by including hashCode() in the interface.

The Joe-E verifier ensures that Joe-E code cannot distinguish a shallow copy of a Selfless object from the original object.

See Also:
Equatable

Method Summary
 int hashCode()
          Returns a hash code value for the object.
 

Method Detail

hashCode

int hashCode()
Suppressed. reveals non-deterministic address of object

Description copied from class: Object
Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by HashMap.

The general contract of hashCode is:

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)

Overrides:
hashCode in class Object
Returns:
a hash code value for this object.
See Also:
Object.equals(java.lang.Object), System.identityHashCode(java.lang.Object)