Merge remote-tracking branch 'origin/master'

This commit is contained in:
Dmitry Trofimov
2013-11-28 16:05:56 +01:00
5 changed files with 20 additions and 13 deletions
@@ -1503,7 +1503,7 @@
enabledByDefault="false" level="WARNING" implementationClass="com.siyeh.ig.maturity.ThreadDumpStackInspection"/>
<localInspection language="JAVA" shortName="ThrowablePrintedToSystemOut" bundle="com.siyeh.InspectionGadgetsBundle"
key="throwable.printed.to.system.out.display.name" groupBundle="messages.InspectionsBundle"
groupKey="group.names.code.maturity.issues" enabledByDefault="false" level="WARNING"
groupKey="group.names.code.maturity.issues" enabledByDefault="true" level="WARNING"
implementationClass="com.siyeh.ig.maturity.ThrowablePrintedToSystemOutInspection"/>
<localInspection language="JAVA" suppressId="UseOfObsoleteCollectionType" shortName="ObsoleteCollection" bundle="com.siyeh.InspectionGadgetsBundle"
key="use.obsolete.collection.type.display.name" groupBundle="messages.InspectionsBundle"
@@ -45,7 +45,7 @@ public class BadExceptionDeclaredInspectionBase extends BaseInspection {
);
@SuppressWarnings("PublicField")
public boolean ignoreTestCases = false;
public boolean ignoreTestCases = false; // keep for compatibility
@SuppressWarnings("PublicField")
public boolean ignoreLibraryOverrides = false;
@@ -109,7 +109,7 @@ public class BadExceptionDeclaredInspectionBase extends BaseInspection {
final PsiClass thrownClass = (PsiClass)element;
final String qualifiedName = thrownClass.getQualifiedName();
if (qualifiedName != null && exceptions.contains(qualifiedName)) {
registerError(reference);
registerError(reference, reference);
}
}
}
@@ -43,6 +43,11 @@ public class ThrowablePrintedToSystemOutInspection extends BaseInspection {
return InspectionGadgetsBundle.message("throwable.printed.to.system.out.problem.descriptor", fieldName, methodName);
}
@Override
public boolean isEnabledByDefault() {
return true;
}
@Override
public BaseInspectionVisitor buildVisitor() {
return new ThrowablePrintedToSystemOutVisitor();
@@ -17,8 +17,11 @@ package com.siyeh.ig.errorhandling;
import com.intellij.codeInspection.ui.ListTable;
import com.intellij.codeInspection.ui.ListWrappingTableModel;
import com.intellij.psi.PsiElement;
import com.intellij.util.ui.CheckBox;
import com.siyeh.InspectionGadgetsBundle;
import com.siyeh.ig.InspectionGadgetsFix;
import com.siyeh.ig.fixes.SuppressForTestsScopeFix;
import com.siyeh.ig.ui.UiUtils;
import javax.swing.*;
@@ -26,6 +29,12 @@ import java.awt.*;
public class BadExceptionDeclaredInspection extends BadExceptionDeclaredInspectionBase {
@Override
protected InspectionGadgetsFix buildFix(Object... infos) {
final PsiElement context = (PsiElement)infos[0];
return SuppressForTestsScopeFix.build(this, context);
}
@Override
public JComponent createOptionsPanel() {
final JComponent panel = new JPanel(new GridBagLayout());
@@ -41,17 +50,12 @@ public class BadExceptionDeclaredInspection extends BadExceptionDeclaredInspecti
constraints.fill = GridBagConstraints.BOTH;
panel.add(tablePanel, constraints);
final CheckBox checkBox1 =
new CheckBox(InspectionGadgetsBundle.message("ignore.exceptions.declared.in.tests.option"), this,
"ignoreTestCases");
constraints.gridy = 1;
constraints.weighty = 0.0;
panel.add(checkBox1, constraints);
final CheckBox checkBox2 =
new CheckBox(InspectionGadgetsBundle.message("ignore.exceptions.declared.on.library.override.option"), this,
"ignoreLibraryOverrides");
constraints.gridy = 2;
constraints.weighty = 0.0;
constraints.gridy = 1;
panel.add(checkBox2, constraints);
return panel;
}
@@ -6,9 +6,7 @@ Reports inappropriate exceptions declared by methods. One use of this inspection
<p>
Use the list below to specify which exceptions should be flagged by this inspection.
<p>
Use the first checkbox below to ignore exceptions declared on test methods.
<p>
Use the second checkbox below to ignore exceptions declared on methods which override a library method.
Use the checkbox below to ignore exceptions declared on methods which override a library method.
<p>
</body>