§2.4.1.(c) Duplicate role runtime check
If it cannot be syntactically derived, that the argument to a lifting
constructor is a freshly created base object (b), a compile time warning will
signal that an additional runtime check is needed: It must be prevented that
a new role is created for a base object, which already has a role of the
required type in the given team. It is not possible to replace an existing
role by use of the lifting constructor. At runtime, any attempt to do so
will cause a org.objectteams.DuplicateRoleException
to be thrown.
This exception can only occur in situations where the mentioned compile
time warning had been issued.
§6.1 will introduce reflective functions
which can be used to manually prevent errors like a duplicate role.