Search code examples
groovyprivateprivate-members

Private method in groovy is not private


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?


Solution

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