PMD規則之Clone Implementation Rules

·  ProperCloneImplementation: Object clone() should be implemented with super.clone().

翻譯  適當的克隆實現:對象的clone()方法中應該包含super.clone()實現

·  CloneThrowsCloneNotSupportedException: The method clone() should throw a CloneNotSupportedException.

翻譯  克隆方法要拋出不支持克隆異常:clone()方法應該拋出CloneNotSupportedException

·  CloneMethodMustImplementCloneable: The method clone() should only be implemented if the class implements the Cloneable interface with the exception of a final method that only throws CloneNotSupportedException.

翻譯  克隆方法必須實現Cloneable接口:如果類實現Cloneable接口,clone()方法應該被實現爲一個final的方法並且只拋出CloneNotSupportedException的異常

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章