Add "Redundant nullable return type" inspection
^KT-19321 Fixed
This commit is contained in:
committed by
Vladimir Dolzhenko
parent
d703284d01
commit
8420c0b7c7
+94
@@ -8218,6 +8218,100 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/inspectionsLocal/redundantNullableReturnType")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class RedundantNullableReturnType extends AbstractLocalInspectionTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInRedundantNullableReturnType() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/inspectionsLocal/redundantNullableReturnType"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/inspectionsLocal/redundantNullableReturnType/function")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Function extends AbstractLocalInspectionTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInFunction() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/inspectionsLocal/redundantNullableReturnType/function"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("blockBody.kt")
|
||||
public void testBlockBody() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/redundantNullableReturnType/function/blockBody.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("blockBodyReturnsNullable.kt")
|
||||
public void testBlockBodyReturnsNullable() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/redundantNullableReturnType/function/blockBodyReturnsNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("blockBodyWithSmartCast.kt")
|
||||
public void testBlockBodyWithSmartCast() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/redundantNullableReturnType/function/blockBodyWithSmartCast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("notNullableReturnType.kt")
|
||||
public void testNotNullableReturnType() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/redundantNullableReturnType/function/notNullableReturnType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overridable.kt")
|
||||
public void testOverridable() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/redundantNullableReturnType/function/overridable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("singleExpressionBody.kt")
|
||||
public void testSingleExpressionBody() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/redundantNullableReturnType/function/singleExpressionBody.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("singleExpressionBodyReturnsNullable.kt")
|
||||
public void testSingleExpressionBodyReturnsNullable() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/redundantNullableReturnType/function/singleExpressionBodyReturnsNullable.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/inspectionsLocal/redundantNullableReturnType/property")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Property extends AbstractLocalInspectionTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInProperty() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/inspectionsLocal/redundantNullableReturnType/property"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("getter.kt")
|
||||
public void testGetter() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/redundantNullableReturnType/property/getter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("getterWithBody.kt")
|
||||
public void testGetterWithBody() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/redundantNullableReturnType/property/getterWithBody.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("initializer.kt")
|
||||
public void testInitializer() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/redundantNullableReturnType/property/initializer.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("var.kt")
|
||||
public void testVar() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/redundantNullableReturnType/property/var.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/inspectionsLocal/redundantObjectTypeCheck")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user