[ https://issues.apache.org/jira/browse/GROOVY-11613?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17943922#comment-17943922 ]
Eric Milles edited comment on GROOVY-11613 at 4/13/25 1:19 PM: --------------------------------------------------------------- Can you try this in Groovy 5? The "trait" in the error message suggests your case is going through Groovy 4's emulation of interfaces with members via traits. Groovy 5 does not convert interfaces to traits as an implementation detail. was (Author: emilles): Can you try this in Groovy 5. The "trait" in the error message suggests your case is going through Groovy 4's emulation of interfaces with members via traits. Groovy 5 does not convert interfaces to traits as an implementation detail. > Cannot call on outerclass's default method if the inner class extends that > outerclass > ------------------------------------------------------------------------------------- > > Key: GROOVY-11613 > URL: https://issues.apache.org/jira/browse/GROOVY-11613 > Project: Groovy > Issue Type: Bug > Components: Compiler, Static compilation > Affects Versions: 4.0.24 > Reporter: Saravanan > Priority: Minor > > > {code:java} > public interface Interfaces { > default String myThing() { > return "BLAHG" > } > // Groovy fails with Cannot have non-static inner class > // inside a trait (com.org.interfaces.Interfaces$Inner) > // Does not fare better if we add static. Works with abstract classes > public interface Inner extends Interfaces { > default String otherThing() { > return myThing() > } > } > } {code} > The first error I get is that inner classes in a trait cannot be non static. > But if I make it static, I get a null pointer exception looking for the trait > helper class (because the trait's helper class was not created yet when > parsing the inner class) > -- This message was sent by Atlassian Jira (v8.20.10#820010)