§6.2.(e) Role migration

The following interfaces can be used to enable role migration:

IBaseMigratable
This interface declares a method
    <B> void migrateToBase(B otherBase) 
and instructs the compiler to generate an implementation of this method for any bound role declaring IBaseMigratable as its super-interface.
The effect of calling migrateToBase on a role instance is to re-bind this role to a new base instance. The base instance must be compatible to the role's base class (in order to avoid problems during lifting the compiler may require the base to be of the exact type of the role's base class). Passing null to this method causes an NullPointerException to be thrown.
ITeamMigratable
This interface declares a method
    <R> R<@otherTeam> migrateToTeam(final ITeam otherTeam)
and instructs the compiler to generate an implementation of this method for any role declaring ITeamMigratable as its super-interface.
The effect of calling migrateToTeam on a role instance is to re-bind this role to become a contained part of a new team instance. The team instance must be of the exact type of the role's enclosing team. Passing null to this method causes a NullPointerException to be thrown.
Caveat:
This method intentionally breaks the rules of family polymorphism: any reference R<@previousTeam> r which was established before migration will incorrectly imply that the role's enclosing team still is previousTeam, which is no longer true after migration. While this does not effect any method lookup (which is still safe), further assumptions based on a role's dependent type are invalidated by team migration. The same holds for references from the migrating role to any sibling role instances.
If the rules of family polymorphism should be maintained one should just refrain from declaring ITeamMigratable as a role's super-interface.

For both methods the signature declared in the interface is over-generalized, yet the compiler performs the necessary checks to ensure that role, base and team instances are indeed compatible and additionally the return type of migrateToTeam is checked as a self-type, i.e., it reflects the exact type of the call target.