From 4c498b004f89423fa969057789517dd2fef54cfc Mon Sep 17 00:00:00 2001 From: Vyacheslav Gerasimov Date: Mon, 23 Oct 2017 18:03:24 +0300 Subject: [PATCH] as31: Fix test data for android lint based tests for AS 3.0 --- .../android/lint/supportAnnotation.kt.as31 | 36 +++++++++++++++++++ .../parcelable/missingCreator.kt.as31 | 2 +- .../missingCreator.kt.expected.as31 | 27 ++++++++++++++ .../parcelable/noImplementation.kt.as31 | 2 +- .../noImplementation.kt.expected.as31 | 27 ++++++++++++++ .../requiresApi/annotation.kt.as31 | 2 +- .../requiresApi/annotation.kt.expected.as31 | 15 ++++++++ .../requiresApi/companion.kt.as31 | 2 +- .../requiresApi/companion.kt.expected.as31 | 14 ++++++++ .../requiresApi/defaultParameter.kt.as31 | 2 +- .../defaultParameter.kt.expected.as31 | 13 +++++++ .../lintQuickfix/requiresApi/extend.kt.as31 | 2 +- .../requiresApi/extend.kt.expected.as31 | 12 +++++++ .../requiresApi/functionLiteral.kt.as31 | 2 +- .../functionLiteral.kt.expected.as31 | 16 +++++++++ .../requiresApi/inlinedConstant.kt.as31 | 2 +- .../inlinedConstant.kt.expected.as31 | 13 +++++++ .../lintQuickfix/requiresApi/method.kt.as31 | 2 +- .../requiresApi/method.kt.expected.as31 | 14 ++++++++ .../lintQuickfix/requiresApi/property.kt.as31 | 2 +- .../requiresApi/property.kt.expected.as31 | 12 +++++++ .../requiresApi/topLevelProperty.kt.as31 | 7 ++++ .../topLevelProperty.kt.expected.as31 | 10 ++++++ .../lintQuickfix/requiresApi/when.kt.as31 | 2 +- .../requiresApi/when.kt.expected.as31 | 18 ++++++++++ .../suppressLint/activityMethod.kt.as31 | 2 +- .../activityMethod.kt.expected.as31 | 12 +++++++ .../addToExistingAnnotation.kt.as31 | 2 +- .../addToExistingAnnotation.kt.expected.as31 | 12 +++++++ .../suppressLint/constructorParameter.kt.as31 | 2 +- .../constructorParameter.kt.expected.as31 | 6 ++++ .../destructuringDeclaration.kt.as31 | 2 +- .../destructuringDeclaration.kt.expected.as31 | 12 +++++++ .../suppressLint/lambdaArgument.kt.as31 | 2 +- .../lambdaArgument.kt.expected.as31 | 13 +++++++ .../lambdaArgumentProperty.kt.as31 | 2 +- .../lambdaArgumentProperty.kt.expected.as31 | 9 +++++ .../suppressLint/methodParameter.kt.as31 | 2 +- .../methodParameter.kt.expected.as31 | 6 ++++ .../suppressLint/propertyWithLambda.kt.as31 | 2 +- .../propertyWithLambda.kt.expected.as31 | 7 ++++ .../suppressLint/simpleProperty.kt.as31 | 2 +- .../simpleProperty.kt.expected.as31 | 7 ++++ .../lintQuickfix/targetApi/annotation.kt.as31 | 2 +- .../targetApi/annotation.kt.expected.as31 | 14 ++++++++ .../lintQuickfix/targetApi/companion.kt.as31 | 2 +- .../targetApi/companion.kt.expected.as31 | 13 +++++++ .../targetApi/defaultParameter.kt.as31 | 2 +- .../defaultParameter.kt.expected.as31 | 12 +++++++ .../lintQuickfix/targetApi/extend.kt.as31 | 2 +- .../targetApi/extend.kt.expected.as31 | 11 ++++++ .../targetApi/functionLiteral.kt.as31 | 2 +- .../functionLiteral.kt.expected.as31 | 15 ++++++++ .../targetApi/inlinedConstant.kt.as31 | 2 +- .../inlinedConstant.kt.expected.as31 | 12 +++++++ .../lintQuickfix/targetApi/method.kt.as31 | 2 +- .../targetApi/method.kt.expected.as31 | 13 +++++++ .../lintQuickfix/targetApi/property.kt.as31 | 2 +- .../targetApi/property.kt.expected.as31 | 11 ++++++ .../targetApi/topLevelProperty.kt.as31 | 6 ++++ .../topLevelProperty.kt.expected.as31 | 9 +++++ .../lintQuickfix/targetApi/when.kt.as31 | 2 +- .../targetApi/when.kt.expected.as31 | 17 +++++++++ .../targetVersionCheck/annotation.kt.as31 | 2 +- .../defaultParameter.kt.as31 | 2 +- .../destructuringDeclaration.kt.as31 | 12 +++++++ .../destructuringDeclaration.kt.expected.as31 | 17 +++++++++ .../targetVersionCheck/expressionBody.kt.as31 | 2 +- .../expressionBody.kt.expected.as31 | 13 +++++++ .../functionLiteral.kt.as31 | 2 +- .../functionLiteral.kt.expected.as31 | 17 +++++++++ .../getterWIthExpressionBody.kt.as31 | 7 ++++ .../getterWIthExpressionBody.kt.expected.as31 | 12 +++++++ .../targetVersionCheck/if.kt.as31 | 2 +- .../targetVersionCheck/if.kt.expected.as31 | 17 +++++++++ .../targetVersionCheck/ifWithBlock.kt.as31 | 2 +- .../ifWithBlock.kt.expected.as31 | 18 ++++++++++ .../inlinedConstant.kt.as31 | 2 +- .../inlinedConstant.kt.expected.as31 | 14 ++++++++ .../targetVersionCheck/method.kt.as31 | 2 +- .../method.kt.expected.as31 | 15 ++++++++ .../targetVersionCheck/when.kt.as31 | 2 +- .../targetVersionCheck/when.kt.expected.as31 | 19 ++++++++++ 83 files changed, 650 insertions(+), 38 deletions(-) create mode 100644 idea/testData/android/lint/supportAnnotation.kt.as31 create mode 100644 idea/testData/android/lintQuickfix/parcelable/missingCreator.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/parcelable/noImplementation.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/requiresApi/annotation.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/requiresApi/companion.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/requiresApi/defaultParameter.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/requiresApi/extend.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/requiresApi/functionLiteral.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/requiresApi/inlinedConstant.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/requiresApi/method.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/requiresApi/property.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/requiresApi/topLevelProperty.kt.as31 create mode 100644 idea/testData/android/lintQuickfix/requiresApi/topLevelProperty.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/requiresApi/when.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/suppressLint/activityMethod.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/suppressLint/addToExistingAnnotation.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/suppressLint/constructorParameter.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/suppressLint/destructuringDeclaration.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/suppressLint/lambdaArgument.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/suppressLint/lambdaArgumentProperty.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/suppressLint/methodParameter.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/suppressLint/propertyWithLambda.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/suppressLint/simpleProperty.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/targetApi/annotation.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/targetApi/companion.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/targetApi/defaultParameter.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/targetApi/extend.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/targetApi/functionLiteral.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/targetApi/inlinedConstant.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/targetApi/method.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/targetApi/property.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/targetApi/topLevelProperty.kt.as31 create mode 100644 idea/testData/android/lintQuickfix/targetApi/topLevelProperty.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/targetApi/when.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/targetVersionCheck/destructuringDeclaration.kt.as31 create mode 100644 idea/testData/android/lintQuickfix/targetVersionCheck/destructuringDeclaration.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/targetVersionCheck/expressionBody.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/targetVersionCheck/functionLiteral.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/targetVersionCheck/getterWIthExpressionBody.kt.as31 create mode 100644 idea/testData/android/lintQuickfix/targetVersionCheck/getterWIthExpressionBody.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/targetVersionCheck/if.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/targetVersionCheck/ifWithBlock.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/targetVersionCheck/inlinedConstant.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/targetVersionCheck/method.kt.expected.as31 create mode 100644 idea/testData/android/lintQuickfix/targetVersionCheck/when.kt.expected.as31 diff --git a/idea/testData/android/lint/supportAnnotation.kt.as31 b/idea/testData/android/lint/supportAnnotation.kt.as31 new file mode 100644 index 00000000000..67eeeb3e98b --- /dev/null +++ b/idea/testData/android/lint/supportAnnotation.kt.as31 @@ -0,0 +1,36 @@ +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSupportAnnotationUsageInspection +// DEPENDENCY: IntRange.java -> android/support/annotation/IntRange.java +// DEPENDENCY: RequiresPermission.java -> android/support/annotation/RequiresPermission.java + + +import android.support.annotation.IntRange +import android.support.annotation.RequiresPermission +import android.Manifest +import android.view.View + +const val constantVal = 0L + +@IntRange(from = 10, to = 0) +fun invalidRange1a(): Int = 5 + +@IntRange(from = constantVal, to = 10) // ok +fun invalidRange0b(): Int = 5 + +@IntRange(from = 10, to = constantVal) +fun invalidRange1b(): Int = 5 + + +// should be ok, KT-16600 +@RequiresPermission(anyOf = arrayOf(Manifest.permission.ACCESS_CHECKIN_PROPERTIES, + Manifest.permission.ACCESS_FINE_LOCATION)) +fun needsPermissions1() { } + +// should be ok, KT-16600 +@RequiresPermission(Manifest.permission.ACCESS_CHECKIN_PROPERTIES) +fun needsPermissions2() { } + +// error +@RequiresPermission( + value = Manifest.permission.ACCESS_CHECKIN_PROPERTIES, + anyOf = arrayOf(Manifest.permission.ACCESS_CHECKIN_PROPERTIES, Manifest.permission.ACCESS_FINE_LOCATION)) +fun needsPermissions3() { } \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/parcelable/missingCreator.kt.as31 b/idea/testData/android/lintQuickfix/parcelable/missingCreator.kt.as31 index 5323b6d44bf..cdfb473d8a6 100644 --- a/idea/testData/android/lintQuickfix/parcelable/missingCreator.kt.as31 +++ b/idea/testData/android/lintQuickfix/parcelable/missingCreator.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Add Parcelable Implementation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintParcelCreatorInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintParcelCreatorInspection import android.os.Parcel import android.os.Parcelable diff --git a/idea/testData/android/lintQuickfix/parcelable/missingCreator.kt.expected.as31 b/idea/testData/android/lintQuickfix/parcelable/missingCreator.kt.expected.as31 new file mode 100644 index 00000000000..29ea448d7ae --- /dev/null +++ b/idea/testData/android/lintQuickfix/parcelable/missingCreator.kt.expected.as31 @@ -0,0 +1,27 @@ +// INTENTION_TEXT: Add Parcelable Implementation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintParcelCreatorInspection +import android.os.Parcel +import android.os.Parcelable + +class MissingCreator() : Parcelable { + constructor(parcel: Parcel) : this() { + } + + override fun writeToParcel(dest: Parcel?, flags: Int) { + TODO("not implemented") + } + + override fun describeContents(): Int { + TODO("not implemented") + } + + companion object CREATOR : Parcelable.Creator { + override fun createFromParcel(parcel: Parcel): MissingCreator { + return MissingCreator(parcel) + } + + override fun newArray(size: Int): Array { + return arrayOfNulls(size) + } + } +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/parcelable/noImplementation.kt.as31 b/idea/testData/android/lintQuickfix/parcelable/noImplementation.kt.as31 index 77379bdf08c..09eafd5b62e 100644 --- a/idea/testData/android/lintQuickfix/parcelable/noImplementation.kt.as31 +++ b/idea/testData/android/lintQuickfix/parcelable/noImplementation.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Add Parcelable Implementation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintParcelCreatorInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintParcelCreatorInspection import android.os.Parcelable class NoImplementation : Parcelable \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/parcelable/noImplementation.kt.expected.as31 b/idea/testData/android/lintQuickfix/parcelable/noImplementation.kt.expected.as31 new file mode 100644 index 00000000000..f364327f3d2 --- /dev/null +++ b/idea/testData/android/lintQuickfix/parcelable/noImplementation.kt.expected.as31 @@ -0,0 +1,27 @@ +// INTENTION_TEXT: Add Parcelable Implementation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintParcelCreatorInspection +import android.os.Parcel +import android.os.Parcelable + +class NoImplementation() : Parcelable { + constructor(parcel: Parcel) : this() { + } + + override fun writeToParcel(parcel: Parcel, flags: Int) { + + } + + override fun describeContents(): Int { + return 0 + } + + companion object CREATOR : Parcelable.Creator { + override fun createFromParcel(parcel: Parcel): NoImplementation { + return NoImplementation(parcel) + } + + override fun newArray(size: Int): Array { + return arrayOfNulls(size) + } + } +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/annotation.kt.as31 b/idea/testData/android/lintQuickfix/requiresApi/annotation.kt.as31 index 76db9697a88..19b6ba7d86a 100644 --- a/idea/testData/android/lintQuickfix/requiresApi/annotation.kt.as31 +++ b/idea/testData/android/lintQuickfix/requiresApi/annotation.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintNewApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection // DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java import android.graphics.drawable.VectorDrawable diff --git a/idea/testData/android/lintQuickfix/requiresApi/annotation.kt.expected.as31 b/idea/testData/android/lintQuickfix/requiresApi/annotation.kt.expected.as31 new file mode 100644 index 00000000000..dbc848be75d --- /dev/null +++ b/idea/testData/android/lintQuickfix/requiresApi/annotation.kt.expected.as31 @@ -0,0 +1,15 @@ +// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection +// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java + +import android.graphics.drawable.VectorDrawable +import android.os.Build +import android.support.annotation.RequiresApi +import kotlin.reflect.KClass + +annotation class SomeAnnotationWithClass(val cls: KClass<*>) + +@RequiresApi(Build.VERSION_CODES.LOLLIPOP) +@SomeAnnotationWithClass(VectorDrawable::class) +class VectorDrawableProvider { +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/companion.kt.as31 b/idea/testData/android/lintQuickfix/requiresApi/companion.kt.as31 index 68568d40ab5..be0bb206f63 100644 --- a/idea/testData/android/lintQuickfix/requiresApi/companion.kt.as31 +++ b/idea/testData/android/lintQuickfix/requiresApi/companion.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintNewApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection // DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java import android.graphics.drawable.VectorDrawable diff --git a/idea/testData/android/lintQuickfix/requiresApi/companion.kt.expected.as31 b/idea/testData/android/lintQuickfix/requiresApi/companion.kt.expected.as31 new file mode 100644 index 00000000000..d2fc869db12 --- /dev/null +++ b/idea/testData/android/lintQuickfix/requiresApi/companion.kt.expected.as31 @@ -0,0 +1,14 @@ +// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection +// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java + +import android.graphics.drawable.VectorDrawable +import android.os.Build +import android.support.annotation.RequiresApi + +class VectorDrawableProvider { + companion object { + @RequiresApi(Build.VERSION_CODES.LOLLIPOP) + val VECTOR_DRAWABLE = VectorDrawable() + } +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/defaultParameter.kt.as31 b/idea/testData/android/lintQuickfix/requiresApi/defaultParameter.kt.as31 index cddbbe524a8..c8a4583498e 100644 --- a/idea/testData/android/lintQuickfix/requiresApi/defaultParameter.kt.as31 +++ b/idea/testData/android/lintQuickfix/requiresApi/defaultParameter.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintNewApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection // DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java import android.graphics.drawable.VectorDrawable diff --git a/idea/testData/android/lintQuickfix/requiresApi/defaultParameter.kt.expected.as31 b/idea/testData/android/lintQuickfix/requiresApi/defaultParameter.kt.expected.as31 new file mode 100644 index 00000000000..8d3fcc4c207 --- /dev/null +++ b/idea/testData/android/lintQuickfix/requiresApi/defaultParameter.kt.expected.as31 @@ -0,0 +1,13 @@ +// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection +// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java + +import android.graphics.drawable.VectorDrawable +import android.os.Build +import android.support.annotation.RequiresApi + + +@RequiresApi(Build.VERSION_CODES.LOLLIPOP) +fun withDefaultParameter(vector: VectorDrawable = VectorDrawable()) { + +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/extend.kt.as31 b/idea/testData/android/lintQuickfix/requiresApi/extend.kt.as31 index 233c746a212..6e53535aa1d 100644 --- a/idea/testData/android/lintQuickfix/requiresApi/extend.kt.as31 +++ b/idea/testData/android/lintQuickfix/requiresApi/extend.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintNewApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection // DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java import android.graphics.drawable.VectorDrawable diff --git a/idea/testData/android/lintQuickfix/requiresApi/extend.kt.expected.as31 b/idea/testData/android/lintQuickfix/requiresApi/extend.kt.expected.as31 new file mode 100644 index 00000000000..3307f07e34e --- /dev/null +++ b/idea/testData/android/lintQuickfix/requiresApi/extend.kt.expected.as31 @@ -0,0 +1,12 @@ +// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection +// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java + +import android.graphics.drawable.VectorDrawable +import android.os.Build +import android.support.annotation.RequiresApi + +@RequiresApi(Build.VERSION_CODES.LOLLIPOP) +class MyVectorDrawable : VectorDrawable() { + +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/functionLiteral.kt.as31 b/idea/testData/android/lintQuickfix/requiresApi/functionLiteral.kt.as31 index 00575be4e2c..c6016fd4012 100644 --- a/idea/testData/android/lintQuickfix/requiresApi/functionLiteral.kt.as31 +++ b/idea/testData/android/lintQuickfix/requiresApi/functionLiteral.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintNewApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection // DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java import android.graphics.drawable.VectorDrawable diff --git a/idea/testData/android/lintQuickfix/requiresApi/functionLiteral.kt.expected.as31 b/idea/testData/android/lintQuickfix/requiresApi/functionLiteral.kt.expected.as31 new file mode 100644 index 00000000000..ff231d64d5a --- /dev/null +++ b/idea/testData/android/lintQuickfix/requiresApi/functionLiteral.kt.expected.as31 @@ -0,0 +1,16 @@ +// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection +// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java + +import android.graphics.drawable.VectorDrawable +import android.os.Build +import android.support.annotation.RequiresApi + +class VectorDrawableProvider { + @RequiresApi(Build.VERSION_CODES.LOLLIPOP) + fun getVectorDrawable(): VectorDrawable { + with(this) { + return VectorDrawable() + } + } +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/inlinedConstant.kt.as31 b/idea/testData/android/lintQuickfix/requiresApi/inlinedConstant.kt.as31 index d838f2b22fd..025b3d3d130 100644 --- a/idea/testData/android/lintQuickfix/requiresApi/inlinedConstant.kt.as31 +++ b/idea/testData/android/lintQuickfix/requiresApi/inlinedConstant.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Add @RequiresApi(KITKAT) Annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintInlinedApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintInlinedApiInspection // DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java class Test { diff --git a/idea/testData/android/lintQuickfix/requiresApi/inlinedConstant.kt.expected.as31 b/idea/testData/android/lintQuickfix/requiresApi/inlinedConstant.kt.expected.as31 new file mode 100644 index 00000000000..8151e13fa3d --- /dev/null +++ b/idea/testData/android/lintQuickfix/requiresApi/inlinedConstant.kt.expected.as31 @@ -0,0 +1,13 @@ +import android.os.Build +import android.support.annotation.RequiresApi + +// INTENTION_TEXT: Add @RequiresApi(KITKAT) Annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintInlinedApiInspection +// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java + +class Test { + @RequiresApi(Build.VERSION_CODES.KITKAT) + fun foo(): Int { + return android.R.attr.windowTranslucentStatus + } +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/method.kt.as31 b/idea/testData/android/lintQuickfix/requiresApi/method.kt.as31 index 14ccb785f24..efbd6dcc173 100644 --- a/idea/testData/android/lintQuickfix/requiresApi/method.kt.as31 +++ b/idea/testData/android/lintQuickfix/requiresApi/method.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintNewApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection // DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java import android.graphics.drawable.VectorDrawable diff --git a/idea/testData/android/lintQuickfix/requiresApi/method.kt.expected.as31 b/idea/testData/android/lintQuickfix/requiresApi/method.kt.expected.as31 new file mode 100644 index 00000000000..3183461bf58 --- /dev/null +++ b/idea/testData/android/lintQuickfix/requiresApi/method.kt.expected.as31 @@ -0,0 +1,14 @@ +// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection +// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java + +import android.graphics.drawable.VectorDrawable +import android.os.Build +import android.support.annotation.RequiresApi + +class VectorDrawableProvider { + @RequiresApi(Build.VERSION_CODES.LOLLIPOP) + fun getVectorDrawable(): VectorDrawable { + return VectorDrawable() + } +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/property.kt.as31 b/idea/testData/android/lintQuickfix/requiresApi/property.kt.as31 index fa17b13e2e6..d73223f8c0d 100644 --- a/idea/testData/android/lintQuickfix/requiresApi/property.kt.as31 +++ b/idea/testData/android/lintQuickfix/requiresApi/property.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintNewApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection // DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java import android.graphics.drawable.VectorDrawable diff --git a/idea/testData/android/lintQuickfix/requiresApi/property.kt.expected.as31 b/idea/testData/android/lintQuickfix/requiresApi/property.kt.expected.as31 new file mode 100644 index 00000000000..2da5890a952 --- /dev/null +++ b/idea/testData/android/lintQuickfix/requiresApi/property.kt.expected.as31 @@ -0,0 +1,12 @@ +// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection +// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java + +import android.graphics.drawable.VectorDrawable +import android.os.Build +import android.support.annotation.RequiresApi + +class VectorDrawableProvider { + @RequiresApi(Build.VERSION_CODES.LOLLIPOP) + val VECTOR_DRAWABLE = VectorDrawable() +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/topLevelProperty.kt.as31 b/idea/testData/android/lintQuickfix/requiresApi/topLevelProperty.kt.as31 new file mode 100644 index 00000000000..7e7564b542c --- /dev/null +++ b/idea/testData/android/lintQuickfix/requiresApi/topLevelProperty.kt.as31 @@ -0,0 +1,7 @@ +// INTENTION_TEXT: Add @RequiresApi(M) Annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection +// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java +import android.app.Activity + +val top: Int + get() = Activity().checkSelfPermission(READ_CONTACTS) \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/topLevelProperty.kt.expected.as31 b/idea/testData/android/lintQuickfix/requiresApi/topLevelProperty.kt.expected.as31 new file mode 100644 index 00000000000..01d63d7c860 --- /dev/null +++ b/idea/testData/android/lintQuickfix/requiresApi/topLevelProperty.kt.expected.as31 @@ -0,0 +1,10 @@ +// INTENTION_TEXT: Add @RequiresApi(M) Annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection +// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java +import android.app.Activity +import android.os.Build +import android.support.annotation.RequiresApi + +val top: Int + @RequiresApi(Build.VERSION_CODES.M) + get() = Activity().checkSelfPermission(READ_CONTACTS) \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/when.kt.as31 b/idea/testData/android/lintQuickfix/requiresApi/when.kt.as31 index 71997f75229..0ff7c0cc893 100644 --- a/idea/testData/android/lintQuickfix/requiresApi/when.kt.as31 +++ b/idea/testData/android/lintQuickfix/requiresApi/when.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintNewApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection // DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java import android.graphics.drawable.VectorDrawable diff --git a/idea/testData/android/lintQuickfix/requiresApi/when.kt.expected.as31 b/idea/testData/android/lintQuickfix/requiresApi/when.kt.expected.as31 new file mode 100644 index 00000000000..ce78fc0c8fe --- /dev/null +++ b/idea/testData/android/lintQuickfix/requiresApi/when.kt.expected.as31 @@ -0,0 +1,18 @@ +// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection +// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java + +import android.graphics.drawable.VectorDrawable +import android.os.Build +import android.support.annotation.RequiresApi + +class VectorDrawableProvider { + val flag = false + @RequiresApi(Build.VERSION_CODES.LOLLIPOP) + fun getVectorDrawable(): VectorDrawable { + return when (flag) { + true -> VectorDrawable() + else -> VectorDrawable() + } + } +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/activityMethod.kt.as31 b/idea/testData/android/lintQuickfix/suppressLint/activityMethod.kt.as31 index 7df0f390fd9..02d9669b194 100644 --- a/idea/testData/android/lintQuickfix/suppressLint/activityMethod.kt.as31 +++ b/idea/testData/android/lintQuickfix/suppressLint/activityMethod.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintSdCardPathInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection import android.app.Activity import android.os.Environment diff --git a/idea/testData/android/lintQuickfix/suppressLint/activityMethod.kt.expected.as31 b/idea/testData/android/lintQuickfix/suppressLint/activityMethod.kt.expected.as31 new file mode 100644 index 00000000000..e95b0a1980b --- /dev/null +++ b/idea/testData/android/lintQuickfix/suppressLint/activityMethod.kt.expected.as31 @@ -0,0 +1,12 @@ +// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection + +import android.annotation.SuppressLint +import android.app.Activity +import android.os.Environment + + +class MainActivity : Activity() { + @SuppressLint("SdCardPath") + fun getSdCard(fromEnvironment: Boolean) = if (fromEnvironment) Environment.getExternalStorageDirectory().path else "/sdcard" +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/addToExistingAnnotation.kt.as31 b/idea/testData/android/lintQuickfix/suppressLint/addToExistingAnnotation.kt.as31 index ba329c02661..26adf3d65c7 100644 --- a/idea/testData/android/lintQuickfix/suppressLint/addToExistingAnnotation.kt.as31 +++ b/idea/testData/android/lintQuickfix/suppressLint/addToExistingAnnotation.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintSdCardPathInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection import android.annotation.SuppressLint import android.app.Activity diff --git a/idea/testData/android/lintQuickfix/suppressLint/addToExistingAnnotation.kt.expected.as31 b/idea/testData/android/lintQuickfix/suppressLint/addToExistingAnnotation.kt.expected.as31 new file mode 100644 index 00000000000..45d7bb0130b --- /dev/null +++ b/idea/testData/android/lintQuickfix/suppressLint/addToExistingAnnotation.kt.expected.as31 @@ -0,0 +1,12 @@ +// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection + +import android.annotation.SuppressLint +import android.app.Activity +import android.os.Environment + + +class MainActivity : Activity() { + @SuppressLint("Something", "SdCardPath") + fun getSdCard(fromEnvironment: Boolean) = if (fromEnvironment) Environment.getExternalStorageDirectory().path else "/sdcard" +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/constructorParameter.kt.as31 b/idea/testData/android/lintQuickfix/suppressLint/constructorParameter.kt.as31 index c9669dec932..1d325d1db70 100644 --- a/idea/testData/android/lintQuickfix/suppressLint/constructorParameter.kt.as31 +++ b/idea/testData/android/lintQuickfix/suppressLint/constructorParameter.kt.as31 @@ -1,4 +1,4 @@ // INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintSdCardPathInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection class SdCard(val path: String = "/sdcard") \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/constructorParameter.kt.expected.as31 b/idea/testData/android/lintQuickfix/suppressLint/constructorParameter.kt.expected.as31 new file mode 100644 index 00000000000..8b730ed0777 --- /dev/null +++ b/idea/testData/android/lintQuickfix/suppressLint/constructorParameter.kt.expected.as31 @@ -0,0 +1,6 @@ +import android.annotation.SuppressLint + +// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection + +class SdCard(@SuppressLint("SdCardPath") val path: String = "/sdcard") \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/destructuringDeclaration.kt.as31 b/idea/testData/android/lintQuickfix/suppressLint/destructuringDeclaration.kt.as31 index 0790fafd3f6..6d8e858b66b 100644 --- a/idea/testData/android/lintQuickfix/suppressLint/destructuringDeclaration.kt.as31 +++ b/idea/testData/android/lintQuickfix/suppressLint/destructuringDeclaration.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintSdCardPathInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection fun foo() { val (a: String, b: String) = "/sdcard" diff --git a/idea/testData/android/lintQuickfix/suppressLint/destructuringDeclaration.kt.expected.as31 b/idea/testData/android/lintQuickfix/suppressLint/destructuringDeclaration.kt.expected.as31 new file mode 100644 index 00000000000..7022cdfb459 --- /dev/null +++ b/idea/testData/android/lintQuickfix/suppressLint/destructuringDeclaration.kt.expected.as31 @@ -0,0 +1,12 @@ +import android.annotation.SuppressLint + +// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection + +@SuppressLint("SdCardPath") +fun foo() { + val (a: String, b: String) = "/sdcard" +} + +operator fun CharSequence.component1(): String = "component1" +operator fun CharSequence.component2(): String = "component2" diff --git a/idea/testData/android/lintQuickfix/suppressLint/lambdaArgument.kt.as31 b/idea/testData/android/lintQuickfix/suppressLint/lambdaArgument.kt.as31 index 3e285608023..9da3c3d1779 100644 --- a/idea/testData/android/lintQuickfix/suppressLint/lambdaArgument.kt.as31 +++ b/idea/testData/android/lintQuickfix/suppressLint/lambdaArgument.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintSdCardPathInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection fun foo(l: Any) = l diff --git a/idea/testData/android/lintQuickfix/suppressLint/lambdaArgument.kt.expected.as31 b/idea/testData/android/lintQuickfix/suppressLint/lambdaArgument.kt.expected.as31 new file mode 100644 index 00000000000..db344edeea7 --- /dev/null +++ b/idea/testData/android/lintQuickfix/suppressLint/lambdaArgument.kt.expected.as31 @@ -0,0 +1,13 @@ +import android.annotation.SuppressLint + +// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection + +fun foo(l: Any) = l + +@SuppressLint("SdCardPath") +fun bar() { + foo() { + "/sdcard" + } +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/lambdaArgumentProperty.kt.as31 b/idea/testData/android/lintQuickfix/suppressLint/lambdaArgumentProperty.kt.as31 index 4e880f5fef6..25de06b3bb6 100644 --- a/idea/testData/android/lintQuickfix/suppressLint/lambdaArgumentProperty.kt.as31 +++ b/idea/testData/android/lintQuickfix/suppressLint/lambdaArgumentProperty.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintSdCardPathInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection fun foo(l: Any) = l diff --git a/idea/testData/android/lintQuickfix/suppressLint/lambdaArgumentProperty.kt.expected.as31 b/idea/testData/android/lintQuickfix/suppressLint/lambdaArgumentProperty.kt.expected.as31 new file mode 100644 index 00000000000..617e6b33731 --- /dev/null +++ b/idea/testData/android/lintQuickfix/suppressLint/lambdaArgumentProperty.kt.expected.as31 @@ -0,0 +1,9 @@ +import android.annotation.SuppressLint + +// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection + +fun foo(l: Any) = l + +@SuppressLint("SdCardPath") +val bar = foo() { "/sdcard" } \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/methodParameter.kt.as31 b/idea/testData/android/lintQuickfix/suppressLint/methodParameter.kt.as31 index f9bc3212ec8..9abdb51fd35 100644 --- a/idea/testData/android/lintQuickfix/suppressLint/methodParameter.kt.as31 +++ b/idea/testData/android/lintQuickfix/suppressLint/methodParameter.kt.as31 @@ -1,4 +1,4 @@ // INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintSdCardPathInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection fun foo(path: String = "/sdcard") = path \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/methodParameter.kt.expected.as31 b/idea/testData/android/lintQuickfix/suppressLint/methodParameter.kt.expected.as31 new file mode 100644 index 00000000000..99c23d0552e --- /dev/null +++ b/idea/testData/android/lintQuickfix/suppressLint/methodParameter.kt.expected.as31 @@ -0,0 +1,6 @@ +import android.annotation.SuppressLint + +// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection + +fun foo(@SuppressLint("SdCardPath") path: String = "/sdcard") = path \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/propertyWithLambda.kt.as31 b/idea/testData/android/lintQuickfix/suppressLint/propertyWithLambda.kt.as31 index 529015f3f18..b8f5cdf95e0 100644 --- a/idea/testData/android/lintQuickfix/suppressLint/propertyWithLambda.kt.as31 +++ b/idea/testData/android/lintQuickfix/suppressLint/propertyWithLambda.kt.as31 @@ -1,4 +1,4 @@ // INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintSdCardPathInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection val getPath = { "/sdcard" } \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/propertyWithLambda.kt.expected.as31 b/idea/testData/android/lintQuickfix/suppressLint/propertyWithLambda.kt.expected.as31 new file mode 100644 index 00000000000..8f4ef7d5ea3 --- /dev/null +++ b/idea/testData/android/lintQuickfix/suppressLint/propertyWithLambda.kt.expected.as31 @@ -0,0 +1,7 @@ +import android.annotation.SuppressLint + +// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection + +@SuppressLint("SdCardPath") +val getPath = { "/sdcard" } \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/simpleProperty.kt.as31 b/idea/testData/android/lintQuickfix/suppressLint/simpleProperty.kt.as31 index a9ff8da9c33..335913d069c 100644 --- a/idea/testData/android/lintQuickfix/suppressLint/simpleProperty.kt.as31 +++ b/idea/testData/android/lintQuickfix/suppressLint/simpleProperty.kt.as31 @@ -1,4 +1,4 @@ // INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintSdCardPathInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection val path = "/sdcard" \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/simpleProperty.kt.expected.as31 b/idea/testData/android/lintQuickfix/suppressLint/simpleProperty.kt.expected.as31 new file mode 100644 index 00000000000..9fc27e6b7dc --- /dev/null +++ b/idea/testData/android/lintQuickfix/suppressLint/simpleProperty.kt.expected.as31 @@ -0,0 +1,7 @@ +import android.annotation.SuppressLint + +// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection + +@SuppressLint("SdCardPath") +val path = "/sdcard" \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/annotation.kt.as31 b/idea/testData/android/lintQuickfix/targetApi/annotation.kt.as31 index ceceadd4e83..e9431202f81 100644 --- a/idea/testData/android/lintQuickfix/targetApi/annotation.kt.as31 +++ b/idea/testData/android/lintQuickfix/targetApi/annotation.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintNewApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection import android.graphics.drawable.VectorDrawable import kotlin.reflect.KClass diff --git a/idea/testData/android/lintQuickfix/targetApi/annotation.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetApi/annotation.kt.expected.as31 new file mode 100644 index 00000000000..0a51e121500 --- /dev/null +++ b/idea/testData/android/lintQuickfix/targetApi/annotation.kt.expected.as31 @@ -0,0 +1,14 @@ +// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection + +import android.annotation.TargetApi +import android.graphics.drawable.VectorDrawable +import android.os.Build +import kotlin.reflect.KClass + +annotation class SomeAnnotationWithClass(val cls: KClass<*>) + +@TargetApi(Build.VERSION_CODES.LOLLIPOP) +@SomeAnnotationWithClass(VectorDrawable::class) +class VectorDrawableProvider { +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/companion.kt.as31 b/idea/testData/android/lintQuickfix/targetApi/companion.kt.as31 index 6ecbaca7297..d0dd43774c8 100644 --- a/idea/testData/android/lintQuickfix/targetApi/companion.kt.as31 +++ b/idea/testData/android/lintQuickfix/targetApi/companion.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintNewApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection import android.graphics.drawable.VectorDrawable diff --git a/idea/testData/android/lintQuickfix/targetApi/companion.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetApi/companion.kt.expected.as31 new file mode 100644 index 00000000000..ae413f19a2a --- /dev/null +++ b/idea/testData/android/lintQuickfix/targetApi/companion.kt.expected.as31 @@ -0,0 +1,13 @@ +// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection + +import android.annotation.TargetApi +import android.graphics.drawable.VectorDrawable +import android.os.Build + +class VectorDrawableProvider { + @TargetApi(Build.VERSION_CODES.LOLLIPOP) + companion object { + val VECTOR_DRAWABLE = VectorDrawable() + } +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/defaultParameter.kt.as31 b/idea/testData/android/lintQuickfix/targetApi/defaultParameter.kt.as31 index 673405e5810..441ac662838 100644 --- a/idea/testData/android/lintQuickfix/targetApi/defaultParameter.kt.as31 +++ b/idea/testData/android/lintQuickfix/targetApi/defaultParameter.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintNewApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection import android.graphics.drawable.VectorDrawable diff --git a/idea/testData/android/lintQuickfix/targetApi/defaultParameter.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetApi/defaultParameter.kt.expected.as31 new file mode 100644 index 00000000000..4a7ffec0d23 --- /dev/null +++ b/idea/testData/android/lintQuickfix/targetApi/defaultParameter.kt.expected.as31 @@ -0,0 +1,12 @@ +// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection + +import android.annotation.TargetApi +import android.graphics.drawable.VectorDrawable +import android.os.Build + + +@TargetApi(Build.VERSION_CODES.LOLLIPOP) +fun withDefaultParameter(vector: VectorDrawable = VectorDrawable()) { + +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/extend.kt.as31 b/idea/testData/android/lintQuickfix/targetApi/extend.kt.as31 index 0c26fe23373..8e49ae1bd73 100644 --- a/idea/testData/android/lintQuickfix/targetApi/extend.kt.as31 +++ b/idea/testData/android/lintQuickfix/targetApi/extend.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintNewApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection import android.graphics.drawable.VectorDrawable diff --git a/idea/testData/android/lintQuickfix/targetApi/extend.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetApi/extend.kt.expected.as31 new file mode 100644 index 00000000000..7a1cd362baa --- /dev/null +++ b/idea/testData/android/lintQuickfix/targetApi/extend.kt.expected.as31 @@ -0,0 +1,11 @@ +// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection + +import android.annotation.TargetApi +import android.graphics.drawable.VectorDrawable +import android.os.Build + +@TargetApi(Build.VERSION_CODES.LOLLIPOP) +class MyVectorDrawable : VectorDrawable() { + +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/functionLiteral.kt.as31 b/idea/testData/android/lintQuickfix/targetApi/functionLiteral.kt.as31 index a4c3c4117af..321913b70a9 100644 --- a/idea/testData/android/lintQuickfix/targetApi/functionLiteral.kt.as31 +++ b/idea/testData/android/lintQuickfix/targetApi/functionLiteral.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintNewApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection import android.graphics.drawable.VectorDrawable diff --git a/idea/testData/android/lintQuickfix/targetApi/functionLiteral.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetApi/functionLiteral.kt.expected.as31 new file mode 100644 index 00000000000..b99ca947fb6 --- /dev/null +++ b/idea/testData/android/lintQuickfix/targetApi/functionLiteral.kt.expected.as31 @@ -0,0 +1,15 @@ +// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection + +import android.annotation.TargetApi +import android.graphics.drawable.VectorDrawable +import android.os.Build + +class VectorDrawableProvider { + @TargetApi(Build.VERSION_CODES.LOLLIPOP) + fun getVectorDrawable(): VectorDrawable { + with(this) { + return VectorDrawable() + } + } +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/inlinedConstant.kt.as31 b/idea/testData/android/lintQuickfix/targetApi/inlinedConstant.kt.as31 index 45fb5d2be16..8b233964e07 100644 --- a/idea/testData/android/lintQuickfix/targetApi/inlinedConstant.kt.as31 +++ b/idea/testData/android/lintQuickfix/targetApi/inlinedConstant.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Add @TargetApi(KITKAT) Annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintInlinedApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintInlinedApiInspection class Test { fun foo(): Int { diff --git a/idea/testData/android/lintQuickfix/targetApi/inlinedConstant.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetApi/inlinedConstant.kt.expected.as31 new file mode 100644 index 00000000000..84d86bc3776 --- /dev/null +++ b/idea/testData/android/lintQuickfix/targetApi/inlinedConstant.kt.expected.as31 @@ -0,0 +1,12 @@ +import android.annotation.TargetApi +import android.os.Build + +// INTENTION_TEXT: Add @TargetApi(KITKAT) Annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintInlinedApiInspection + +class Test { + @TargetApi(Build.VERSION_CODES.KITKAT) + fun foo(): Int { + return android.R.attr.windowTranslucentStatus + } +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/method.kt.as31 b/idea/testData/android/lintQuickfix/targetApi/method.kt.as31 index aeac2f99d03..89acdda7b32 100644 --- a/idea/testData/android/lintQuickfix/targetApi/method.kt.as31 +++ b/idea/testData/android/lintQuickfix/targetApi/method.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintNewApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection import android.graphics.drawable.VectorDrawable diff --git a/idea/testData/android/lintQuickfix/targetApi/method.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetApi/method.kt.expected.as31 new file mode 100644 index 00000000000..7f10d4b9893 --- /dev/null +++ b/idea/testData/android/lintQuickfix/targetApi/method.kt.expected.as31 @@ -0,0 +1,13 @@ +// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection + +import android.annotation.TargetApi +import android.graphics.drawable.VectorDrawable +import android.os.Build + +class VectorDrawableProvider { + @TargetApi(Build.VERSION_CODES.LOLLIPOP) + fun getVectorDrawable(): VectorDrawable { + return VectorDrawable() + } +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/property.kt.as31 b/idea/testData/android/lintQuickfix/targetApi/property.kt.as31 index 7418db232d1..2b2077c72bf 100644 --- a/idea/testData/android/lintQuickfix/targetApi/property.kt.as31 +++ b/idea/testData/android/lintQuickfix/targetApi/property.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintNewApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection import android.graphics.drawable.VectorDrawable diff --git a/idea/testData/android/lintQuickfix/targetApi/property.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetApi/property.kt.expected.as31 new file mode 100644 index 00000000000..2103b804754 --- /dev/null +++ b/idea/testData/android/lintQuickfix/targetApi/property.kt.expected.as31 @@ -0,0 +1,11 @@ +// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection + +import android.annotation.TargetApi +import android.graphics.drawable.VectorDrawable +import android.os.Build + +@TargetApi(Build.VERSION_CODES.LOLLIPOP) +class VectorDrawableProvider { + val VECTOR_DRAWABLE = VectorDrawable() +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/topLevelProperty.kt.as31 b/idea/testData/android/lintQuickfix/targetApi/topLevelProperty.kt.as31 new file mode 100644 index 00000000000..1997b7fc223 --- /dev/null +++ b/idea/testData/android/lintQuickfix/targetApi/topLevelProperty.kt.as31 @@ -0,0 +1,6 @@ +// INTENTION_TEXT: Add @TargetApi(M) Annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection +import android.app.Activity + +val top: Int + get() = Activity().checkSelfPermission(READ_CONTACTS) \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/topLevelProperty.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetApi/topLevelProperty.kt.expected.as31 new file mode 100644 index 00000000000..ce8347f83f9 --- /dev/null +++ b/idea/testData/android/lintQuickfix/targetApi/topLevelProperty.kt.expected.as31 @@ -0,0 +1,9 @@ +// INTENTION_TEXT: Add @TargetApi(M) Annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection +import android.annotation.TargetApi +import android.app.Activity +import android.os.Build + +val top: Int + @TargetApi(Build.VERSION_CODES.M) + get() = Activity().checkSelfPermission(READ_CONTACTS) \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/when.kt.as31 b/idea/testData/android/lintQuickfix/targetApi/when.kt.as31 index df92ce5d786..b5a33d8e356 100644 --- a/idea/testData/android/lintQuickfix/targetApi/when.kt.as31 +++ b/idea/testData/android/lintQuickfix/targetApi/when.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintNewApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection import android.graphics.drawable.VectorDrawable diff --git a/idea/testData/android/lintQuickfix/targetApi/when.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetApi/when.kt.expected.as31 new file mode 100644 index 00000000000..275e59c2bbe --- /dev/null +++ b/idea/testData/android/lintQuickfix/targetApi/when.kt.expected.as31 @@ -0,0 +1,17 @@ +// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection + +import android.annotation.TargetApi +import android.graphics.drawable.VectorDrawable +import android.os.Build + +class VectorDrawableProvider { + val flag = false + @TargetApi(Build.VERSION_CODES.LOLLIPOP) + fun getVectorDrawable(): VectorDrawable { + return when (flag) { + true -> VectorDrawable() + else -> VectorDrawable() + } + } +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/annotation.kt.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/annotation.kt.as31 index 31fed0067bd..ff3f7cbec75 100644 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/annotation.kt.as31 +++ b/idea/testData/android/lintQuickfix/targetVersionCheck/annotation.kt.as31 @@ -1,6 +1,6 @@ // INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } // INTENTION_NOT_AVAILABLE -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintNewApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection import android.graphics.drawable.VectorDrawable import kotlin.reflect.KClass diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/defaultParameter.kt.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/defaultParameter.kt.as31 index f448c22496f..6169b9947a8 100644 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/defaultParameter.kt.as31 +++ b/idea/testData/android/lintQuickfix/targetVersionCheck/defaultParameter.kt.as31 @@ -1,6 +1,6 @@ // INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } // INTENTION_NOT_AVAILABLE -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintNewApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection import android.graphics.drawable.VectorDrawable diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/destructuringDeclaration.kt.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/destructuringDeclaration.kt.as31 new file mode 100644 index 00000000000..ec9f278cf18 --- /dev/null +++ b/idea/testData/android/lintQuickfix/targetVersionCheck/destructuringDeclaration.kt.as31 @@ -0,0 +1,12 @@ +// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection + +import android.app.Activity +import android.graphics.drawable.VectorDrawable + +data class ValueProvider(var p1: VectorDrawable, val p2: Int) + +val activity = Activity() +fun foo() { + val (v1, v2) = ValueProvider(VectorDrawable(), 0) +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/destructuringDeclaration.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/destructuringDeclaration.kt.expected.as31 new file mode 100644 index 00000000000..23ea52ab746 --- /dev/null +++ b/idea/testData/android/lintQuickfix/targetVersionCheck/destructuringDeclaration.kt.expected.as31 @@ -0,0 +1,17 @@ +// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection + +import android.app.Activity +import android.graphics.drawable.VectorDrawable +import android.os.Build + +data class ValueProvider(var p1: VectorDrawable, val p2: Int) + +val activity = Activity() +fun foo() { + val (v1, v2) = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + ValueProvider(VectorDrawable(), 0) + } else { + TODO("VERSION.SDK_INT < LOLLIPOP") + } +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/expressionBody.kt.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/expressionBody.kt.as31 index dd8fe5b6d81..e3b7139ae3c 100644 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/expressionBody.kt.as31 +++ b/idea/testData/android/lintQuickfix/targetVersionCheck/expressionBody.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintNewApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection import android.graphics.drawable.VectorDrawable diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/expressionBody.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/expressionBody.kt.expected.as31 new file mode 100644 index 00000000000..4dfc08cfb66 --- /dev/null +++ b/idea/testData/android/lintQuickfix/targetVersionCheck/expressionBody.kt.expected.as31 @@ -0,0 +1,13 @@ +// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection + +import android.graphics.drawable.VectorDrawable +import android.os.Build + +class VectorDrawableProvider { + fun getVectorDrawable(): VectorDrawable = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + VectorDrawable() + } else { + TODO("VERSION.SDK_INT < LOLLIPOP") + } +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/functionLiteral.kt.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/functionLiteral.kt.as31 index 17633e8f5a4..403f79dd79a 100644 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/functionLiteral.kt.as31 +++ b/idea/testData/android/lintQuickfix/targetVersionCheck/functionLiteral.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintNewApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection import android.graphics.drawable.VectorDrawable diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/functionLiteral.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/functionLiteral.kt.expected.as31 new file mode 100644 index 00000000000..09a525dbc6b --- /dev/null +++ b/idea/testData/android/lintQuickfix/targetVersionCheck/functionLiteral.kt.expected.as31 @@ -0,0 +1,17 @@ +// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection + +import android.graphics.drawable.VectorDrawable +import android.os.Build + +class VectorDrawableProvider { + fun getVectorDrawable(): VectorDrawable { + with(this) { + return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + VectorDrawable() + } else { + TODO("VERSION.SDK_INT < LOLLIPOP") + } + } + } +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/getterWIthExpressionBody.kt.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/getterWIthExpressionBody.kt.as31 new file mode 100644 index 00000000000..7ba6b98af31 --- /dev/null +++ b/idea/testData/android/lintQuickfix/targetVersionCheck/getterWIthExpressionBody.kt.as31 @@ -0,0 +1,7 @@ +// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection + +import android.graphics.drawable.VectorDrawable + +val v: VectorDrawable + get() = VectorDrawable() \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/getterWIthExpressionBody.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/getterWIthExpressionBody.kt.expected.as31 new file mode 100644 index 00000000000..ed06e869036 --- /dev/null +++ b/idea/testData/android/lintQuickfix/targetVersionCheck/getterWIthExpressionBody.kt.expected.as31 @@ -0,0 +1,12 @@ +// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection + +import android.graphics.drawable.VectorDrawable +import android.os.Build + +val v: VectorDrawable + get() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + VectorDrawable() + } else { + TODO("VERSION.SDK_INT < LOLLIPOP") + } \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/if.kt.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/if.kt.as31 index 40876545dfd..e0224b675e4 100644 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/if.kt.as31 +++ b/idea/testData/android/lintQuickfix/targetVersionCheck/if.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintNewApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection import android.graphics.drawable.VectorDrawable diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/if.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/if.kt.expected.as31 new file mode 100644 index 00000000000..be38a41256b --- /dev/null +++ b/idea/testData/android/lintQuickfix/targetVersionCheck/if.kt.expected.as31 @@ -0,0 +1,17 @@ +// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection + +import android.graphics.drawable.VectorDrawable +import android.os.Build + +class VectorDrawableProvider { + val flag = false + fun getVectorDrawable(): VectorDrawable { + if (flag) + return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + VectorDrawable() + } else { + TODO("VERSION.SDK_INT < LOLLIPOP") + } + } +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/ifWithBlock.kt.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/ifWithBlock.kt.as31 index 0e6ba0ff2c6..e2f2a4f0ac1 100644 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/ifWithBlock.kt.as31 +++ b/idea/testData/android/lintQuickfix/targetVersionCheck/ifWithBlock.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintNewApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection import android.graphics.drawable.VectorDrawable diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/ifWithBlock.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/ifWithBlock.kt.expected.as31 new file mode 100644 index 00000000000..bda925fbbf2 --- /dev/null +++ b/idea/testData/android/lintQuickfix/targetVersionCheck/ifWithBlock.kt.expected.as31 @@ -0,0 +1,18 @@ +// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection + +import android.graphics.drawable.VectorDrawable +import android.os.Build + +class VectorDrawableProvider { + val flag = false + fun getVectorDrawable(): VectorDrawable { + if (flag) { + return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + VectorDrawable() + } else { + TODO("VERSION.SDK_INT < LOLLIPOP") + } + } + } +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/inlinedConstant.kt.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/inlinedConstant.kt.as31 index 64281cde0ea..9c9bf6d37a7 100644 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/inlinedConstant.kt.as31 +++ b/idea/testData/android/lintQuickfix/targetVersionCheck/inlinedConstant.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.KITKAT) { ... } -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintInlinedApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintInlinedApiInspection class Test { fun foo(): Int { diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/inlinedConstant.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/inlinedConstant.kt.expected.as31 new file mode 100644 index 00000000000..b4d5931c5c8 --- /dev/null +++ b/idea/testData/android/lintQuickfix/targetVersionCheck/inlinedConstant.kt.expected.as31 @@ -0,0 +1,14 @@ +import android.os.Build + +// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.KITKAT) { ... } +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintInlinedApiInspection + +class Test { + fun foo(): Int { + return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + android.R.attr.windowTranslucentStatus + } else { + TODO("VERSION.SDK_INT < KITKAT") + } + } +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/method.kt.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/method.kt.as31 index f0ad689051a..49ac9188e6b 100644 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/method.kt.as31 +++ b/idea/testData/android/lintQuickfix/targetVersionCheck/method.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintNewApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection import android.graphics.drawable.VectorDrawable diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/method.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/method.kt.expected.as31 new file mode 100644 index 00000000000..531645ed71c --- /dev/null +++ b/idea/testData/android/lintQuickfix/targetVersionCheck/method.kt.expected.as31 @@ -0,0 +1,15 @@ +// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection + +import android.graphics.drawable.VectorDrawable +import android.os.Build + +class VectorDrawableProvider { + fun getVectorDrawable(): VectorDrawable { + return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + VectorDrawable() + } else { + TODO("VERSION.SDK_INT < LOLLIPOP") + } + } +} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/when.kt.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/when.kt.as31 index 5a00d1882f5..b12f04272fc 100644 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/when.kt.as31 +++ b/idea/testData/android/lintQuickfix/targetVersionCheck/when.kt.as31 @@ -1,5 +1,5 @@ // INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } -// INSPECTION_CLASS: org.jetbrains.android.inspections.lint.AndroidLintInspectionToolProvider$AndroidLintNewApiInspection +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection import android.graphics.drawable.VectorDrawable diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/when.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/when.kt.expected.as31 new file mode 100644 index 00000000000..e52140da298 --- /dev/null +++ b/idea/testData/android/lintQuickfix/targetVersionCheck/when.kt.expected.as31 @@ -0,0 +1,19 @@ +// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } +// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection + +import android.graphics.drawable.VectorDrawable +import android.os.Build + +class VectorDrawableProvider { + val flag = false + fun getVectorDrawable(): VectorDrawable { + return when (flag) { + true -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + VectorDrawable() + } else { + TODO("VERSION.SDK_INT < LOLLIPOP") + } + else -> VectorDrawable() + } + } +} \ No newline at end of file