mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IG: fix inspection option
This commit is contained in:
+1
-1
@@ -294,7 +294,7 @@ public class ImplicitNumericConversionInspection extends BaseInspection {
|
||||
if (expressionType.equals(expectedType)) {
|
||||
return;
|
||||
}
|
||||
if (ignoreWideningConversions && TypeUtils.isNarrowingConversion(expressionType, expectedType)) {
|
||||
if (ignoreWideningConversions && !TypeUtils.isNarrowingConversion(expressionType, expectedType)) {
|
||||
return;
|
||||
}
|
||||
if (ignoreCharConversions && PsiType.CHAR.equals(expectedType)) {
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class IgnoreCharConversion {
|
||||
|
||||
void m(int i) {
|
||||
final char a = 'a';
|
||||
i = a;
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class IgnoreWidening {
|
||||
void m(int i) {
|
||||
long l = i;
|
||||
byte b = 2;
|
||||
}
|
||||
}
|
||||
+16
-1
@@ -6,7 +6,22 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class ImplicitNumericConversionInspectionTest extends LightInspectionTestCase {
|
||||
|
||||
public void testImplicitNumericConversion() throws Exception {
|
||||
public void testImplicitNumericConversion() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testIgnoreCharConversion() {
|
||||
final ImplicitNumericConversionInspection inspection = new ImplicitNumericConversionInspection();
|
||||
inspection.ignoreCharConversions = true;
|
||||
myFixture.enableInspections(inspection);
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testIgnoreWidening() {
|
||||
final ImplicitNumericConversionInspection inspection = new ImplicitNumericConversionInspection();
|
||||
inspection.ignoreWideningConversions = true;
|
||||
inspection.ignoreConstantConversions = true;
|
||||
myFixture.enableInspections(inspection);
|
||||
doTest();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user