Java Code Examples for org.codehaus.groovy.ast.MethodNode#hasDefaultValue()
The following examples show how to use
org.codehaus.groovy.ast.MethodNode#hasDefaultValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExtendedVerifier.java From groovy with Apache License 2.0 | 6 votes |
private void visitOverride(AnnotatedNode node, AnnotationNode visited) { ClassNode annotationType = visited.getClassNode(); if (annotationType.isResolved() && annotationType.getName().equals("java.lang.Override")) { if (node instanceof MethodNode && !Boolean.TRUE.equals(node.getNodeMetaData(Verifier.DEFAULT_PARAMETER_GENERATED))) { boolean override = false; MethodNode origMethod = (MethodNode) node; ClassNode cNode = origMethod.getDeclaringClass(); if (origMethod.hasDefaultValue()) { List<MethodNode> variants = cNode.getDeclaredMethods(origMethod.getName()); for (MethodNode m : variants) { if (m.getAnnotations().contains(visited) && isOverrideMethod(m)) { override = true; break; } } } else { override = isOverrideMethod(origMethod); } if (!override) { addError("Method '" + origMethod.getName() + "' from class '" + cNode.getName() + "' does not override " + "method from its superclass or interfaces but is annotated with @Override.", visited); } } } }
Example 2
Source File: Verifier.java From groovy with Apache License 2.0 | 5 votes |
/** * Creates a new helper method for each combination of default parameter expressions. */ protected void addDefaultParameters(List<? extends MethodNode> methods, DefaultArgsAction action) { for (MethodNode method : methods) { if (method.hasDefaultValue()) { addDefaultParameters(action, method); } } }