Use intention to simplify for in j2k
#KT-7157 Fixed
This commit is contained in:
@@ -65,6 +65,7 @@ object J2KPostProcessingRegistrar {
|
|||||||
registerIntentionBasedProcessing(ObjectLiteralToLambdaIntention()) { applyTo(it) }
|
registerIntentionBasedProcessing(ObjectLiteralToLambdaIntention()) { applyTo(it) }
|
||||||
registerIntentionBasedProcessing(AnonymousFunctionToLambdaIntention()) { applyTo(it) }
|
registerIntentionBasedProcessing(AnonymousFunctionToLambdaIntention()) { applyTo(it) }
|
||||||
registerIntentionBasedProcessing(RemoveUnnecessaryParenthesesIntention()) { applyTo(it) }
|
registerIntentionBasedProcessing(RemoveUnnecessaryParenthesesIntention()) { applyTo(it) }
|
||||||
|
registerIntentionBasedProcessing(SimplifyForIntention()) { applyTo(it) }
|
||||||
|
|
||||||
registerDiagnosticBasedProcessing<KtBinaryExpressionWithTypeRHS>(Errors.USELESS_CAST) { element, diagnostic ->
|
registerDiagnosticBasedProcessing<KtBinaryExpressionWithTypeRHS>(Errors.USELESS_CAST) { element, diagnostic ->
|
||||||
val expression = RemoveUselessCastFix.invoke(element)
|
val expression = RemoveUselessCastFix.invoke(element)
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
class Test {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Map<String, String> resultMap = new HashMap<String, String>();
|
||||||
|
for (final Map.Entry<String, String> entry : resultMap.entrySet()) {
|
||||||
|
String key = entry.getKey();
|
||||||
|
String type = entry.getValue();
|
||||||
|
|
||||||
|
if (key.equals("myKey")) {
|
||||||
|
System.out.println(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import java.util.HashMap
|
||||||
|
|
||||||
|
internal object Test {
|
||||||
|
@JvmStatic fun main(args: Array<String>) {
|
||||||
|
val resultMap = HashMap<String, String>()
|
||||||
|
for ((key, type) in resultMap) {
|
||||||
|
|
||||||
|
if (key == "myKey") {
|
||||||
|
println(type)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2080,6 +2080,12 @@ public class JavaToKotlinConverterForWebDemoTestGenerated extends AbstractJavaTo
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("overMapEntries.java")
|
||||||
|
public void testOverMapEntries() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("j2k/testData/fileOrElement/for/overMapEntries.java");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("withContinue1.java")
|
@TestMetadata("withContinue1.java")
|
||||||
public void testWithContinue1() throws Exception {
|
public void testWithContinue1() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("j2k/testData/fileOrElement/for/withContinue1.java");
|
String fileName = KotlinTestUtils.navigationMetadata("j2k/testData/fileOrElement/for/withContinue1.java");
|
||||||
|
|||||||
@@ -2080,6 +2080,12 @@ public class JavaToKotlinConverterSingleFileTestGenerated extends AbstractJavaTo
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("overMapEntries.java")
|
||||||
|
public void testOverMapEntries() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("j2k/testData/fileOrElement/for/overMapEntries.java");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("withContinue1.java")
|
@TestMetadata("withContinue1.java")
|
||||||
public void testWithContinue1() throws Exception {
|
public void testWithContinue1() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("j2k/testData/fileOrElement/for/withContinue1.java");
|
String fileName = KotlinTestUtils.navigationMetadata("j2k/testData/fileOrElement/for/withContinue1.java");
|
||||||
|
|||||||
Reference in New Issue
Block a user