Consider this
public class Data {
private final SomeField[] fields;
.....
public SomeField[] getFields() {
return map == null ? null : map.
To solve this problem you must avoid to user ternary operator. Instead of this, you must use if operator.
Example:
public CustomMap[] getMap() { CustomMap[] obj = null;
if (map != null){
obj = map.clone();
}
return obj;
}
OR
public CustomMap[] getMap() {
CustomMap[] obj = map == null ? null : map.close();
return obj;
}
I solve my problem using the abouve code. I think that is mandatory to create a new object explicit. I think.
Regards!