As of JCR 2.0 Node.addMixin(String) mandates that adding an existing mixin has no effect (previously it
would had to throw in that situation):
Adds the mixin node type named mixinName to this node. If this node is already of type mixinName
(either due to a previously added mixin or due to its primary type, through inheritance) then this
method has no effect. Otherwise mixinName is added to this node's jcr:mixinTypes property.
However, Node.canAddMixin(String) has not been adjusted and states:
"Returns <code>true</code> if the mixin node type called
- <code>mixinName</code>, can be added to this node. Returns
- <code>false</code> otherwise. A result of <code>false</code> must be
- returned in each of the following cases: <ul> <li> The mixin's definition
- conflicts with an existing primary or mixin node type of this node. </li>
From my point of view this contradicts the contract of Node.addMixin and the reason
for the canAddMixin method itself.
My understanding of Node.canAddMixin is, that it is a utility that indicates to
the user, whether he/she can call Node.addMixin or not. And i would expect
that Node.canAddMixin is symmetric to Node.addMixin.
With the current situation, Node.canAddMixin would return false even if
Node.addMixin would not complain...