Implement quickfixes for Android Lint api issues
#KT-16624 Fixed #KT-16625 Fixed #KT-14947 Fixed
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.CONSTRUCTOR;
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
import static java.lang.annotation.ElementType.METHOD;
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that the annotated element should only be called on the given API level
|
||||
* or higher.
|
||||
* <p>
|
||||
* This is similar in purpose to the older {@code @TargetApi} annotation, but more
|
||||
* clearly expresses that this is a requirement on the caller, rather than being
|
||||
* used to "suppress" warnings within the method that exceed the {@code minSdkVersion}.
|
||||
*/
|
||||
@Retention(CLASS)
|
||||
@Target({TYPE,METHOD,CONSTRUCTOR,FIELD})
|
||||
public @interface RequiresApi {
|
||||
/**
|
||||
* The API level to require. Alias for {@link #api} which allows you to leave out the
|
||||
* {@code api=} part.
|
||||
*/
|
||||
@IntRange(from=1)
|
||||
int value() default 1;
|
||||
|
||||
/** The API level to require */
|
||||
@IntRange(from=1)
|
||||
int api() default 1;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java
|
||||
|
||||
import android.graphics.drawable.VectorDrawable
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
annotation class SomeAnnotationWithClass(val cls: KClass<*>)
|
||||
|
||||
@SomeAnnotationWithClass(<caret>VectorDrawable::class)
|
||||
class VectorDrawableProvider {
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
// 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 {
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java
|
||||
|
||||
import android.graphics.drawable.VectorDrawable
|
||||
|
||||
class VectorDrawableProvider {
|
||||
companion object {
|
||||
val VECTOR_DRAWABLE = <caret>VectorDrawable()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
// 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()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java
|
||||
|
||||
import android.graphics.drawable.VectorDrawable
|
||||
|
||||
|
||||
fun withDefaultParameter(vector: VectorDrawable = <caret>VectorDrawable()) {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
// 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()) {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java
|
||||
|
||||
import android.graphics.drawable.VectorDrawable
|
||||
|
||||
class MyVectorDrawable : <caret>VectorDrawable() {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
// 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() {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java
|
||||
|
||||
import android.graphics.drawable.VectorDrawable
|
||||
|
||||
class VectorDrawableProvider {
|
||||
fun getVectorDrawable(): VectorDrawable {
|
||||
with(this) {
|
||||
return <caret>VectorDrawable()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
// 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()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java
|
||||
|
||||
import android.graphics.drawable.VectorDrawable
|
||||
|
||||
class VectorDrawableProvider {
|
||||
fun getVectorDrawable(): VectorDrawable {
|
||||
return <caret>VectorDrawable()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
// 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()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java
|
||||
|
||||
import android.graphics.drawable.VectorDrawable
|
||||
|
||||
class VectorDrawableProvider {
|
||||
val VECTOR_DRAWABLE = <caret>VectorDrawable()
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
// 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,15 @@
|
||||
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java
|
||||
|
||||
import android.graphics.drawable.VectorDrawable
|
||||
|
||||
class VectorDrawableProvider {
|
||||
val flag = false
|
||||
fun getVectorDrawable(): VectorDrawable {
|
||||
return when (flag) {
|
||||
true -> <caret>VectorDrawable()
|
||||
else -> VectorDrawable()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
// 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()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintSdCardPathInspection
|
||||
|
||||
import android.app.Activity
|
||||
import android.os.Environment
|
||||
|
||||
|
||||
class MainActivity : Activity() {
|
||||
fun getSdCard(fromEnvironment: Boolean) = if (fromEnvironment) Environment.getExternalStorageDirectory().path else "<caret>/sdcard"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintSdCardPathInspection
|
||||
|
||||
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"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintSdCardPathInspection
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.os.Environment
|
||||
|
||||
|
||||
class MainActivity : Activity() {
|
||||
@SuppressLint("Something")
|
||||
fun getSdCard(fromEnvironment: Boolean) = if (fromEnvironment) Environment.getExternalStorageDirectory().path else "<caret>/sdcard"
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintSdCardPathInspection
|
||||
|
||||
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"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintSdCardPathInspection
|
||||
|
||||
class SdCard(val path: String = "<caret>/sdcard")
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
import android.annotation.SuppressLint
|
||||
|
||||
// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintSdCardPathInspection
|
||||
|
||||
class SdCard(@SuppressLint("SdCardPath") val path: String = "/sdcard")
|
||||
@@ -0,0 +1,9 @@
|
||||
// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintSdCardPathInspection
|
||||
|
||||
fun foo() {
|
||||
val (a: String, b: String) = "<caret>/sdcard"
|
||||
}
|
||||
|
||||
operator fun CharSequence.component1(): String = "component1"
|
||||
operator fun CharSequence.component2(): String = "component2"
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
import android.annotation.SuppressLint
|
||||
|
||||
// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintSdCardPathInspection
|
||||
|
||||
@SuppressLint("SdCardPath")
|
||||
fun foo() {
|
||||
val (a: String, b: String) = "/sdcard"
|
||||
}
|
||||
|
||||
operator fun CharSequence.component1(): String = "component1"
|
||||
operator fun CharSequence.component2(): String = "component2"
|
||||
@@ -0,0 +1,10 @@
|
||||
// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintSdCardPathInspection
|
||||
|
||||
fun foo(l: Any) = l
|
||||
|
||||
fun bar() {
|
||||
foo() {
|
||||
"<caret>/sdcard"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import android.annotation.SuppressLint
|
||||
|
||||
// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintSdCardPathInspection
|
||||
|
||||
fun foo(l: Any) = l
|
||||
|
||||
@SuppressLint("SdCardPath")
|
||||
fun bar() {
|
||||
foo() {
|
||||
"<caret>/sdcard"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintSdCardPathInspection
|
||||
|
||||
fun foo(l: Any) = l
|
||||
|
||||
val bar = foo() { "<caret>/sdcard" }
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import android.annotation.SuppressLint
|
||||
|
||||
// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintSdCardPathInspection
|
||||
|
||||
fun foo(l: Any) = l
|
||||
|
||||
@SuppressLint("SdCardPath")
|
||||
val bar = foo() { "/sdcard" }
|
||||
@@ -0,0 +1,4 @@
|
||||
// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintSdCardPathInspection
|
||||
|
||||
fun foo(path: String = "<caret>/sdcard") = path
|
||||
@@ -0,0 +1,6 @@
|
||||
import android.annotation.SuppressLint
|
||||
|
||||
// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintSdCardPathInspection
|
||||
|
||||
fun foo(@SuppressLint("SdCardPath") path: String = "/sdcard") = path
|
||||
@@ -0,0 +1,4 @@
|
||||
// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintSdCardPathInspection
|
||||
|
||||
val getPath = { "<caret>/sdcard" }
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import android.annotation.SuppressLint
|
||||
|
||||
// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintSdCardPathInspection
|
||||
|
||||
@SuppressLint("SdCardPath")
|
||||
val getPath = { "/sdcard" }
|
||||
@@ -0,0 +1,4 @@
|
||||
// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintSdCardPathInspection
|
||||
|
||||
val path = "<caret>/sdcard"
|
||||
@@ -0,0 +1,7 @@
|
||||
import android.annotation.SuppressLint
|
||||
|
||||
// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintSdCardPathInspection
|
||||
|
||||
@SuppressLint("SdCardPath")
|
||||
val path = "/sdcard"
|
||||
@@ -0,0 +1,11 @@
|
||||
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
|
||||
// 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,14 @@
|
||||
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
|
||||
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 {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
|
||||
import android.graphics.drawable.VectorDrawable
|
||||
|
||||
class VectorDrawableProvider {
|
||||
companion object {
|
||||
val VECTOR_DRAWABLE = <caret>VectorDrawable()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
|
||||
import android.graphics.drawable.VectorDrawable
|
||||
|
||||
|
||||
fun withDefaultParameter(vector: VectorDrawable = <caret>VectorDrawable()) {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
|
||||
import android.annotation.TargetApi
|
||||
import android.graphics.drawable.VectorDrawable
|
||||
import android.os.Build
|
||||
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
fun withDefaultParameter(vector: VectorDrawable = VectorDrawable()) {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
|
||||
import android.graphics.drawable.VectorDrawable
|
||||
|
||||
class MyVectorDrawable : <caret>VectorDrawable() {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
|
||||
import android.annotation.TargetApi
|
||||
import android.graphics.drawable.VectorDrawable
|
||||
import android.os.Build
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
class MyVectorDrawable : VectorDrawable() {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
|
||||
// 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: Add @TargetApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
|
||||
// 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: Add @TargetApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
|
||||
import android.graphics.drawable.VectorDrawable
|
||||
|
||||
class VectorDrawableProvider {
|
||||
val VECTOR_DRAWABLE = <caret>VectorDrawable()
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
|
||||
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,14 @@
|
||||
// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation
|
||||
// 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: Add @TargetApi(LOLLIPOP) Annotation
|
||||
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
+11
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user