Files
codeql/java/ql/src/Advisory/Java Objects/AvoidCloneableInterface.ql
2018-08-30 10:48:05 +01:00

18 lines
524 B
Plaintext

/**
* @name Use of Cloneable interface
* @description Using the 'Cloneable' interface is bad practice. Copying an object using the
* 'Cloneable interface' and 'Object.clone' is error-prone.
* @kind problem
* @problem.severity recommendation
* @precision medium
* @id java/use-of-cloneable-interface
* @tags reliability
*/
import java
from RefType t
where
t.fromSource() and
t.getASupertype() instanceof TypeCloneable
select t, "This type implements or extends Cloneable, which should be avoided."