Skip to content

[java] CloneMethodMustImplementCloneable triggers for interfaces #1005

@huxi

Description

@huxi

Affects PMD Version:
6.2.0

Rule:
category/java/errorprone.xml/CloneMethodMustImplementCloneable

Description:
The code below did not trigger this rule before PMD 6.2.0.

The clone() method is defined in the interface so the return value is of type Foo instead of Object.

Code Sample demonstrating the issue:

public interface Foo
    extends Serializable, Cloneable {
    Foo clone() throws CloneNotSupportedException;
}

Running PMD through: Gradle

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:false-positivePMD flags a piece of code that is not problematic

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions