I have a method which takes an Array of object as input and stores it in an instance variable. Here is the code that does it but, FindBugs reports it an error saying "May expose internal representation by incorporating reference to mutable object".
public final class HelloWorld
{
public final Hello objs[];
public HelloWorld(Hello[] inputs)
{
this.objs = inputs;
}
}
I tried using Arrays.copyOf but, still i am getting this error.
this.objs = Arrays.copyOf(inputs,inputs.length);
How can i fix this FindBugs issue ?