Skip to content

Commit bacc5e5

Browse files
committed
GROOVY-10861, GROOVY-10862
1 parent 13ff11b commit bacc5e5

File tree

15 files changed

+2088
-31
lines changed

15 files changed

+2088
-31
lines changed

base/org.codehaus.groovy25/.checkstyle

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
<file-match-pattern match-pattern="groovy/transform/trait/TraitASTTransformation.java" include-pattern="false" />
6969
<file-match-pattern match-pattern="groovy/transform/trait/TraitComposer.java" include-pattern="false" />
7070
<file-match-pattern match-pattern="groovy/transform/trait/Traits.java" include-pattern="false" />
71+
<file-match-pattern match-pattern="groovy/vmplugin/v5/Java5.java" include-pattern="false" />
7172
</fileset>
7273
<filter name="DerivedFiles" enabled="true" />
7374
</fileset-config>

base/org.codehaus.groovy25/src/org/codehaus/groovy/ast/MethodNode.java

+9-7
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
* Represents a method declaration.
3232
*/
3333
public class MethodNode extends AnnotatedNode implements Opcodes {
34-
34+
/* GRECLIPSE edit
3535
public static final String SCRIPT_BODY_METHOD_KEY = "org.codehaus.groovy.ast.MethodNode.isScriptBody";
36-
36+
*/
3737
private String name;
3838
private int modifiers;
3939
private boolean syntheticPublic;
@@ -190,11 +190,11 @@ public boolean isScriptBody() {
190190
/* GRECLIPSE edit
191191
return getNodeMetaData(SCRIPT_BODY_METHOD_KEY) != null;
192192
*/
193-
return getDeclaringClass() != null &&
194-
getDeclaringClass().isScript() &&
195-
getName().equals("run") &&
196-
(parameters == null || parameters.length == 0) &&
197-
(returnType != null && returnType.getName().equals("java.lang.Object"));
193+
return getName().equals("run")
194+
&& getDeclaringClass() != null
195+
&& getDeclaringClass().isScript()
196+
&& (parameters == null || parameters.length == 0)
197+
&& (returnType != null && returnType.getName().equals(ClassHelper.OBJECT));
198198
// GRECLIPSE end
199199
}
200200

@@ -203,7 +203,9 @@ public boolean isScriptBody() {
203203
* @see ModuleNode#createStatementsClass()
204204
*/
205205
public void setIsScriptBody() {
206+
/* GRECLIPSE edit
206207
setNodeMetaData(SCRIPT_BODY_METHOD_KEY, Boolean.TRUE);
208+
*/
207209
}
208210

209211
public String toString() {

base/org.codehaus.groovy25/src/org/codehaus/groovy/classgen/AnnotationVisitor.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ private boolean checkIfMandatoryAnnotationValuesPassed(AnnotationNode node) {
142142
/* GRECLIPSE edit
143143
if (mn.getCode() == null && !attributes.containsKey(methodName)) {
144144
*/
145-
if (!mn.hasAnnotationDefault() && !attributes.containsKey(methodName)) {
145+
if (!mn.hasAnnotationDefault() && !attributes.containsKey(methodName) && !"dataVariableNames".equals(methodName)) {
146+
// TODO: https://github.com/spockframework/spock/issues/1549 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
146147
// GRECLIPSE end
147148
addError("No explicit/default value found for annotation attribute '" + methodName + "'", node);
148149
ok = false;

0 commit comments

Comments
 (0)