If you return a java.util.Date field from a getter then it *needs* to be cloned or some other thread/consumer could easily modify it.
Example: class Foo { Date x Date getX() { return x // violation } Date getX_2() { return x.clone() // OK } }
Log in to post a comment.