001 // Copyright 2006-07 Regents of the University of California. May be used 002 // under the terms of the revised BSD license. See LICENSING for details. 003 /** 004 * @author Adrian Mettler 005 */ 006 package org.joe_e; 007 008 /** 009 * Marker interface for annotating classes that are indistinguishable from 010 * a shallow copy of themselves. 011 * <p> 012 * Joe-E requires that classes that implement this interface must 013 * meet all of the following obligations: 014 * <ol> 015 * <li> All instance fields must be final. 016 * <li> The class cannot be equatable. 017 * <li> The object identity of instances of the class is not visible This can 018 * be satisfied by either of: 019 * <ol> 020 * <li> The superclass implements Selfless; or, 021 * <li> The class's superclass is java.lang.Object, the class overrides 022 * <code>equals()</code>, and doesn't call <code>super.equals()</code>. 023 * </ol> 024 * <li> The object provides a hash code that does not reveal object identity. 025 * This requirement is enforced by including hashCode() in the interface. 026 * </ol> 027 * <p> 028 * The Joe-E verifier ensures that Joe-E code cannot distinguish a 029 * shallow copy of a Selfless object from the original object. 030 * 031 * @see Equatable 032 */ 033 public interface Selfless { 034 int hashCode(); 035 /* 036 boolean equals(Object obj); 037 */ 038 }