Skip to content

Commit fea9315

Browse files
committed
GROOVY-10121
1 parent 01cc9ac commit fea9315

File tree

4 files changed

+32
-11
lines changed

4 files changed

+32
-11
lines changed

base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform/AnnotationCollectorTests.java

+29-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2020 the original author or authors.
2+
* Copyright 2009-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,17 +33,17 @@ public void testAnnotationCollector1() {
3333
" String id\n" +
3434
" String hidden = '456'\n" +
3535
" \n" +
36-
" static void main(String[] args) {\n" +
36+
" static main(args) {\n" +
3737
" print(new Type(id:'123'))\n" +
3838
" }\n" +
39-
"}",
39+
"}\n",
4040

4141
"Alias.groovy",
4242
"import groovy.transform.*\n" +
4343
"@AnnotationCollector\n" +
4444
"@EqualsAndHashCode\n" +
4545
"@ToString\n" +
46-
"@interface Alias { }",
46+
"@interface Alias { }\n",
4747
};
4848
//@formatter:on
4949

@@ -60,23 +60,44 @@ public void testAnnotationCollector2() {
6060
" String id\n" +
6161
" String hidden = '456'\n" +
6262
" \n" +
63-
" static void main(String[] args) {\n" +
63+
" static main(args) {\n" +
6464
" print(new Type(id:'123'))\n" +
6565
" }\n" +
66-
"}",
66+
"}\n",
6767

6868
"Alias.groovy",
6969
"import groovy.transform.*\n" +
7070
"@AnnotationCollector([EqualsAndHashCode, ToString])\n" +
71-
"@interface Alias { }",
71+
"@interface Alias { }\n",
7272
};
7373
//@formatter:on
7474

7575
runConformTest(sources, "Type(123)");
7676
}
7777

78-
@Test
78+
@Test // GROOVY-10121
7979
public void testAnnotationCollector3() {
80+
//@formatter:off
81+
String[] sources = {
82+
"Main.groovy",
83+
"class Main {\n" +
84+
" static main(args) {\n" +
85+
" print(Alias.classes*.name)\n" +
86+
" }\n" +
87+
"}\n",
88+
89+
"Alias.groovy",
90+
"import groovy.transform.*\n" +
91+
"@AnnotationCollector()\n" +
92+
"@interface Alias { }\n",
93+
};
94+
//@formatter:on
95+
96+
runConformTest(sources, "[Alias$CollectorHelper]");
97+
}
98+
99+
@Test
100+
public void testAnnotationCollector4() {
80101
//@formatter:off
81102
String[] sources = {
82103
"Book.groovy",

base/org.codehaus.groovy25/src/org/codehaus/groovy/transform/AnnotationCollectorTransform.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public void transformClass(ClassNode cn) {
124124
// force no interfaces implemented
125125
helper.setInterfaces(ClassNode.EMPTY_ARRAY);
126126
} else {
127-
helper = new InnerClassNode(cn.getPlainNodeReference(), cn.getName() + "$CollectorHelper",
127+
helper = new InnerClassNode(cn/*GRECLIPSE edit -- GROOVY-10121 .getPlainNodeReference()*/, cn.getName() + "$CollectorHelper",
128128
ACC_PUBLIC | ACC_STATIC | ACC_FINAL, ClassHelper.OBJECT_TYPE.getPlainNodeReference());
129129
cn.getModule().addClass(helper);
130130
helper.addAnnotation(new AnnotationNode(COMPILESTATIC_CLASSNODE));

base/org.codehaus.groovy30/src/org/codehaus/groovy/transform/AnnotationCollectorTransform.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public void transformClass(ClassNode cn) {
123123
// force no interfaces implemented
124124
helper.setInterfaces(ClassNode.EMPTY_ARRAY);
125125
} else {
126-
helper = new InnerClassNode(cn.getPlainNodeReference(), cn.getName() + "$CollectorHelper",
126+
helper = new InnerClassNode(cn/*GRECLIPSE edit -- GROOVY-10121 .getPlainNodeReference()*/, cn.getName() + "$CollectorHelper",
127127
ACC_PUBLIC | ACC_STATIC | ACC_FINAL, ClassHelper.OBJECT_TYPE.getPlainNodeReference());
128128
cn.getModule().addClass(helper);
129129
helper.addAnnotation(new AnnotationNode(COMPILESTATIC_CLASSNODE));

base/org.codehaus.groovy40/src/org/codehaus/groovy/transform/AnnotationCollectorTransform.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public void transformClass(ClassNode cn) {
123123
// force no interfaces implemented
124124
helper.setInterfaces(ClassNode.EMPTY_ARRAY);
125125
} else {
126-
helper = new InnerClassNode(cn.getPlainNodeReference(), cn.getName() + "$CollectorHelper",
126+
helper = new InnerClassNode(cn/*GRECLIPSE edit -- GROOVY-10121 .getPlainNodeReference()*/, cn.getName() + "$CollectorHelper",
127127
ACC_PUBLIC | ACC_STATIC | ACC_FINAL, ClassHelper.OBJECT_TYPE.getPlainNodeReference());
128128
cn.getModule().addClass(helper);
129129
helper.addAnnotation(new AnnotationNode(COMPILESTATIC_CLASSNODE));

0 commit comments

Comments
 (0)