private void attachTaskAction(final Method method, Collection<Action<Task>> actions, Collection<String> methods) {
if (method.getAnnotation(TaskAction.class) == null) {
return;
}
if (Modifier.isStatic(method.getModifiers())) {
throw new GradleException(String.format("Cannot use @TaskAction annotation on static method %s.%s().",
method.getDeclaringClass().getSimpleName(), method.getName()));
}
if (method.getParameterTypes().length > 0) {
throw new GradleException(String.format(
"Cannot use @TaskAction annotation on method %s.%s() as this method takes parameters.",
method.getDeclaringClass().getSimpleName(), method.getName()));
}
if (methods.contains(method.getName())) {
return;