Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Duplicate
-
Affects Version/s: 1.5.2
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
The test 'testClosureCallWithPrivateMethod' fails with Groovy 1.5.1 and 1.5.2 (I don't know about the other versions). It should not fail.
class Parent {
void publicMethod1() {
privateMethod()
}
void publicMethod2() {
[''].each { privateMethod()}
}
void publicMethod3() {
[''].each { protectedMethod()}
}
private void privateMethod() {}
protected void protectedMethod() {}
}
class Child extends Parent {}
class ClosureMethodCallTest extends GroovyTestCase {
void testDirectCall() {
// No exceptions means the test passes
new Child().publicMethod1()
}
void testClosureCallWithPrivateMethod() {
// No exceptions means the test passes
new Child().publicMethod2()
}
void testClosureCallWithProtectedMethod() {
// No exceptions means the test passes
new Child().publicMethod3()
}
}
Issue Links
- duplicates
-
GROOVY-3073
Private inheritance bug: Closure accessing private method
-
I can confirm this is no issue in 1.6