Skip to content

Commit

Permalink
GROOVY-7033
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Jan 20, 2022
1 parent 6b4f5d2 commit 5bd1319
Show file tree
Hide file tree
Showing 5 changed files with 644 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1754,6 +1754,26 @@ public void testAnonymousInnerClass33() {
runConformTest(sources);
}

@Test // GROOVY-7033
public void testAnonymousInnerClass34() {
//@formatter:off
String[] sources = {
"Script.groovy",
"new Object() {\n" +
" @Tag(String) def field\n" +
" @Tag(String) def method(@Tag(String) param) {\n" +
" def type = String\n" +
" }\n" +
"}\n",

"Tag.groovy",
"@interface Tag { Class<?> value() }\n",
};
//@formatter:on

runConformTest(sources);
}

@Test
public void testMixedModeInnerProperties_GRE597() {
//@formatter:off
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,14 +569,23 @@ public void visitConstructorCallExpression(ConstructorCallExpression call) {
currentScope.setClassScope(innerClass);
currentScope.setInStaticContext(false);
for (MethodNode method : innerClass.getMethods()) {
// GRECLIPSE add -- GROOVY-7033
visitAnnotations(method);
// GRECLIPSE end
Parameter[] parameters = method.getParameters();
// GRECLIPSE add -- GROOVY-7033
for (Parameter p : parameters) visitAnnotations(p);
// GRECLIPSE end
if (parameters.length == 0)
parameters = null; // null means no implicit "it"
ClosureExpression cl = new ClosureExpression(parameters, method.getCode());
visitClosureExpression(cl);
}

for (FieldNode field : innerClass.getFields()) {
// GRECLIPSE add -- GROOVY-7033
visitAnnotations(field);
// GRECLIPSE end
Expression expression = field.getInitialExpression();
pushState(field.isStatic());
if (expression != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,14 +504,23 @@ public void visitConstructorCallExpression(final ConstructorCallExpression expre
currentScope.setClassScope(innerClass);
currentScope.setInStaticContext(false);
for (MethodNode method : innerClass.getMethods()) {
// GRECLIPSE add -- GROOVY-7033
visitAnnotations(method);
// GRECLIPSE end
Parameter[] parameters = method.getParameters();
// GRECLIPSE add -- GROOVY-7033
for (Parameter p : parameters) visitAnnotations(p);
// GRECLIPSE end
if (parameters.length == 0) {
parameters = null; // null means no implicit "it"
}
visitClosureExpression(new ClosureExpression(parameters, method.getCode()));
}

for (FieldNode field : innerClass.getFields()) {
// GRECLIPSE add -- GROOVY-7033
visitAnnotations(field);
// GRECLIPSE end
Expression initExpression = field.getInitialExpression();
pushState(field.isStatic());
if (initExpression != null) {
Expand Down
2 changes: 1 addition & 1 deletion base/org.codehaus.groovy40/.checkstyle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<file-match-pattern match-pattern="groovy/ast/expr/RangeExpression.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/ast/expr/(Static)?MethodCallExpression.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/ast/tools/(Expression|Generics)Utils.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/(Annotation|Enum)Visitor.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/(Annotation|Enum|VariableScope)Visitor.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/(Extended)?Verifier.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/asm/WriterController.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/asm/sc/StaticInvocationWriter.java" include-pattern="false" />
Expand Down
Loading

0 comments on commit 5bd1319

Please sign in to comment.