From 7d662bf5d1405aa69983972db55f2c306aca7f1e Mon Sep 17 00:00:00 2001 From: Roman Golyshev Date: Thu, 4 Jun 2020 18:12:02 +0300 Subject: [PATCH] Change testData for `IntentionsTestGenerated` to avoid using `javax` and `sql` packages - Those packages are missing in the mockJdk 1.8 in intellij repository, and it leads to those tests failing in kotlin-ide repository --- .../implicitlyNonUnitFun.kt | 2 +- .../implicitlyNonUnitFun.kt.after | 6 ++---- .../importAllMembers/AlreadyImported.kt | 16 +++++++------- .../importAllMembers/AlreadyImported.kt.after | 16 +++++++------- .../AlreadyImportedWithStar.kt | 16 +++++++------- .../AlreadyImportedWithStar.kt.after | 16 +++++++------- .../importAllMembers/AmbiguousCalls.1.java | 6 ++++++ .../AmbiguousCalls.1.java.after | 6 ++++++ .../importAllMembers/AmbiguousCalls.kt | 16 +++++++------- .../importAllMembers/AmbiguousCalls.kt.after | 19 ++++++++--------- .../ImportAllMembersInImport.kt | 2 +- .../importAllMembers/QualifiedName.kt | 4 ++-- .../importAllMembers/QualifiedName.kt.after | 6 +++--- .../importAllMembers/QualifiedName2.kt | 4 ++-- .../importAllMembers/QualifiedName2.kt.after | 6 +++--- .../importAllMembers/RemoveSingleImports.kt | 16 +++++++------- .../RemoveSingleImports.kt.after | 16 +++++++------- .../importAllMembers/StaticJavaMembers.kt | 16 +++++++------- .../StaticJavaMembers.kt.after | 18 +++++++--------- .../importAllMembers/UnresolvedMember.kt | 4 ++-- .../importMember/ImportMemberInImport.kt | 2 +- .../ImportMemberInMiddleOfImport.kt | 2 +- .../intentions/importMember/NoTarget.kt | 7 +++---- .../importMember/NotForQualifier.kt | 5 ++--- .../importMember/StaticJavaField.kt | 8 +++---- .../importMember/StaticJavaField.kt.after | 10 ++++----- .../importMember/StaticJavaMethod.kt | 19 +++++++---------- .../importMember/StaticJavaMethod.kt.after | 21 ++++++++----------- .../NoSamAdapterNeeded.kt | 4 +--- .../NoSamAdapterNeeded.kt.after | 4 +--- .../SamAdapterNeededBecauseOfLabeledReturn.kt | 4 +--- ...apterNeededBecauseOfLabeledReturn.kt.after | 4 +--- .../inspectionData/expected.xml | 2 +- .../classNameClashing.kt | 6 +++++- .../classNameClashing.kt.after | 8 +++++-- .../suppressedByNotPropertyList.kt | 6 +++--- 36 files changed, 153 insertions(+), 170 deletions(-) create mode 100644 idea/testData/intentions/importAllMembers/AmbiguousCalls.1.java create mode 100644 idea/testData/intentions/importAllMembers/AmbiguousCalls.1.java.after diff --git a/idea/testData/intentions/convertToBlockBody/implicitlyNonUnitFun.kt b/idea/testData/intentions/convertToBlockBody/implicitlyNonUnitFun.kt index 2c4d1012850..e093c31aeba 100644 --- a/idea/testData/intentions/convertToBlockBody/implicitlyNonUnitFun.kt +++ b/idea/testData/intentions/convertToBlockBody/implicitlyNonUnitFun.kt @@ -1,3 +1,3 @@ // WITH_RUNTIME -fun foo() = java.io.File("x").toURI() \ No newline at end of file +fun foo() = java.io.File("x").getAbsolutePath() \ No newline at end of file diff --git a/idea/testData/intentions/convertToBlockBody/implicitlyNonUnitFun.kt.after b/idea/testData/intentions/convertToBlockBody/implicitlyNonUnitFun.kt.after index fc8def07ce9..45804f77514 100644 --- a/idea/testData/intentions/convertToBlockBody/implicitlyNonUnitFun.kt.after +++ b/idea/testData/intentions/convertToBlockBody/implicitlyNonUnitFun.kt.after @@ -1,7 +1,5 @@ -import java.net.URI - // WITH_RUNTIME -fun foo(): URI? { - return java.io.File("x").toURI() +fun foo(): String? { + return java.io.File("x").getAbsolutePath() } \ No newline at end of file diff --git a/idea/testData/intentions/importAllMembers/AlreadyImported.kt b/idea/testData/intentions/importAllMembers/AlreadyImported.kt index cc4e80f201d..535c09792bd 100644 --- a/idea/testData/intentions/importAllMembers/AlreadyImported.kt +++ b/idea/testData/intentions/importAllMembers/AlreadyImported.kt @@ -1,17 +1,15 @@ -// INTENTION_TEXT: "Import members from 'javax.swing.SwingUtilities'" +// INTENTION_TEXT: "Import members from 'java.util.regex.Pattern'" // WITH_RUNTIME -import javax.swing.SwingUtilities -import javax.swing.SwingUtilities.invokeLater +import java.util.regex.Pattern +import java.util.regex.Pattern.matches fun foo() { - SwingUtilities.invokeLater { } + Pattern.matches("", "") - val bottom = SwingUtilities.BOTTOM + val field = Pattern.CASE_INSENSITIVE - SwingUtilities.invokeAndWait { - SwingUtilities.invokeLater { } - } + Pattern.compile("") - val horizontal = javax.swing.SwingUtilities.HORIZONTAL + val fieldFqn = java.util.regex.Pattern.CASE_INSENSITIVE } diff --git a/idea/testData/intentions/importAllMembers/AlreadyImported.kt.after b/idea/testData/intentions/importAllMembers/AlreadyImported.kt.after index 4c0d0c50194..77c411ea79d 100644 --- a/idea/testData/intentions/importAllMembers/AlreadyImported.kt.after +++ b/idea/testData/intentions/importAllMembers/AlreadyImported.kt.after @@ -1,17 +1,15 @@ -// INTENTION_TEXT: "Import members from 'javax.swing.SwingUtilities'" +// INTENTION_TEXT: "Import members from 'java.util.regex.Pattern'" // WITH_RUNTIME -import javax.swing.SwingUtilities -import javax.swing.SwingUtilities.* +import java.util.regex.Pattern +import java.util.regex.Pattern.* fun foo() { - invokeLater { } + matches("", "") - val bottom = BOTTOM + val field = CASE_INSENSITIVE - invokeAndWait { - invokeLater { } - } + compile("") - val horizontal = HORIZONTAL + val fieldFqn = CASE_INSENSITIVE } diff --git a/idea/testData/intentions/importAllMembers/AlreadyImportedWithStar.kt b/idea/testData/intentions/importAllMembers/AlreadyImportedWithStar.kt index 5eb10651070..0d3df0b6aff 100644 --- a/idea/testData/intentions/importAllMembers/AlreadyImportedWithStar.kt +++ b/idea/testData/intentions/importAllMembers/AlreadyImportedWithStar.kt @@ -1,17 +1,15 @@ -// INTENTION_TEXT: "Import members from 'javax.swing.SwingUtilities'" +// INTENTION_TEXT: "Import members from 'java.util.regex.Pattern'" // WITH_RUNTIME -import javax.swing.SwingUtilities -import javax.swing.SwingUtilities.* +import java.util.regex.Pattern +import java.util.regex.Pattern.* fun foo() { - SwingUtilities.invokeLater { } + Pattern.matches("", "") - val bottom = SwingUtilities.BOTTOM + val field = Pattern.CASE_INSENSITIVE - SwingUtilities.invokeAndWait { - SwingUtilities.invokeLater { } - } + Pattern.compile("") - val horizontal = javax.swing.SwingUtilities.HORIZONTAL + val fieldFqn = java.util.regex.Pattern.CASE_INSENSITIVE } diff --git a/idea/testData/intentions/importAllMembers/AlreadyImportedWithStar.kt.after b/idea/testData/intentions/importAllMembers/AlreadyImportedWithStar.kt.after index 4c0d0c50194..77c411ea79d 100644 --- a/idea/testData/intentions/importAllMembers/AlreadyImportedWithStar.kt.after +++ b/idea/testData/intentions/importAllMembers/AlreadyImportedWithStar.kt.after @@ -1,17 +1,15 @@ -// INTENTION_TEXT: "Import members from 'javax.swing.SwingUtilities'" +// INTENTION_TEXT: "Import members from 'java.util.regex.Pattern'" // WITH_RUNTIME -import javax.swing.SwingUtilities -import javax.swing.SwingUtilities.* +import java.util.regex.Pattern +import java.util.regex.Pattern.* fun foo() { - invokeLater { } + matches("", "") - val bottom = BOTTOM + val field = CASE_INSENSITIVE - invokeAndWait { - invokeLater { } - } + compile("") - val horizontal = HORIZONTAL + val fieldFqn = CASE_INSENSITIVE } diff --git a/idea/testData/intentions/importAllMembers/AmbiguousCalls.1.java b/idea/testData/intentions/importAllMembers/AmbiguousCalls.1.java new file mode 100644 index 00000000000..1a457030b3b --- /dev/null +++ b/idea/testData/intentions/importAllMembers/AmbiguousCalls.1.java @@ -0,0 +1,6 @@ +public class JavaUtilClass { + public static int STATIC_FIELD = 10; + + public static void overloadedMethod(int i) {} + public static void overloadedMethod(String i) {} +} diff --git a/idea/testData/intentions/importAllMembers/AmbiguousCalls.1.java.after b/idea/testData/intentions/importAllMembers/AmbiguousCalls.1.java.after new file mode 100644 index 00000000000..1a457030b3b --- /dev/null +++ b/idea/testData/intentions/importAllMembers/AmbiguousCalls.1.java.after @@ -0,0 +1,6 @@ +public class JavaUtilClass { + public static int STATIC_FIELD = 10; + + public static void overloadedMethod(int i) {} + public static void overloadedMethod(String i) {} +} diff --git a/idea/testData/intentions/importAllMembers/AmbiguousCalls.kt b/idea/testData/intentions/importAllMembers/AmbiguousCalls.kt index a5c3d49a805..05677d8ded7 100644 --- a/idea/testData/intentions/importAllMembers/AmbiguousCalls.kt +++ b/idea/testData/intentions/importAllMembers/AmbiguousCalls.kt @@ -1,17 +1,15 @@ -// INTENTION_TEXT: "Import members from 'javax.swing.SwingUtilities'" +// INTENTION_TEXT: "Import members from 'JavaUtilClass'" // WITH_RUNTIME -// ERROR: None of the following functions can be called with the arguments supplied:
public open fun convertPoint(source: Component!, aPoint: Point!, destination: Component!): Point! defined in javax.swing.SwingUtilities
public open fun convertPoint(source: Component!, x: Int, y: Int, destination: Component!): Point! defined in javax.swing.SwingUtilities -// ERROR: None of the following functions can be called with the arguments supplied:
public open fun convertPoint(source: Component!, aPoint: Point!, destination: Component!): Point! defined in javax.swing.SwingUtilities
public open fun convertPoint(source: Component!, x: Int, y: Int, destination: Component!): Point! defined in javax.swing.SwingUtilities +// ERROR: None of the following functions can be called with the arguments supplied:
public open fun overloadedMethod(i: Int): Unit defined in JavaUtilClass
public open fun overloadedMethod(i: String!): Unit defined in JavaUtilClass +// ERROR: None of the following functions can be called with the arguments supplied:
public open fun overloadedMethod(i: Int): Unit defined in JavaUtilClass
public open fun overloadedMethod(i: String!): Unit defined in JavaUtilClass // ERROR: Unresolved reference: unresolved -import javax.swing.SwingUtilities - fun foo() { - SwingUtilities.convertPoint() + JavaUtilClass.overloadedMethod() - val bottom = SwingUtilities.BOTTOM + val bottom = JavaUtilClass.STATIC_FIELD - SwingUtilities.convertPoint() + JavaUtilClass.overloadedMethod() - SwingUtilities.unresolved + JavaUtilClass.unresolved } diff --git a/idea/testData/intentions/importAllMembers/AmbiguousCalls.kt.after b/idea/testData/intentions/importAllMembers/AmbiguousCalls.kt.after index c147e62c172..b6736ba6fd3 100644 --- a/idea/testData/intentions/importAllMembers/AmbiguousCalls.kt.after +++ b/idea/testData/intentions/importAllMembers/AmbiguousCalls.kt.after @@ -1,18 +1,17 @@ -// INTENTION_TEXT: "Import members from 'javax.swing.SwingUtilities'" +import JavaUtilClass.* + +// INTENTION_TEXT: "Import members from 'JavaUtilClass'" // WITH_RUNTIME -// ERROR: None of the following functions can be called with the arguments supplied:
public open fun convertPoint(source: Component!, aPoint: Point!, destination: Component!): Point! defined in javax.swing.SwingUtilities
public open fun convertPoint(source: Component!, x: Int, y: Int, destination: Component!): Point! defined in javax.swing.SwingUtilities -// ERROR: None of the following functions can be called with the arguments supplied:
public open fun convertPoint(source: Component!, aPoint: Point!, destination: Component!): Point! defined in javax.swing.SwingUtilities
public open fun convertPoint(source: Component!, x: Int, y: Int, destination: Component!): Point! defined in javax.swing.SwingUtilities +// ERROR: None of the following functions can be called with the arguments supplied:
public open fun overloadedMethod(i: Int): Unit defined in JavaUtilClass
public open fun overloadedMethod(i: String!): Unit defined in JavaUtilClass +// ERROR: None of the following functions can be called with the arguments supplied:
public open fun overloadedMethod(i: Int): Unit defined in JavaUtilClass
public open fun overloadedMethod(i: String!): Unit defined in JavaUtilClass // ERROR: Unresolved reference: unresolved -import javax.swing.SwingUtilities -import javax.swing.SwingUtilities.* - fun foo() { - convertPoint() + overloadedMethod() - val bottom = BOTTOM + val bottom = STATIC_FIELD - convertPoint() + overloadedMethod() - SwingUtilities.unresolved + JavaUtilClass.unresolved } diff --git a/idea/testData/intentions/importAllMembers/ImportAllMembersInImport.kt b/idea/testData/intentions/importAllMembers/ImportAllMembersInImport.kt index 1eec9972c09..2690d6010eb 100644 --- a/idea/testData/intentions/importAllMembers/ImportAllMembersInImport.kt +++ b/idea/testData/intentions/importAllMembers/ImportAllMembersInImport.kt @@ -1,4 +1,4 @@ // IS_APPLICABLE: false // WITH_RUNTIME -import javax.swing.SwingConstants.CENTER +import java.util.regex.Pattern.CASE_INSENSITIVE diff --git a/idea/testData/intentions/importAllMembers/QualifiedName.kt b/idea/testData/intentions/importAllMembers/QualifiedName.kt index 5b3c8394202..a3987c50df9 100644 --- a/idea/testData/intentions/importAllMembers/QualifiedName.kt +++ b/idea/testData/intentions/importAllMembers/QualifiedName.kt @@ -1,6 +1,6 @@ -// INTENTION_TEXT: "Import members from 'javax.swing.SwingUtilities'" +// INTENTION_TEXT: "Import members from 'java.util.regex.Pattern'" // WITH_RUNTIME fun foo() { - javax.swing.SwingUtilities.invokeLater { } + java.util.regex.Pattern.CASE_INSENSITIVE } diff --git a/idea/testData/intentions/importAllMembers/QualifiedName.kt.after b/idea/testData/intentions/importAllMembers/QualifiedName.kt.after index 5af68b3b649..d9134e718e7 100644 --- a/idea/testData/intentions/importAllMembers/QualifiedName.kt.after +++ b/idea/testData/intentions/importAllMembers/QualifiedName.kt.after @@ -1,8 +1,8 @@ -import javax.swing.SwingUtilities.* +import java.util.regex.Pattern.* -// INTENTION_TEXT: "Import members from 'javax.swing.SwingUtilities'" +// INTENTION_TEXT: "Import members from 'java.util.regex.Pattern'" // WITH_RUNTIME fun foo() { - invokeLater { } + CASE_INSENSITIVE } diff --git a/idea/testData/intentions/importAllMembers/QualifiedName2.kt b/idea/testData/intentions/importAllMembers/QualifiedName2.kt index d8d149db65a..485dae49599 100644 --- a/idea/testData/intentions/importAllMembers/QualifiedName2.kt +++ b/idea/testData/intentions/importAllMembers/QualifiedName2.kt @@ -1,6 +1,6 @@ -// INTENTION_TEXT: "Import members from 'javax.swing.SwingUtilities'" +// INTENTION_TEXT: "Import members from 'java.util.Objects'" // WITH_RUNTIME fun foo() { - javax.swing.SwingUtilities.invokeLater { } + java.util.Objects.equals(null, null) } diff --git a/idea/testData/intentions/importAllMembers/QualifiedName2.kt.after b/idea/testData/intentions/importAllMembers/QualifiedName2.kt.after index 5af68b3b649..3a4a2ea8684 100644 --- a/idea/testData/intentions/importAllMembers/QualifiedName2.kt.after +++ b/idea/testData/intentions/importAllMembers/QualifiedName2.kt.after @@ -1,8 +1,8 @@ -import javax.swing.SwingUtilities.* +import java.util.Objects.* -// INTENTION_TEXT: "Import members from 'javax.swing.SwingUtilities'" +// INTENTION_TEXT: "Import members from 'java.util.Objects'" // WITH_RUNTIME fun foo() { - invokeLater { } + equals(null, null) } diff --git a/idea/testData/intentions/importAllMembers/RemoveSingleImports.kt b/idea/testData/intentions/importAllMembers/RemoveSingleImports.kt index 7827e2a1f56..7f4aa4ed98a 100644 --- a/idea/testData/intentions/importAllMembers/RemoveSingleImports.kt +++ b/idea/testData/intentions/importAllMembers/RemoveSingleImports.kt @@ -1,17 +1,15 @@ -// INTENTION_TEXT: "Import members from 'javax.swing.SwingUtilities'" +// INTENTION_TEXT: "Import members from 'java.util.regex.Pattern'" // WITH_RUNTIME -import javax.swing.SwingUtilities -import javax.swing.SwingUtilities.invokeLater +import java.util.regex.Pattern +import java.util.regex.Pattern.matches fun foo() { - invokeLater { } + matches("", "") - val bottom = SwingUtilities.BOTTOM + val field = Pattern.CASE_INSENSITIVE - SwingUtilities.invokeAndWait { - invokeLater { } - } + Pattern.compile("") - val horizontal = javax.swing.SwingUtilities.HORIZONTAL + val fieldFqn = java.util.regex.Pattern.CASE_INSENSITIVE } diff --git a/idea/testData/intentions/importAllMembers/RemoveSingleImports.kt.after b/idea/testData/intentions/importAllMembers/RemoveSingleImports.kt.after index aa1967a1312..99fe2cd023e 100644 --- a/idea/testData/intentions/importAllMembers/RemoveSingleImports.kt.after +++ b/idea/testData/intentions/importAllMembers/RemoveSingleImports.kt.after @@ -1,17 +1,15 @@ -// INTENTION_TEXT: "Import members from 'javax.swing.SwingUtilities'" +// INTENTION_TEXT: "Import members from 'java.util.regex.Pattern'" // WITH_RUNTIME -import javax.swing.SwingUtilities -import javax.swing.SwingUtilities.* +import java.util.regex.Pattern +import java.util.regex.Pattern.* fun foo() { - invokeLater { } + matches("", "") - val bottom = BOTTOM + val field = CASE_INSENSITIVE - invokeAndWait { - invokeLater { } - } + compile("") - val horizontal = HORIZONTAL + val fieldFqn = CASE_INSENSITIVE } diff --git a/idea/testData/intentions/importAllMembers/StaticJavaMembers.kt b/idea/testData/intentions/importAllMembers/StaticJavaMembers.kt index 66dfeef1429..aff1a301a23 100644 --- a/idea/testData/intentions/importAllMembers/StaticJavaMembers.kt +++ b/idea/testData/intentions/importAllMembers/StaticJavaMembers.kt @@ -1,19 +1,17 @@ -// INTENTION_TEXT: "Import members from 'javax.swing.SwingUtilities'" +// INTENTION_TEXT: "Import members from 'java.util.regex.Pattern'" // WITH_RUNTIME // ERROR: Unresolved reference: unresolved -import javax.swing.SwingUtilities +import java.util.regex.Pattern fun foo() { - SwingUtilities.invokeLater { } + Pattern.matches("", "") - val bottom = SwingUtilities.BOTTOM + val field = Pattern.CASE_INSENSITIVE - SwingUtilities.invokeAndWait { - SwingUtilities.invokeLater { } - } + Pattern.compile("") - val horizontal = javax.swing.SwingUtilities.HORIZONTAL + val fieldFqn = java.util.regex.Pattern.CASE_INSENSITIVE - SwingUtilities.unresolved + Pattern.unresolved } diff --git a/idea/testData/intentions/importAllMembers/StaticJavaMembers.kt.after b/idea/testData/intentions/importAllMembers/StaticJavaMembers.kt.after index d1e0a761c0a..2d972dc57c3 100644 --- a/idea/testData/intentions/importAllMembers/StaticJavaMembers.kt.after +++ b/idea/testData/intentions/importAllMembers/StaticJavaMembers.kt.after @@ -1,20 +1,18 @@ -// INTENTION_TEXT: "Import members from 'javax.swing.SwingUtilities'" +// INTENTION_TEXT: "Import members from 'java.util.regex.Pattern'" // WITH_RUNTIME // ERROR: Unresolved reference: unresolved -import javax.swing.SwingUtilities -import javax.swing.SwingUtilities.* +import java.util.regex.Pattern +import java.util.regex.Pattern.* fun foo() { - invokeLater { } + matches("", "") - val bottom = BOTTOM + val field = CASE_INSENSITIVE - invokeAndWait { - invokeLater { } - } + compile("") - val horizontal = HORIZONTAL + val fieldFqn = CASE_INSENSITIVE - SwingUtilities.unresolved + Pattern.unresolved } diff --git a/idea/testData/intentions/importAllMembers/UnresolvedMember.kt b/idea/testData/intentions/importAllMembers/UnresolvedMember.kt index 232e592b642..4e35f4e266b 100644 --- a/idea/testData/intentions/importAllMembers/UnresolvedMember.kt +++ b/idea/testData/intentions/importAllMembers/UnresolvedMember.kt @@ -2,6 +2,6 @@ // WITH_RUNTIME // ERROR: Unresolved reference: unresolved -import javax.swing.SwingUtilities +import java.util.Objects -val v = SwingUtilities.unresolved() \ No newline at end of file +val v = Objects.unresolved() \ No newline at end of file diff --git a/idea/testData/intentions/importMember/ImportMemberInImport.kt b/idea/testData/intentions/importMember/ImportMemberInImport.kt index 826fb8f7363..d6f85839e32 100644 --- a/idea/testData/intentions/importMember/ImportMemberInImport.kt +++ b/idea/testData/intentions/importMember/ImportMemberInImport.kt @@ -1,4 +1,4 @@ // IS_APPLICABLE: false // WITH_RUNTIME -import javax.swing.SwingConstants.CENTER \ No newline at end of file +import java.util.regex.Pattern.CASE_INSENSITIVE \ No newline at end of file diff --git a/idea/testData/intentions/importMember/ImportMemberInMiddleOfImport.kt b/idea/testData/intentions/importMember/ImportMemberInMiddleOfImport.kt index 4e7b1fec860..f943cdff5ac 100644 --- a/idea/testData/intentions/importMember/ImportMemberInMiddleOfImport.kt +++ b/idea/testData/intentions/importMember/ImportMemberInMiddleOfImport.kt @@ -1,4 +1,4 @@ // IS_APPLICABLE: false // WITH_RUNTIME -import javax.swing.SwingConstants.CENTER \ No newline at end of file +import java.util.regex.Pattern.CASE_INSENSITIVE \ No newline at end of file diff --git a/idea/testData/intentions/importMember/NoTarget.kt b/idea/testData/intentions/importMember/NoTarget.kt index 9b746166f17..90b8edfa448 100644 --- a/idea/testData/intentions/importMember/NoTarget.kt +++ b/idea/testData/intentions/importMember/NoTarget.kt @@ -1,10 +1,9 @@ // IS_APPLICABLE: false // WITH_RUNTIME -// ERROR: Unresolved reference: xxx +// ERROR: Unresolved reference: unresolved -import javax.swing.SwingUtilities +import java.util.regex.Pattern fun foo() { - SwingUtilities.xxx { - } + Pattern.unresolved() } diff --git a/idea/testData/intentions/importMember/NotForQualifier.kt b/idea/testData/intentions/importMember/NotForQualifier.kt index f9989e1153c..045bf43cd9f 100644 --- a/idea/testData/intentions/importMember/NotForQualifier.kt +++ b/idea/testData/intentions/importMember/NotForQualifier.kt @@ -1,9 +1,8 @@ // IS_APPLICABLE: false // WITH_RUNTIME -import javax.swing.SwingUtilities +import java.util.regex.Pattern fun foo() { - SwingUtilities.invokeLater { - } + Pattern.CASE_INSENSITIVE } diff --git a/idea/testData/intentions/importMember/StaticJavaField.kt b/idea/testData/intentions/importMember/StaticJavaField.kt index 685fb48f0d7..847dbc0db5e 100644 --- a/idea/testData/intentions/importMember/StaticJavaField.kt +++ b/idea/testData/intentions/importMember/StaticJavaField.kt @@ -1,10 +1,10 @@ -// INTENTION_TEXT: "Add import for 'javax.swing.SwingConstants.CENTER'" +// INTENTION_TEXT: "Add import for 'java.util.regex.Pattern.CASE_INSENSITIVE'" // WITH_RUNTIME -import javax.swing.SwingConstants +import java.util.regex.Pattern fun foo() { - val v = SwingConstants.CENTER + val v = Pattern.CASE_INSENSITIVE - SwingConstants.CENTER + Pattern.CASE_INSENSITIVE } diff --git a/idea/testData/intentions/importMember/StaticJavaField.kt.after b/idea/testData/intentions/importMember/StaticJavaField.kt.after index 3dafbdc51b4..85f5595f690 100644 --- a/idea/testData/intentions/importMember/StaticJavaField.kt.after +++ b/idea/testData/intentions/importMember/StaticJavaField.kt.after @@ -1,11 +1,11 @@ -// INTENTION_TEXT: "Add import for 'javax.swing.SwingConstants.CENTER'" +// INTENTION_TEXT: "Add import for 'java.util.regex.Pattern.CASE_INSENSITIVE'" // WITH_RUNTIME -import javax.swing.SwingConstants -import javax.swing.SwingConstants.CENTER +import java.util.regex.Pattern +import java.util.regex.Pattern.CASE_INSENSITIVE fun foo() { - val v = CENTER + val v = CASE_INSENSITIVE - CENTER + CASE_INSENSITIVE } diff --git a/idea/testData/intentions/importMember/StaticJavaMethod.kt b/idea/testData/intentions/importMember/StaticJavaMethod.kt index 95812f9bdd5..c134ee8b24a 100644 --- a/idea/testData/intentions/importMember/StaticJavaMethod.kt +++ b/idea/testData/intentions/importMember/StaticJavaMethod.kt @@ -1,26 +1,23 @@ -// INTENTION_TEXT: "Add import for 'javax.swing.SwingUtilities.invokeLater'" +// INTENTION_TEXT: "Add import for 'java.util.regex.Pattern.matches'" // WITH_RUNTIME // ERROR: Unresolved reference: SomethingElse // ERROR: Unresolved reference: somethingElse // SKIP_ERRORS_AFTER -import javax.swing.SwingUtilities +import java.util.regex.Pattern fun foo() { - SwingUtilities.invokeLater {} + Pattern.matches("", "") } fun bar() { - javax.swing.SwingUtilities.invokeLater { - } + Pattern.matches("", "") - javax.swing.SwingUtilities.invokeLater(Runnable { - SwingUtilities.invokeLater { } - }) + java.util.regex.Pattern.matches("", "") - SwingUtilities.invokeAndWait { } + Pattern.compile("") - SomethingElse.invokeLater() + SomethingElse.matches("", "") - somethingElse.SwingUtilities.invokeLater() + somethingElse.Pattern.matches("", "") } \ No newline at end of file diff --git a/idea/testData/intentions/importMember/StaticJavaMethod.kt.after b/idea/testData/intentions/importMember/StaticJavaMethod.kt.after index 2ba63b22380..383b6795f7a 100644 --- a/idea/testData/intentions/importMember/StaticJavaMethod.kt.after +++ b/idea/testData/intentions/importMember/StaticJavaMethod.kt.after @@ -1,27 +1,24 @@ -// INTENTION_TEXT: "Add import for 'javax.swing.SwingUtilities.invokeLater'" +// INTENTION_TEXT: "Add import for 'java.util.regex.Pattern.matches'" // WITH_RUNTIME // ERROR: Unresolved reference: SomethingElse // ERROR: Unresolved reference: somethingElse // SKIP_ERRORS_AFTER -import javax.swing.SwingUtilities -import javax.swing.SwingUtilities.invokeLater +import java.util.regex.Pattern +import java.util.regex.Pattern.matches fun foo() { - invokeLater {} + matches("", "") } fun bar() { - invokeLater { - } + matches("", "") - invokeLater(Runnable { - invokeLater { } - }) + matches("", "") - SwingUtilities.invokeAndWait { } + Pattern.compile("") - SomethingElse.invokeLater() + SomethingElse.matches("", "") - somethingElse.SwingUtilities.invokeLater() + somethingElse.Pattern.matches("", "") } \ No newline at end of file diff --git a/idea/testData/intentions/objectLiteralToLambda/NoSamAdapterNeeded.kt b/idea/testData/intentions/objectLiteralToLambda/NoSamAdapterNeeded.kt index aa7659abd85..070f2ee69a4 100644 --- a/idea/testData/intentions/objectLiteralToLambda/NoSamAdapterNeeded.kt +++ b/idea/testData/intentions/objectLiteralToLambda/NoSamAdapterNeeded.kt @@ -1,9 +1,7 @@ // WITH_RUNTIME -import javax.swing.SwingUtilities - fun bar() { - SwingUtilities.invokeLater(object: Runnable { + Thread(object: Runnable { override fun run() { throw UnsupportedOperationException() } diff --git a/idea/testData/intentions/objectLiteralToLambda/NoSamAdapterNeeded.kt.after b/idea/testData/intentions/objectLiteralToLambda/NoSamAdapterNeeded.kt.after index e2a67d2ccf7..837d3bfd184 100644 --- a/idea/testData/intentions/objectLiteralToLambda/NoSamAdapterNeeded.kt.after +++ b/idea/testData/intentions/objectLiteralToLambda/NoSamAdapterNeeded.kt.after @@ -1,7 +1,5 @@ // WITH_RUNTIME -import javax.swing.SwingUtilities - fun bar() { - SwingUtilities.invokeLater { throw UnsupportedOperationException() } + Thread { throw UnsupportedOperationException() } } \ No newline at end of file diff --git a/idea/testData/intentions/objectLiteralToLambda/SamAdapterNeededBecauseOfLabeledReturn.kt b/idea/testData/intentions/objectLiteralToLambda/SamAdapterNeededBecauseOfLabeledReturn.kt index cb9a0a477a7..6349809c8cf 100644 --- a/idea/testData/intentions/objectLiteralToLambda/SamAdapterNeededBecauseOfLabeledReturn.kt +++ b/idea/testData/intentions/objectLiteralToLambda/SamAdapterNeededBecauseOfLabeledReturn.kt @@ -1,9 +1,7 @@ // WITH_RUNTIME -import javax.swing.SwingUtilities - fun bar(p: Int) { - SwingUtilities.invokeLater(object: Runnable { + Thread(object: Runnable { override fun run() { if (p < 0) return throw UnsupportedOperationException() diff --git a/idea/testData/intentions/objectLiteralToLambda/SamAdapterNeededBecauseOfLabeledReturn.kt.after b/idea/testData/intentions/objectLiteralToLambda/SamAdapterNeededBecauseOfLabeledReturn.kt.after index 688d0a8cd5c..f0e85fe5a58 100644 --- a/idea/testData/intentions/objectLiteralToLambda/SamAdapterNeededBecauseOfLabeledReturn.kt.after +++ b/idea/testData/intentions/objectLiteralToLambda/SamAdapterNeededBecauseOfLabeledReturn.kt.after @@ -1,9 +1,7 @@ // WITH_RUNTIME -import javax.swing.SwingUtilities - fun bar(p: Int) { - SwingUtilities.invokeLater(Runnable { + Thread(Runnable { if (p < 0) return@Runnable throw UnsupportedOperationException() }) diff --git a/idea/testData/intentions/objectLiteralToLambda/inspectionData/expected.xml b/idea/testData/intentions/objectLiteralToLambda/inspectionData/expected.xml index 748c5002ceb..b464bd2036d 100644 --- a/idea/testData/intentions/objectLiteralToLambda/inspectionData/expected.xml +++ b/idea/testData/intentions/objectLiteralToLambda/inspectionData/expected.xml @@ -45,7 +45,7 @@ NoSamAdapterNeeded.kt - 6 + 4 light_idea_test_case Convert object literal to lambda diff --git a/idea/testData/intentions/specifyTypeExplicitly/classNameClashing.kt b/idea/testData/intentions/specifyTypeExplicitly/classNameClashing.kt index d11f9c00516..3c1116959ed 100644 --- a/idea/testData/intentions/specifyTypeExplicitly/classNameClashing.kt +++ b/idea/testData/intentions/specifyTypeExplicitly/classNameClashing.kt @@ -1,6 +1,10 @@ // WITH_RUNTIME -fun getEntry() : Map.Entry, java.sql.Array> { +object Holder { + class Array +} + +fun getEntry() : Map.Entry, Holder.Array> { throw Error() } diff --git a/idea/testData/intentions/specifyTypeExplicitly/classNameClashing.kt.after b/idea/testData/intentions/specifyTypeExplicitly/classNameClashing.kt.after index ec5193318d2..f7a67a94bac 100644 --- a/idea/testData/intentions/specifyTypeExplicitly/classNameClashing.kt.after +++ b/idea/testData/intentions/specifyTypeExplicitly/classNameClashing.kt.after @@ -1,7 +1,11 @@ // WITH_RUNTIME -fun getEntry() : Map.Entry, java.sql.Array> { +object Holder { + class Array +} + +fun getEntry() : Map.Entry, Holder.Array> { throw Error() } -val x: Map.Entry, java.sql.Array> = getEntry() +val x: Map.Entry, Holder.Array> = getEntry() diff --git a/idea/testData/intentions/usePropertyAccessSyntax/suppressedByNotPropertyList.kt b/idea/testData/intentions/usePropertyAccessSyntax/suppressedByNotPropertyList.kt index bf240cb68d1..655b7319c46 100644 --- a/idea/testData/intentions/usePropertyAccessSyntax/suppressedByNotPropertyList.kt +++ b/idea/testData/intentions/usePropertyAccessSyntax/suppressedByNotPropertyList.kt @@ -1,9 +1,9 @@ // WITH_RUNTIME // WITH_JDK // IS_APPLICABLE: false -import java.net.Socket +import java.util.concurrent.atomic.AtomicInteger fun main(args: Array) { - val s = Socket() - val stream = s.getInputStream() + val i = AtomicInteger() + val value = i.getAndIncrement() } \ No newline at end of file