mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
"'clone()' instantiates objects with constructor" should warn on non-Cloneable class
This commit is contained in:
+1
-1
@@ -53,7 +53,7 @@ public class CloneCallsConstructorsInspection extends BaseInspection {
|
||||
return;
|
||||
}
|
||||
final PsiClass aClass = method.getContainingClass();
|
||||
if (aClass == null || aClass.hasModifierProperty(PsiModifier.FINAL) || !CloneUtils.isCloneable(aClass)) {
|
||||
if (aClass == null || aClass.hasModifierProperty(PsiModifier.FINAL)) {
|
||||
return;
|
||||
}
|
||||
method.accept(new JavaRecursiveElementVisitor() {
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ class CloneCallsConstructors implements Cloneable {
|
||||
class One {
|
||||
@Override
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
return new One();
|
||||
return new <warning descr="'clone()' creates new 'One' instances">One</warning>();
|
||||
}
|
||||
}
|
||||
final class Two implements Cloneable {
|
||||
|
||||
Reference in New Issue
Block a user