as31: Fix test data for android lint based tests for AS 3.0

This commit is contained in:
Vyacheslav Gerasimov
2017-10-23 18:03:24 +03:00
committed by Nikolay Krasko
parent e12e63572c
commit 4c498b004f
83 changed files with 650 additions and 38 deletions
+36
View File
@@ -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
<error descr="Invalid range: the `from` attribute must be less than the `to` attribute">@IntRange(from = 10, to = 0)</error>
fun invalidRange1a(): Int = 5
@IntRange(from = constantVal, to = 10) // ok
fun invalidRange0b(): Int = 5
<error descr="Invalid range: the `from` attribute must be less than the `to` attribute">@IntRange(from = 10, to = constantVal)</error>
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
<error descr="Only specify one of `value`, `anyOf` or `allOf`">@RequiresPermission(
value = Manifest.permission.ACCESS_CHECKIN_PROPERTIES,
anyOf = arrayOf(Manifest.permission.ACCESS_CHECKIN_PROPERTIES, Manifest.permission.ACCESS_FINE_LOCATION))</error>
fun needsPermissions3() { }
@@ -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
@@ -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<MissingCreator> {
override fun createFromParcel(parcel: Parcel): MissingCreator {
return MissingCreator(parcel)
}
override fun newArray(size: Int): Array<MissingCreator?> {
return arrayOfNulls(size)
}
}
}
@@ -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 <caret>NoImplementation : Parcelable
@@ -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<NoImplementation> {
override fun createFromParcel(parcel: Parcel): NoImplementation {
return NoImplementation(parcel)
}
override fun newArray(size: Int): Array<NoImplementation?> {
return arrayOfNulls(size)
}
}
}
@@ -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
@@ -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 {
}
@@ -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
@@ -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()
}
}
@@ -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
@@ -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()) {
}
@@ -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
@@ -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() {
}
@@ -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
@@ -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()
}
}
}
@@ -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 {
@@ -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
}
}
@@ -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
@@ -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()
}
}
@@ -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
@@ -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()
}
@@ -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().<caret>checkSelfPermission(READ_CONTACTS)
@@ -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)
@@ -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
@@ -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()
}
}
}
@@ -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
@@ -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"
}
@@ -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
@@ -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"
}
@@ -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 = "<caret>/sdcard")
@@ -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")
@@ -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) = "<caret>/sdcard"
@@ -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"
@@ -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
@@ -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() {
"<caret>/sdcard"
}
}
@@ -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
@@ -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" }
@@ -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 = "<caret>/sdcard") = path
@@ -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
@@ -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 = { "<caret>/sdcard" }
@@ -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" }
@@ -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 = "<caret>/sdcard"
@@ -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"
@@ -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
@@ -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 {
}
@@ -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
@@ -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()
}
}
@@ -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
@@ -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()) {
}
@@ -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
@@ -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() {
}
@@ -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
@@ -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()
}
}
}
@@ -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 {
@@ -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
}
}
@@ -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
@@ -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()
}
}
@@ -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
@@ -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()
}
@@ -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().<caret>checkSelfPermission(READ_CONTACTS)
@@ -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)
+1 -1
View File
@@ -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
@@ -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()
}
}
}
@@ -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
@@ -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
@@ -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(<caret>VectorDrawable(), 0)
}
@@ -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")
}
}
@@ -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
@@ -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")
}
}
@@ -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
@@ -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")
}
}
}
}
@@ -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() = <caret>VectorDrawable()
@@ -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")
}
@@ -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
@@ -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")
}
}
}
@@ -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
@@ -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")
}
}
}
}
@@ -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 {
@@ -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")
}
}
}
@@ -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
@@ -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")
}
}
}
@@ -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
@@ -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()
}
}
}