[ https://issues.apache.org/jira/browse/GROOVY-11641?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17950078#comment-17950078 ]
Eric Milles commented on GROOVY-11641: -------------------------------------- I think this may be one step too far. When I look over the trait specification for guidance, the only thing I can find on this is that fields need to use the coded form when used outside of the trait. [https://docs.groovy-lang.org/latest/html/documentation/#_public_fields] I don't really like the idea of this, but it is consistent with usage of trait fields in implementing classes: {code:groovy} package p trait A { public static final String CONST = "..." // public is discouraged } trait B extends A { static m() { p_A__CONST // not just "CONST" } } class C implements B { void test() { print(m()) } } {code} [~blackdrag] [~paulk] Thoughts on rolling this back? > trait extends trait and uses static field in static method > ---------------------------------------------------------- > > Key: GROOVY-11641 > URL: https://issues.apache.org/jira/browse/GROOVY-11641 > Project: Groovy > Issue Type: Bug > Reporter: Eric Milles > Assignee: Eric Milles > Priority: Minor > Fix For: 5.0.0-alpha-13 > > > Consider the following: > {code:groovy} > trait Foo { > public static final String BANG = '!' > } > trait Bar extends Foo { > static staticMethod(String string) { > string + BANG > } > } > class Main implements Bar { > static test1() { > String result = staticMethod('works') > assert result == 'works!' > } > void test2() { > String result = staticMethod('works') > assert result == 'works!' > } > } > Main.test1() > new Main().test2() > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)