[
https://issues.apache.org/jira/browse/GROOVY-11805?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles reassigned GROOVY-11805:
------------------------------------
Assignee: Eric Milles
> Groovy5 compiler throws exception:
> "org.codehaus.groovy.ast.ClassNode.getGenericsTypes()" is null
> -------------------------------------------------------------------------------------------------
>
> Key: GROOVY-11805
> URL: https://issues.apache.org/jira/browse/GROOVY-11805
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 5.0.2
> Reporter: Ed T
> Assignee: Eric Milles
> Priority: Major
>
> Compiler chokes on the following script. The code runs on JDK25 with Groovy
> 5.0.2.
>
> {code:java}
> interface BadBoy<T extends BadBoy<?>> {
> void doBadThing()
> }
> class MyBadBoy implements BadBoy<MyBadBoy> {
> void doBadThing() {
> println "bad thing!"
> }
> }
> class CreateBadThings {
> public static BadBoy<?> badThings(Closure cls) {
> println "bad things happened!"
> }
> }
> def classLoader = new GroovyClassLoader(this.class.getClassLoader())
> def shell = new GroovyShell(classLoader)
> def code = '''
> import static CreateBadThings.badThings
> badThings {
> }
> '''
> def compileAndRun(code, shell) {
> def script = shell.parse(code)
> script.run()
> }
> compileAndRun(code, shell) {code}
> It emits this error message.
> {code:java}
> BUG! exception in phase 'semantic analysis' in source unit 'Script1.groovy'
> unexpected NullPointerException
> at ConsoleScript9.compileAndRun(ConsoleScript9:29)
> at ConsoleScript9.run(ConsoleScript9:33)
> Caused by: java.lang.NullPointerException: Cannot load from object array
> because the return value of
> "org.codehaus.groovy.ast.ClassNode.getGenericsTypes()" is null{code}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)