Is there any Checkstyle, PMD or Findbugs rule which could find the following non threadsafe spring singleton implementation?
private String helperVar;
public String getValue(String value) {
helperVar = value;
return convertValue();
}
private String convertValue() {
return helperVar.trim();
}
I know this sample is horrible but it is the easiest way to show what I mean.
When executing the getValue method from the bean in a single execution it would work fine. But when executing it in a multi user environment it would lead to unpredictable errors/behaviour.
Is there a way to find these occurences without going through the code manually? Are there any static code checkers which could check this and each variation of it automatically?