You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Even if we declared value as val, immutablility will be broken if the target is mutable. Assigning final mutable collections or an arbitary object which holds some mutable fields, for example.
The current ProtectedProperty#value declared as var is a meaningless attempt - even worse, it breaks the immutability of the client code.
Therefore, change value to val so that mutability management can be left to the client code.
IMPACT
ProtectedProperty value changing codes will not compile after this fix.
The text was updated successfully, but these errors were encountered:
AS-IS
TO-BE
MOTIVATION
Even if we declared
value
asval
, immutablility will be broken if the target is mutable. Assigning final mutable collections or an arbitary object which holds some mutable fields, for example.The current
ProtectedProperty#value
declared asvar
is a meaningless attempt - even worse, it breaks the immutability of the client code.Therefore, change
value
toval
so that mutability management can be left to the client code.IMPACT
ProtectedProperty
value
changing codes will not compile after this fix.The text was updated successfully, but these errors were encountered: