Private method in groovy is not private

anish picture anish · Oct 21, 2011 · Viewed 28k times · Source
class A {
    private def sayHello() {
       println "Anish"
    } 
 }

 def a_obj = new A()
 a_obj.sayHello()

output : Anish

Is there any way to protect sayHello() in groovy or am I missing something?

Answer

Andrey Adamovich picture Andrey Adamovich · Oct 21, 2011

There is defect on that in Groovy issue tracking system and that defect is still open.