Provide Sensitive Mutable Classes with Unmodifiable Wrappers
es.uniovi.reflection.analyses.cmu.obj56
We detect non-public fields that are returned by a public method, and their state may be mutated by an external client. We consider that a field will be mutable by an external client if its type has a public method that may modify its state (mutators), has a mutable field which is public or returned by a public method, or has any public non-final field. Additionally, it is checked whether there exists a subclass of the field type providing an immutable wrapper to recommend using it or implementing one. In such a wrapper, the mutator methods or the ones exposing the mutable fields must be overridden with implementations where the state of the object is not mutated or exposed.