Clone implementation rules of the PMD rule

Source: Internet
Author: User

· Propercloneimplementation:object Clone () should is implemented with Super.clone ().

Translate the appropriate cloning implementation: The object's Clone () method should contain the Super.clone () implementation

· Clonethrowsclonenotsupportedexception:the method Clone () should throw a clonenotsupportedexception.

Translation cloning method to throw unsupported clone exception: Clone () method should throw Clonenotsupportedexception

· Clonemethodmustimplementcloneable:the method Clone () should is implemented if the class implements the Cloneable int Erface with the exception of a final method of this only throws clonenotsupportedexception.

The translation cloning method must implement the Cloneable interface: If the class implements the Cloneable interface, the Clone () method should be implemented as a final method and throw only the clonenotsupportedexception exception

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.