codeconsole opened a new pull request, #3254:
URL: https://github.com/apache/groovy/pull/3254

   https://issues.apache.org/jira/browse/GROOVY-12720
   
   A script that declares its own no-argument `run()` keeps it, and 
`ModuleNode.createStatementsClass` copies the method's annotations to the 
script class so that, for example, `@CompileStatic` on `run()` applies to the 
whole class. `@Override` was copied too, and the class then failed to compile 
with "Annotation @java.lang.Override is not allowed on element TYPE", although 
the method does override `Script#run()`:
   
   ```groovy
   @Override
   Object run() {
       'done'
   }
   ```
   
   The copy now leaves `@Override` out; it stays on the method. The other 
annotations move to the class as before.
   
   Tests: `bugs.Groovy12720` covers the script above compiling and running, 
`@CompileStatic` beside `@Override` still reaching the class, and `@Override` 
on another script method still being rejected. Also run locally: 
`groovy.lang.GroovyShellTest`, `groovy.util.MiscScriptTest`, 
`org.codehaus.groovy.ast.*` and `gls.annotations.*`, 427 tests in all, passing.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to