groovy

Private inheritance bug: Closure accessing private method

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 1.5.6
  • Fix Version/s: 3.0
  • Component/s: class generator
  • Labels:
    None
  • Environment:
    Windows XP SP 2
    Eclipse 3.3 & groovy-all-1.5.6.jar
  • Number of attachments :
    0

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())
	}	
}

Issue Links

Activity

Hide
Raoul Becke added a comment -

Hi,
This issue can be "solved" (not really a solution) by turning the visility of method "private String parentMethodB(){...}" to protected: "protected String parentMethodB(){...}".
Regards
Raoul

Show
Raoul Becke added a comment - Hi, This issue can be "solved" (not really a solution) by turning the visility of method "private String parentMethodB(){...}" to protected: "protected String parentMethodB(){...}". Regards Raoul
Hide
blackdrag blackdrag added a comment -

this is more or less a known case. It is the result of a limitation in the current MOP. Since we plan to change the MOP in 2.0 I am setting the fix target for this to 2.0

Show
blackdrag blackdrag added a comment - this is more or less a known case. It is the result of a limitation in the current MOP. Since we plan to change the MOP in 2.0 I am setting the fix target for this to 2.0

People

Vote (2)
Watch (3)

Dates

  • Created:
    Updated: