File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
grails-core/src/main/groovy/org/grails/compiler/injection
grails-plugin-controllers/src/main/groovy/org/grails/compiler/web Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 3737import org .codehaus .groovy .syntax .Token ;
3838import org .codehaus .groovy .syntax .Types ;
3939import org .codehaus .groovy .transform .sc .StaticCompileTransformation ;
40+ import org .codehaus .groovy .transform .trait .Traits ;
4041import org .grails .io .support .FileSystemResource ;
4142import org .grails .io .support .Resource ;
4243import org .springframework .util .StringUtils ;
@@ -1502,4 +1503,8 @@ public static URL getSourceUrl(ClassNode classNode) {
15021503 public static boolean hasParameters (MethodNode methodNode ) {
15031504 return methodNode .getParameters ().length > 0 ;
15041505 }
1506+
1507+ public static boolean isInheritedFromTrait (MethodNode methodNode ) {
1508+ return hasAnnotation (methodNode , Traits .TraitBridge .class );
1509+ }
15051510}
Original file line number Diff line number Diff line change 2323import static org .grails .compiler .injection .GrailsASTUtils .hasAnnotation ;
2424import static org .grails .compiler .injection .GrailsASTUtils .hasParameters ;
2525import static org .grails .compiler .injection .GrailsASTUtils .removeAnnotation ;
26+ import static org .grails .compiler .injection .GrailsASTUtils .isInheritedFromTrait ;
2627import grails .artefact .Artefact ;
2728import grails .artefact .controller .support .AllowedMethodsHelper ;
2829import grails .compiler .DelegatingMethod ;
@@ -237,9 +238,7 @@ private boolean isExceptionHandlingMethod(MethodNode methodNode) {
237238 return isExceptionHandler ;
238239 }
239240
240- private boolean isTraitMethod (MethodNode methodNode ) {
241- return GrailsASTUtils .hasAnnotation (methodNode , Traits .TraitBridge .class );
242- }
241+
243242
244243 private void processMethods (ClassNode classNode , SourceUnit source ,
245244 GeneratorContext context ) {
@@ -303,7 +302,7 @@ public Object call(Object object) {
303302 */
304303 protected boolean methodShouldBeConfiguredAsControllerAction (final MethodNode method ) {
305304 int minLineNumber = 0 ;
306- if (isTraitMethod (method ) && hasAnnotation (method , Action .class ) && hasParameters (method )) {
305+ if (isInheritedFromTrait (method ) && hasAnnotation (method , Action .class ) && hasParameters (method )) {
307306 removeAnnotation (method , Action .class );
308307 //Trait methods have a line number of -1
309308 --minLineNumber ;
You can’t perform that action at this time.
0 commit comments