在编写测试的同时您也就熟悉了未知代码的内部构造。
You explore the internals of the unknown code while writing the tests.
escape指的是对象引用没有保存到堆中,或者传递给可能保留一份拷贝的未知代码。
By escape, we mean that a reference to it is not stored into the heap or passed to unknown code that might retain a copy.
在调用未知代码(侦听器就是这样的代码)时,谨慎的方式是在try - catch块中执行它,这样,行为有误的侦听器不会造成更多不必要的破坏。
When invoking unknown code (which listeners certainly qualify as), it is prudent to execute it in a try-catch block so that ill-behaved listeners do not do more damage than necessary.
应用推荐