groovy 中的私有方法不是私有的 [英] Private method in groovy is not private

查看:24
本文介绍了groovy 中的私有方法不是私有的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

class A {
    private def sayHello() {
       println "Anish"
    } 
 }

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

输出:Anish

有什么办法可以在 groovy 中保护 sayHello() 还是我遗漏了什么?

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

推荐答案

存在缺陷 在 Groovy 问题跟踪系统中,该缺陷仍然存在.

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

这篇关于groovy 中的私有方法不是私有的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆