The key to making encapsulation work is to have methods [color=Red]never directly access[/color] instance
fields in a class other than their own. Programs should interact with object data [color=Red]only[/color]
through the object’s methods.
从这个描述上,我认为反射破坏封装这句话是错误的,因为封装他的概念是其他类的[color=Red]不能直接访问[/color]封装类的实例域,程序之间的交互仅仅通过对象的方法,那么反射其实就是通过对象的方法来完成访问实例域的,并没有直接访问实例域。
Encapsulation is the way to give the object its “black box”
behavior, which is the key to [color=Red]reuse[/color] and reliability.
这说明他的封装的目的并不是让别人无法访问,而是让封装的类有更好的可重用性和可靠性。