groovy call private method in Java super class
- by Jeff Storey
I have an abstract Java class MyAbstractClass with a private method. There is a concrete implementation MyConcreteClass.
public class MyAbstractClass {
private void somePrivateMethod();
}
public class MyConcreteClass extends MyAbstractClass {
// implementation details
}
In my groovy test class I have
class MyAbstractClassTest {
void myTestMethod() {
MyAbstractClass mac = new MyConcreteClass()
mac.somePrivateMethod()
}
}
I get an error that there is no such method signature for somePrivateMethod. I know groovy can call private methods but I'm guessing the problem is that the private method is in the super class, not MyConcreteClass. Is there a way to invoke a private method in the super class like this (other than using something like PrivateAccessor)?
thanks
Jeff