#ref() method not 'public' #loc
only.warn.on.public.clone.methods=Only warn on 'public' clone methods
+only.warn.on.protected.clone.methods=Only warn on 'protected' clone methods
clone.returns.class.type.display.name='clone()' should have return type equal to the class it contains
clone.returns.class.type.problem.descriptor=''clone()'' should have return type ''{0}'' #loc
-clone.returns.class.type.quickfix=Change return type to '{0}'
+clone.returns.class.type.quickfix=Change return type to ''{0}''
clone.returns.class.type.family.quickfix=Change return type to class type
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/abstraction/TypeMayBeWeakenedInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/abstraction/TypeMayBeWeakenedInspection.java
index 2787f34e4dcf..ec2778f79c5b 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/abstraction/TypeMayBeWeakenedInspection.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/abstraction/TypeMayBeWeakenedInspection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2014 Bas Leijdekkers
+ * Copyright 2006-2015 Bas Leijdekkers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package com.siyeh.ig.abstraction;
import com.intellij.codeInsight.daemon.impl.analysis.JavaHighlightUtil;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.codeInspection.ui.MultipleCheckboxOptionsPanel;
+import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
@@ -294,7 +295,7 @@ public class TypeMayBeWeakenedInspection extends BaseInspection {
@Override
public void visitMethod(PsiMethod method) {
super.visitMethod(method);
- if (isOnTheFly() && !method.hasModifierProperty(PsiModifier.PRIVATE)) {
+ if (isOnTheFly() && !method.hasModifierProperty(PsiModifier.PRIVATE) && !ApplicationManager.getApplication().isUnitTestMode()) {
// checking methods with greater visibility is too expensive.
// for error checking in the editor
return;
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/cloneable/CloneDeclaresCloneNotSupportedInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/cloneable/CloneDeclaresCloneNotSupportedInspection.java
index 3f605269bff4..b91bec416a28 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/cloneable/CloneDeclaresCloneNotSupportedInspection.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/cloneable/CloneDeclaresCloneNotSupportedInspection.java
@@ -39,7 +39,7 @@ import javax.swing.*;
public class CloneDeclaresCloneNotSupportedInspection extends BaseInspection {
- private boolean onlyWarnOnPublicClone = true;
+ private boolean onlyWarnOnProtectedClone = true;
@Override
@NotNull
@@ -67,16 +67,16 @@ public class CloneDeclaresCloneNotSupportedInspection extends BaseInspection {
@Nullable
@Override
public JComponent createOptionsPanel() {
- return new SingleCheckboxOptionsPanel(InspectionGadgetsBundle.message("only.warn.on.public.clone.methods"),
- this, "onlyWarnOnPublicClone");
+ return new SingleCheckboxOptionsPanel(InspectionGadgetsBundle.message("only.warn.on.protected.clone.methods"),
+ this, "onlyWarnOnProtectedClone");
}
@Override
public void readSettings(@NotNull Element node) throws InvalidDataException {
super.readSettings(node);
for (Element option : node.getChildren("option")) {
- if ("onlyWarnOnPublicClone".equals(option.getAttributeValue("name"))) {
- onlyWarnOnPublicClone = Boolean.parseBoolean(option.getAttributeValue("value"));
+ if ("onlyWarnOnProtectedClone".equals(option.getAttributeValue("name"))) {
+ onlyWarnOnProtectedClone = Boolean.parseBoolean(option.getAttributeValue("value"));
}
}
}
@@ -84,9 +84,9 @@ public class CloneDeclaresCloneNotSupportedInspection extends BaseInspection {
@Override
public void writeSettings(@NotNull Element node) throws WriteExternalException {
super.writeSettings(node);
- if (!onlyWarnOnPublicClone) {
- node.addContent(new Element("option").setAttribute("name", "onlyWarnOnPublicClone")
- .setAttribute("value", String.valueOf(onlyWarnOnPublicClone)));
+ if (!onlyWarnOnProtectedClone) {
+ node.addContent(new Element("option").setAttribute("name", "onlyWarnOnProtectedClone")
+ .setAttribute("value", String.valueOf(onlyWarnOnProtectedClone)));
}
}
@@ -131,7 +131,7 @@ public class CloneDeclaresCloneNotSupportedInspection extends BaseInspection {
if (method.hasModifierProperty(PsiModifier.FINAL)) {
return;
}
- if (onlyWarnOnPublicClone && !method.hasModifierProperty(PsiModifier.PUBLIC)) {
+ if (onlyWarnOnProtectedClone && method.hasModifierProperty(PsiModifier.PUBLIC)) {
return;
}
final PsiClass containingClass = method.getContainingClass();
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dependency/CyclicClassDependencyInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dependency/CyclicClassDependencyInspection.java
index cb512f97ecbd..b501653d6dc1 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dependency/CyclicClassDependencyInspection.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dependency/CyclicClassDependencyInspection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2013 Dave Griffith, Bas Leijdekkers
+ * Copyright 2006-2015 Dave Griffith, Bas Leijdekkers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,7 +52,7 @@ public class CyclicClassDependencyInspection extends BaseGlobalInspection {
}
final RefClass refClass = (RefClass)refEntity;
final PsiClass aClass = refClass.getElement();
- if (aClass == null || aClass.getContainingClass() != null) {
+ if (aClass == null || aClass.getContainingClass() != null || aClass instanceof PsiAnonymousClass) {
return null;
}
final Set-Use the checkbox below to indicate if this inspection should only warn on public methods. +Use the checkbox below to indicate if this inspection should only warn on protected methods. In Effective Java, Second Edition (but not in the first edition) it is recommended to omit the CloneNotSupportedException -declaration, because methods that don't throw checked exceptions are easier to use. +declaration on public methods, because methods that don't throw checked exceptions are easier to use.