大家帮我看下findbug提示的这个bug是什么意思?
public class Test {
private String[] name; //如果name的类型为String 就不会有bug提示
public String[] getName() {
return this.name;
}
public void setName(String[] name) {
this.name = name;
}
}
///下面是findbug的错误提示:英文不是太好,看的不是很明白
May expose internal representation by incorporating reference to mutable
object</b><br/><p> This code stores a reference to an externally mutable
object into the
internal representation of the object.
If instances
are accessed by untrusted code, and unchecked changes to
the mutable object would compromise security or other
important properties, you will need to do something different.
Storing a copy of the object is better approach in many situations
为什么把name的类型改为String后,就没有bug提示了?