Skip to content

Commit

Permalink
GROOVY-10861, GROOVY-10862
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Dec 5, 2022
1 parent 13ff11b commit bacc5e5
Show file tree
Hide file tree
Showing 15 changed files with 2,088 additions and 31 deletions.
1 change: 1 addition & 0 deletions base/org.codehaus.groovy25/.checkstyle
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
<file-match-pattern match-pattern="groovy/transform/trait/TraitASTTransformation.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/transform/trait/TraitComposer.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/transform/trait/Traits.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/vmplugin/v5/Java5.java" include-pattern="false" />
</fileset>
<filter name="DerivedFiles" enabled="true" />
</fileset-config>
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
* Represents a method declaration.
*/
public class MethodNode extends AnnotatedNode implements Opcodes {

/* GRECLIPSE edit
public static final String SCRIPT_BODY_METHOD_KEY = "org.codehaus.groovy.ast.MethodNode.isScriptBody";

*/
private String name;
private int modifiers;
private boolean syntheticPublic;
Expand Down Expand Up @@ -190,11 +190,11 @@ public boolean isScriptBody() {
/* GRECLIPSE edit
return getNodeMetaData(SCRIPT_BODY_METHOD_KEY) != null;
*/
return getDeclaringClass() != null &&
getDeclaringClass().isScript() &&
getName().equals("run") &&
(parameters == null || parameters.length == 0) &&
(returnType != null && returnType.getName().equals("java.lang.Object"));
return getName().equals("run")
&& getDeclaringClass() != null
&& getDeclaringClass().isScript()
&& (parameters == null || parameters.length == 0)
&& (returnType != null && returnType.getName().equals(ClassHelper.OBJECT));
// GRECLIPSE end
}

Expand All @@ -203,7 +203,9 @@ public boolean isScriptBody() {
* @see ModuleNode#createStatementsClass()
*/
public void setIsScriptBody() {
/* GRECLIPSE edit
setNodeMetaData(SCRIPT_BODY_METHOD_KEY, Boolean.TRUE);
*/
}

public String toString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ private boolean checkIfMandatoryAnnotationValuesPassed(AnnotationNode node) {
/* GRECLIPSE edit
if (mn.getCode() == null && !attributes.containsKey(methodName)) {
*/
if (!mn.hasAnnotationDefault() && !attributes.containsKey(methodName)) {
if (!mn.hasAnnotationDefault() && !attributes.containsKey(methodName) && !"dataVariableNames".equals(methodName)) {
// TODO: https://github.com/spockframework/spock/issues/1549 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// GRECLIPSE end
addError("No explicit/default value found for annotation attribute '" + methodName + "'", node);
ok = false;
Expand Down
Loading

0 comments on commit bacc5e5

Please sign in to comment.