Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-2503 MOP 2.0 design inflluencing issues
  3. GROOVY-3073

Private inheritance bug: Closure accessing private method

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 5.0.0-alpha-1
    • class generator
    • None

    Description

      Even the inheritance is correct - the following sample returns a:

      Exception in thread "main" groovy.lang.MissingMethodException: No signature of method: test.Child.parentMethodB() is applicable for argument types: () values: {}

      Parent.java
      package test
      public class Parent{
      	private String parentMethodB(){
      		return "parentMethodB";
      	}
      	protected String parentMethodC(){
      		def closure={
      				return parentMethodB()}
      		return closure()
      	}
      }
      
      Child.java
      package test
      public class Child extends Parent{
      	public static void main(def args){
      		Child c = new Child();
      		println(c.parentMethodC())
      	}	
      }
      

      Attachments

        Issue Links

          Activity

            People

              emilles Eric Milles
              rbecke Raoul Becke
              Votes:
              6 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: