[ 
https://issues.apache.org/jira/browse/GROOVY-3073?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16369559#comment-16369559
 ] 

Matthew Moss commented on GROOVY-3073:
--------------------------------------

Is this case the same? Or should this be a separate issue?

Of note:  If {{Bar}} is annotated with {{@CompileStatic}}, the call to 
{{foo.run()}} succeeds.

 
{code:java}
class Bar {
  def run = {
    hello()
  }
  private hello() {
    println "hello"
  }
}
class Foo extends Bar { }
foo = new Foo()
foo.run()
{code}
 

 

> Private inheritance bug: Closure accessing private method
> ---------------------------------------------------------
>
>                 Key: GROOVY-3073
>                 URL: https://issues.apache.org/jira/browse/GROOVY-3073
>             Project: Groovy
>          Issue Type: Sub-task
>          Components: class generator
>    Affects Versions: 1.5.6
>         Environment: Windows XP SP 2
> Eclipse 3.3 & groovy-all-1.5.6.jar
>            Reporter: Raoul Becke
>            Priority: Major
>
> Even the inheritance is correct - the following sample returns a:
> {color:red}
> Exception in thread "main" groovy.lang.MissingMethodException: No signature 
> of method: test.Child.parentMethodB() is applicable for argument types: () 
> values: {}
> {color}
> {code:title=Parent.java|borderStyle=solid}
> package test
> public class Parent{
>       private String parentMethodB(){
>               return "parentMethodB";
>       }
>       protected String parentMethodC(){
>               def closure={
>                               return parentMethodB()}
>               return closure()
>       }
> }
> {code} 
> {code:title=Child.java|borderStyle=solid}
> package test
> public class Child extends Parent{
>       public static void main(def args){
>               Child c = new Child();
>               println(c.parentMethodC())
>       }       
> }
> {code} 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to