[ https://issues.apache.org/jira/browse/GROOVY-8859?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles resolved GROOVY-8859. --------------------------------- Fix Version/s: 5.0.0-alpha-3 Resolution: Fixed https://github.com/apache/groovy/commit/032ed6c5082f7e45ac4e7dfb6d3e578b61f5956d > fix trait private method consistency > ------------------------------------ > > Key: GROOVY-8859 > URL: https://issues.apache.org/jira/browse/GROOVY-8859 > Project: Groovy > Issue Type: Improvement > Components: Compiler > Reporter: Eric Milles > Assignee: Eric Milles > Priority: Minor > Labels: trait, traits > Fix For: 5.0.0-alpha-3 > > > It seems that private in a trait is akin to protected in a class. For > example a class that implements a trait may access private fields (through > namespace syntax) and properties and call private static methods. And it may > use Type.super.method() to disambiguate methods if necessary. *Why, however, > can a class that implements a trait not call private instance methods?* This > is not really covered in the language specification. > {code:groovy} > trait T { > private void privit() { > println 'private' > } > public void publik() { > println 'public' > } > } > class C implements T { > def m() { > publik() > privit() > } > } > new C().m() > {code} > This fails with missing method. But if static modifier is added to privit, > it succeeds. -- This message was sent by Atlassian Jira (v8.20.10#820010)