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的异常

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