Eclipse has a java compiler option called "declaring a field hides another field or variable" that can be set to a warning / error.
How important is this warning in your opinion?
What is a good standard way to solve this problem?
Sample code where this happens:
public class Test {
private String caption = null;
public Test(String caption) {
this.caption = caption;
}
}
I saw solutions in which the field was renamed, i.e. "fCaption", but this can cause automatic getters / setters to be scattered with odd names ( getfCaption()). Not readable, but ugly ...
Edit: Oh yes, it is possible to rename a method signature Test(String caption_)or something similar, but that will turn out to be in javadoc looking weird.