Set<ExecutableElement> methods = Sets.create();
methods.addAll(ElementFilter.methodsIn(type.getEnclosedElements()));
Set<ExecutableElement> saw = Sets.create();
for (TargetMethod target : targets) {
ExecutableElement method = target.method;
if (saw.contains(method)) {
raiseInvalid(method, "演算子メソッド{0}には複数の演算子注釈が付与されています");
} else {
saw.add(method);
boolean removed = methods.remove(method);
assert removed : method;
}
}
for (ExecutableElement method : methods) {
boolean helper = isOperatorHelper(method);
boolean open = method.getModifiers().contains(Modifier.PUBLIC);
if (helper && open == false) {
raiseInvalid(method, "演算子補助注釈の付いたメソッドはpublicである必要があります");
} else if (helper == false && open) {
raiseInvalid(method, "演算子クラスには演算子メソッド以外のpublicメソッドを宣言できません");
}