New J2K: add ReplaceGuardClause inspection to post-processing
#KT-22412 Fixed
This commit is contained in:
committed by
Ilya Kirillov
parent
51e007116f
commit
154cf46f7c
@@ -221,7 +221,8 @@ private val inspectionLikePostProcessingGroup =
|
||||
intentionBasedProcessing(RemoveEmptyPrimaryConstructorIntention()),
|
||||
generalInspectionBasedProcessing(MayBeConstantInspection()),
|
||||
RemoveForExpressionLoopParameterTypeProcessing(),
|
||||
intentionBasedProcessing(ReplaceMapGetOrDefaultIntention())
|
||||
intentionBasedProcessing(ReplaceMapGetOrDefaultIntention()),
|
||||
inspectionBasedProcessing(ReplaceGuardClauseWithFunctionCallInspection())
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
public class Test {
|
||||
void test(String s) {
|
||||
if (s == null) {
|
||||
throw new IllegalArgumentException("s should not be null");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class Test {
|
||||
internal fun test(s: String?) {
|
||||
requireNotNull(s) { "s should not be null" }
|
||||
}
|
||||
}
|
||||
+5
@@ -4082,6 +4082,11 @@ public class NewJavaToKotlinConverterSingleFileTestGenerated extends AbstractNew
|
||||
runTest("nj2k/testData/newJ2k/postProcessing/GetOperator.java");
|
||||
}
|
||||
|
||||
@TestMetadata("GuardClause.java")
|
||||
public void testGuardClause() throws Exception {
|
||||
runTest("nj2k/testData/newJ2k/postProcessing/GuardClause.java");
|
||||
}
|
||||
|
||||
@TestMetadata("IfNullReturnToElvis.java")
|
||||
public void testIfNullReturnToElvis() throws Exception {
|
||||
runTest("nj2k/testData/newJ2k/postProcessing/IfNullReturnToElvis.java");
|
||||
|
||||
Reference in New Issue
Block a user