for (CtMethod method : methods) {
T annotation = getMethodAnnotation(method, annotationClass);
if (isOverride(annotation)) {
if (overrideInitMethod != null) {
throw new GwtTestPatchException("There are more than one @"
+ annotationClass.getSimpleName()
+ " with 'override=true' for the same target : '" + method.getLongName()
+ "' and '" + overrideInitMethod.getLongName() + "'");
} else {
overrideInitMethod = method;
}
}
}
if (overrideInitMethod == null) {
StringBuilder sb = new StringBuilder();
sb.append(methods.size()).append(" @");
sb.append(annotationClass.getSimpleName());
sb.append(" methods detected for the same target, but no one is set to override the other. You must use 'override=true' on the one which should be applied : ");
for (CtMethod method : methods) {
sb.append("'").append(method.getLongName()).append("'");
sb.append(" or ");
}
throw new GwtTestPatchException(sb.substring(0, sb.length() - 4));
}
return overrideInitMethod;
}