private static void checkForDuplicateDeclaration(Tree.Declaration that,
final Declaration model) {
if (model.getName()!=null) {
if (model instanceof Setter) {
Setter setter = (Setter) model;
//a setter must have a matching getter
Declaration member =
model.getContainer().getDirectMember(model.getName(),
null, false);
if (member==null) {
that.addError("setter with no matching getter: '" +
model.getName() + "'");
}
else if (!(member instanceof Value)) {
that.addError("setter name does not resolve to matching getter: '" +
model.getName() + "'");
}
else if (!((Value) member).isTransient()) {
that.addError("matching value is a reference or is forward-declared: '" +
model.getName() + "'");
}
else {
Value getter = (Value) member;
setter.setGetter(getter);
if (getter.isVariable()) {
that.addError("duplicate setter for getter: '" +
model.getName() + "'");
}
else {