diff --git a/idea/testData/inspections/redundantSamConstructor/inspectionData/expected.xml b/idea/testData/inspections/redundantSamConstructor/inspectionData/expected.xml index ab10dd15773..8483dbe4bd5 100644 --- a/idea/testData/inspections/redundantSamConstructor/inspectionData/expected.xml +++ b/idea/testData/inspections/redundantSamConstructor/inspectionData/expected.xml @@ -15,6 +15,17 @@ Redundant SAM-constructors Redundant SAM-constructor + + redundantSamConstructor.kt + 12 + light_idea_test_case + + Redundant SAM constructor + Redundant SAM-constructor + Runnable + 37 + 8 + redundantSamConstructor.kt 22 @@ -39,6 +50,17 @@ Redundant SAM-constructor Redundant SAM-constructor + + redundantSamConstructor.kt + 28 + light_idea_test_case + + Redundant SAM constructor + Redundant SAM-constructor + Runnable + 31 + 8 + redundantSamConstructor.kt 38 @@ -47,6 +69,17 @@ Redundant SAM-constructor Redundant SAM-constructor + + redundantSamConstructor.kt + 44 + light_idea_test_case + + Redundant SAM constructor + Redundant SAM-constructor + Runnable + 27 + 8 + redundantSamConstructorWithGenericsInReturnType.kt 9 @@ -63,6 +96,17 @@ Redundant SAM-constructors Redundant SAM-constructor + + redundantSamConstructorWithGenericsInReturnType.kt + 12 + light_idea_test_case + + Redundant SAM constructor + Redundant SAM-constructor + JFunction0 + 39 + 10 + redundantSamConstructorWithGenericsInReturnType.kt 15 @@ -87,6 +131,17 @@ Redundant SAM-constructor Redundant SAM-constructor + + redundantSamConstructorWithGenericsInReturnType.kt + 21 + light_idea_test_case + + Redundant SAM constructor + Redundant SAM-constructor + JFunction0 + 31 + 10 + redundantSamConstructorWithGenericsInReturnType.kt 24 @@ -173,4 +228,26 @@ Redundant SAM constructor Redundant SAM-constructor + + redundantSamConstructorWithGenerics.kt + 12 + light_idea_test_case + + Redundant SAM constructor + Redundant SAM-constructor + JFunction1<String> + 39 + 18 + + + redundantSamConstructorWithGenerics.kt + 21 + light_idea_test_case + + Redundant SAM constructor + Redundant SAM-constructor + JFunction1<String> + 31 + 18 + \ No newline at end of file diff --git a/idea/testData/inspections/redundantSamConstructor/inspectionData/redundantSamConstructor.kt.after b/idea/testData/inspections/redundantSamConstructor/inspectionData/redundantSamConstructor.kt.after index 027fdb5833e..a5284bd950f 100644 --- a/idea/testData/inspections/redundantSamConstructor/inspectionData/redundantSamConstructor.kt.after +++ b/idea/testData/inspections/redundantSamConstructor/inspectionData/redundantSamConstructor.kt.after @@ -9,7 +9,7 @@ fun test() { MyJavaClass.staticFun1({ }) MyJavaClass.staticFun1(runnable) MyJavaClass.staticFun2({ }, { }) - MyJavaClass.staticFun2(runnable, Runnable { }) + MyJavaClass.staticFun2(runnable, { }) MyJavaClass.staticFun2({ }, { }) MyJavaClass.staticFun2( object: Runnable { @@ -25,7 +25,7 @@ fun test() { klass.memberFun1({ }) klass.memberFun1(runnable) klass.memberFun2({ }, { }) - klass.memberFun2(runnable, Runnable { }) + klass.memberFun2(runnable, { }) klass.memberFun2({ }, { }) klass.memberFun2( object: Runnable { @@ -40,4 +40,9 @@ fun test() { MyJavaClass.staticFunWithOtherParam(1, { }) klass.memberFun1({ }) + + MyJavaClass.staticFun2({ }, Runnable { + if (p > 0) return@Runnable + print(1) + }) } \ No newline at end of file diff --git a/idea/testData/inspections/redundantSamConstructor/inspectionData/redundantSamConstructorWithGenerics.kt.after b/idea/testData/inspections/redundantSamConstructor/inspectionData/redundantSamConstructorWithGenerics.kt.after index e0bea2e7cad..870282550f2 100644 --- a/idea/testData/inspections/redundantSamConstructor/inspectionData/redundantSamConstructorWithGenerics.kt.after +++ b/idea/testData/inspections/redundantSamConstructor/inspectionData/redundantSamConstructorWithGenerics.kt.after @@ -9,7 +9,7 @@ fun testGenerics() { GenericClass1.staticFun1(JFunction1 { }) GenericClass1.staticFun1(runnable) GenericClass1.staticFun2(JFunction1 { }, JFunction1 { }) - GenericClass1.staticFun2(runnable, JFunction1 { }) + GenericClass1.staticFun2(runnable, { }) GenericClass1.staticFun2({ s: String -> }, { s: String -> }) GenericClass1.staticFunWithOtherParam(1, JFunction1 { }) @@ -18,7 +18,7 @@ fun testGenerics() { klass.memberFun1(JFunction1 { }) klass.memberFun1(runnable) klass.memberFun2(JFunction1 { }, JFunction1 { }) - klass.memberFun2(runnable, JFunction1 { }) + klass.memberFun2(runnable, { }) klass.memberFun2({ s: String -> }, { s: String -> }) klass.memberFunWithOtherParam(1, JFunction1 { }) diff --git a/idea/testData/inspections/redundantSamConstructor/inspectionData/redundantSamConstructorWithGenericsInReturnType.kt.after b/idea/testData/inspections/redundantSamConstructor/inspectionData/redundantSamConstructorWithGenericsInReturnType.kt.after index 9b66b7ece1b..febe0395955 100644 --- a/idea/testData/inspections/redundantSamConstructor/inspectionData/redundantSamConstructorWithGenericsInReturnType.kt.after +++ b/idea/testData/inspections/redundantSamConstructor/inspectionData/redundantSamConstructorWithGenericsInReturnType.kt.after @@ -9,7 +9,7 @@ fun testGenericsReturnType() { GenericClass2.staticFun1({ "" }) GenericClass2.staticFun1(runnable) GenericClass2.staticFun2({ "" }, { "" }) - GenericClass2.staticFun2(runnable, JFunction0 { "" }) + GenericClass2.staticFun2(runnable, { "" }) GenericClass2.staticFun2({ -> "" }, { -> "" }) GenericClass2.staticFunWithOtherParam(1, { "" }) @@ -18,7 +18,7 @@ fun testGenericsReturnType() { klass.memberFun1({ "" }) klass.memberFun1(runnable) klass.memberFun2({ "" }, { "" }) - klass.memberFun2(runnable, JFunction0 { "" }) + klass.memberFun2(runnable, { "" }) klass.memberFun2({ -> "" }, { -> "" }) klass.memberFunWithOtherParam(1, { "" }) diff --git a/idea/testData/inspections/redundantSamConstructor/nonApplicable.kt b/idea/testData/inspections/redundantSamConstructor/nonApplicable.kt index 1bfcc2e1d11..a86c6dcfbae 100644 --- a/idea/testData/inspections/redundantSamConstructor/nonApplicable.kt +++ b/idea/testData/inspections/redundantSamConstructor/nonApplicable.kt @@ -14,9 +14,4 @@ fun testNonApplicableAmbiguity(p: Int) { if (p > 0) return@Runnable print(1) }) - - MyJavaClass.staticFun2(Runnable { }, Runnable { - if (p > 0) return@Runnable - print(1) - }) } \ No newline at end of file diff --git a/idea/testData/inspections/redundantSamConstructor/redundantSamConstructor.kt b/idea/testData/inspections/redundantSamConstructor/redundantSamConstructor.kt index 76021c22302..171346887ca 100644 --- a/idea/testData/inspections/redundantSamConstructor/redundantSamConstructor.kt +++ b/idea/testData/inspections/redundantSamConstructor/redundantSamConstructor.kt @@ -40,4 +40,9 @@ fun test() { MyJavaClass.staticFunWithOtherParam(1, java.lang.Runnable { }) klass.memberFun1(java.lang.Runnable { }) + + MyJavaClass.staticFun2(Runnable { }, Runnable { + if (p > 0) return@Runnable + print(1) + }) } \ No newline at end of file diff --git a/idea/testData/intentions/objectLiteralToLambda/EmptyBody.kt.after b/idea/testData/intentions/objectLiteralToLambda/EmptyBody.kt.after index 54f2f7824cb..0baf6a06ea0 100644 --- a/idea/testData/intentions/objectLiteralToLambda/EmptyBody.kt.after +++ b/idea/testData/intentions/objectLiteralToLambda/EmptyBody.kt.after @@ -3,5 +3,5 @@ fun foo(runnable: Runnable) {} fun bar() { - foo(Runnable { }) + foo { } } \ No newline at end of file diff --git a/idea/testData/intentions/objectLiteralToLambda/ExpressionBody.kt.after b/idea/testData/intentions/objectLiteralToLambda/ExpressionBody.kt.after index 300c792cf39..44ddfe97f57 100644 --- a/idea/testData/intentions/objectLiteralToLambda/ExpressionBody.kt.after +++ b/idea/testData/intentions/objectLiteralToLambda/ExpressionBody.kt.after @@ -5,5 +5,5 @@ import java.io.FileFilter fun foo(filter: FileFilter) {} fun bar() { - foo(FileFilter { file -> file.name.startsWith("a") }) + foo { file -> file.name.startsWith("a") } } diff --git a/idea/testData/intentions/objectLiteralToLambda/MultipleParameters.kt.after b/idea/testData/intentions/objectLiteralToLambda/MultipleParameters.kt.after index 30d2ad498e3..3ea7572567d 100644 --- a/idea/testData/intentions/objectLiteralToLambda/MultipleParameters.kt.after +++ b/idea/testData/intentions/objectLiteralToLambda/MultipleParameters.kt.after @@ -5,5 +5,5 @@ import java.io.FilenameFilter fun foo(filter: FilenameFilter) {} fun bar() { - foo(FilenameFilter { file, name -> name == "x" }) + foo { file, name -> name == "x" } } diff --git a/idea/testData/intentions/objectLiteralToLambda/ParametersNotUsed.kt.after b/idea/testData/intentions/objectLiteralToLambda/ParametersNotUsed.kt.after index 9d977849bfc..35c598a9d20 100644 --- a/idea/testData/intentions/objectLiteralToLambda/ParametersNotUsed.kt.after +++ b/idea/testData/intentions/objectLiteralToLambda/ParametersNotUsed.kt.after @@ -5,5 +5,5 @@ import java.io.FileFilter fun foo(filter: FileFilter) {} fun bar() { - foo(FileFilter { true }) + foo { true } } diff --git a/idea/testData/intentions/objectLiteralToLambda/ParametersNotUsedMoreThanOne.kt.after b/idea/testData/intentions/objectLiteralToLambda/ParametersNotUsedMoreThanOne.kt.after index 1787b939ddf..aa8e0e09b73 100644 --- a/idea/testData/intentions/objectLiteralToLambda/ParametersNotUsedMoreThanOne.kt.after +++ b/idea/testData/intentions/objectLiteralToLambda/ParametersNotUsedMoreThanOne.kt.after @@ -5,5 +5,5 @@ import java.io.FilenameFilter fun foo(filter: FilenameFilter) {} fun bar() { - foo(FilenameFilter { file, name -> true }) + foo { file, name -> true } } diff --git a/idea/testData/intentions/objectLiteralToLambda/ReturnsInIf.kt b/idea/testData/intentions/objectLiteralToLambda/ReturnsInIf.kt index 077990016d1..ce17180faef 100644 --- a/idea/testData/intentions/objectLiteralToLambda/ReturnsInIf.kt +++ b/idea/testData/intentions/objectLiteralToLambda/ReturnsInIf.kt @@ -10,8 +10,7 @@ fun bar() { val name = file.name if (name.startsWith("a")) { return false - } - else { + } else { if (name.endsWith("b")) return true else { diff --git a/idea/testData/intentions/objectLiteralToLambda/ReturnsInIf.kt.after b/idea/testData/intentions/objectLiteralToLambda/ReturnsInIf.kt.after index d7670e97b87..38a20e70ed7 100644 --- a/idea/testData/intentions/objectLiteralToLambda/ReturnsInIf.kt.after +++ b/idea/testData/intentions/objectLiteralToLambda/ReturnsInIf.kt.after @@ -5,12 +5,11 @@ import java.io.FileFilter fun foo(filter: FileFilter) {} fun bar() { - foo(FileFilter { file -> + foo { file -> val name = file.name if (name.startsWith("a")) { false - } - else { + } else { if (name.endsWith("b")) true else { @@ -18,5 +17,5 @@ fun bar() { l > 10 } } - }) + } } diff --git a/idea/testData/intentions/objectLiteralToLambda/Simple.kt.after b/idea/testData/intentions/objectLiteralToLambda/Simple.kt.after index f0e4768b4d7..a937b9c01e3 100644 --- a/idea/testData/intentions/objectLiteralToLambda/Simple.kt.after +++ b/idea/testData/intentions/objectLiteralToLambda/Simple.kt.after @@ -3,5 +3,5 @@ fun foo(runnable: Runnable) {} fun bar() { - foo(Runnable { throw UnsupportedOperationException() }) + foo { throw UnsupportedOperationException() } } \ No newline at end of file diff --git a/idea/testData/intentions/objectLiteralToLambda/SingleReturn.kt.after b/idea/testData/intentions/objectLiteralToLambda/SingleReturn.kt.after index 300c792cf39..44ddfe97f57 100644 --- a/idea/testData/intentions/objectLiteralToLambda/SingleReturn.kt.after +++ b/idea/testData/intentions/objectLiteralToLambda/SingleReturn.kt.after @@ -5,5 +5,5 @@ import java.io.FileFilter fun foo(filter: FileFilter) {} fun bar() { - foo(FileFilter { file -> file.name.startsWith("a") }) + foo { file -> file.name.startsWith("a") } } diff --git a/idea/testData/intentions/objectLiteralToLambda/StatementAndReturn.kt.after b/idea/testData/intentions/objectLiteralToLambda/StatementAndReturn.kt.after index 612cdb4b03d..272544d5417 100644 --- a/idea/testData/intentions/objectLiteralToLambda/StatementAndReturn.kt.after +++ b/idea/testData/intentions/objectLiteralToLambda/StatementAndReturn.kt.after @@ -5,8 +5,8 @@ import java.io.FileFilter fun foo(filter: FileFilter) {} fun bar() { - foo(FileFilter { file -> + foo { file -> val name = file.name name.startsWith("a") - }) + } } diff --git a/idea/testData/intentions/objectLiteralToLambda/ThisReference.kt.after b/idea/testData/intentions/objectLiteralToLambda/ThisReference.kt.after index 39bea5de510..9b498596314 100644 --- a/idea/testData/intentions/objectLiteralToLambda/ThisReference.kt.after +++ b/idea/testData/intentions/objectLiteralToLambda/ThisReference.kt.after @@ -9,7 +9,7 @@ class Test { }) // Applicable - bar(Runnable { println(this@Test) }) + bar { println(this@Test) } // Applicable bar(object : Runnable { diff --git a/nj2k/testData/newJ2k/function/externalFunctionalInterface.kt b/nj2k/testData/newJ2k/function/externalFunctionalInterface.kt index 60ce95f8e1a..b81a4ca26a4 100644 --- a/nj2k/testData/newJ2k/function/externalFunctionalInterface.kt +++ b/nj2k/testData/newJ2k/function/externalFunctionalInterface.kt @@ -8,6 +8,6 @@ internal class Test { } fun nya(): Double { - return foo(1, FunctionalI { x: Int -> this.toDouble(x) }) + return foo(1, { x: Int -> this.toDouble(x) }) } } \ No newline at end of file diff --git a/nj2k/testData/newJ2k/objectLiteral/kt-36149.kt b/nj2k/testData/newJ2k/objectLiteral/kt-36149.kt index 4d6565d129b..187578cc529 100644 --- a/nj2k/testData/newJ2k/objectLiteral/kt-36149.kt +++ b/nj2k/testData/newJ2k/objectLiteral/kt-36149.kt @@ -9,13 +9,13 @@ class Foo { private val activity: Activity? = null fun foo() { synchronized(this) { - activity!!.runOnUiThread(Runnable { }) + activity!!.runOnUiThread { } } } fun bar() { synchronized(this) { - activity!!.runOnUiThread(Runnable { }) + activity!!.runOnUiThread { } } } }