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
public class Test {
private List<Integer> ints;
public Test2(List<Integer> ints) {
this.ints = List.copyOf(ints);
}
public List<Integer> getInts() {
return ints;
}
}
SpotBugs raises a warning EI_EXPOSE_REP because Test.getInts() may expose internal representation by returning Test.ints
However since List.copyOf creates an unmodifiable list, no mutable internal representation is returned and this is a false positive.
The text was updated successfully, but these errors were encountered:
Given the following class:
SpotBugs raises a warning
EI_EXPOSE_REP
becauseTest.getInts() may expose internal representation by returning Test.ints
However since
List.copyOf
creates an unmodifiable list, no mutable internal representation is returned and this is a false positive.The text was updated successfully, but these errors were encountered: