Implement quickfixes for Android Lint api issues

#KT-16624 Fixed
#KT-16625 Fixed
#KT-14947 Fixed
This commit is contained in:
Vyacheslav Gerasimov
2017-03-03 16:12:54 +03:00
parent a907ec92b5
commit 1376c8f8cf
178 changed files with 1307 additions and 221 deletions
@@ -0,0 +1,12 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INTENTION_NOT_AVAILABLE
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
import kotlin.reflect.KClass
annotation class SomeAnnotationWithClass(val cls: KClass<*>)
@SomeAnnotationWithClass(<caret>VectorDrawable::class)
class VectorDrawableProvider {
}
@@ -0,0 +1,10 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INTENTION_NOT_AVAILABLE
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
fun withDefaultParameter(vector: VectorDrawable = <caret>VectorDrawable()) {
}
@@ -0,0 +1,8 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
class VectorDrawableProvider {
fun getVectorDrawable(): VectorDrawable = <caret>VectorDrawable()
}
@@ -0,0 +1,11 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
import android.os.Build
class VectorDrawableProvider {
fun getVectorDrawable(): VectorDrawable = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
VectorDrawable()
}
}
@@ -0,0 +1,12 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
class VectorDrawableProvider {
fun getVectorDrawable(): VectorDrawable {
with(this) {
return <caret>VectorDrawable()
}
}
}
@@ -0,0 +1,15 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
import android.os.Build
class VectorDrawableProvider {
fun getVectorDrawable(): VectorDrawable {
with(this) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return VectorDrawable()
}
}
}
}
@@ -0,0 +1,12 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
class VectorDrawableProvider {
val flag = false
fun getVectorDrawable(): VectorDrawable {
if (flag)
return <caret>VectorDrawable()
}
}
@@ -0,0 +1,15 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
import android.os.Build
class VectorDrawableProvider {
val flag = false
fun getVectorDrawable(): VectorDrawable {
if (flag)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return VectorDrawable()
}
}
}
@@ -0,0 +1,13 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
class VectorDrawableProvider {
val flag = false
fun getVectorDrawable(): VectorDrawable {
if (flag) {
return <caret>VectorDrawable()
}
}
}
@@ -0,0 +1,16 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
import android.os.Build
class VectorDrawableProvider {
val flag = false
fun getVectorDrawable(): VectorDrawable {
if (flag) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return VectorDrawable()
}
}
}
}
@@ -0,0 +1,10 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
class VectorDrawableProvider {
fun getVectorDrawable(): VectorDrawable {
return <caret>VectorDrawable()
}
}
@@ -0,0 +1,13 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
import android.os.Build
class VectorDrawableProvider {
fun getVectorDrawable(): VectorDrawable {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return VectorDrawable()
}
}
}
@@ -0,0 +1,14 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
import android.graphics.drawable.VectorDrawable
class VectorDrawableProvider {
val flag = false
fun getVectorDrawable(): VectorDrawable {
return when (flag) {
true -> <caret>VectorDrawable()
else -> VectorDrawable()
}
}
}
@@ -0,0 +1,17 @@
// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... }
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
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 -> VectorDrawable()
}
}
}