In Java 8 and prior, applications could call the clone method on java.lang.ref.Reference
or any of its known subclasses:java.lang.ref.PhantomReference,
java.lang.ref.SoftReference, and java.lang.ref.WeakReference.
However, in Java 11, the java.lang.ref.Reference.clone() method has been overriden
to always throw a CloneNotSupportedException. Applications that call the
clone method should replace the clone call with a constructor call passing in the referent and reference queue
as parameters.
This rule flags potential clone calls that might cause a CloneNotSupportedException
to be thrown. Review your application and replace any clone calls that may resolve
to a java.lang.ref.Reference.clone()
or any of its known subclasses: java.lang.ref.PhantomReference,
java.lang.ref.SoftReference, and java.lang.ref.WeakReference.
The rule has an automated fix that replaces any clone calls that may resolve to a java.lang.ref.Reference.clone() or
any of its known subclasses: java.lang.ref.PhantomReference, java.lang.ref.SoftReference, and java.lang.ref.WeakReference
with a constructor call passing in the referent and reference queue as parameters.
Copy the custom configuration to your application build file to enable the fix automation.
For more information on the Java 11 change, see Java 11 Release Notes. For more information on the java.lang.ref.Reference class, see the Java class documentation.