mirror of
https://github.com/sjsdfg/effective-java-3rd-chinese.git
synced 2025-01-31 23:00:18 +08:00
update
This commit is contained in:
parent
85f40d293c
commit
0820b279f9
@ -80,7 +80,7 @@ p.end().setYear(78); // Modifies internals of p!
|
||||
|
||||
为了抵御第二次攻击,只需修改访问器以返回可变内部字属性的防御性拷贝:
|
||||
|
||||
```
|
||||
```Java
|
||||
// Repaired accessors - make defensive copies of internal fields
|
||||
public Date start() {
|
||||
return new Date(start.getTime());
|
||||
|
Loading…
Reference in New Issue
Block a user