Files
kotlin-fork/idea/testData/android/lint/wrongAnnotation.kt
T
Vyacheslav Gerasimov d90ec3e777 Fixed KotlinLintTestGenerated.testJavaPerformance + refactoring
Moved android lint tests from uast-kotlin to idea-android
2016-11-16 18:05:09 +03:00

40 lines
1.3 KiB
Kotlin
Vendored

// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintLocalSuppressInspection
import android.annotation.SuppressLint
import android.view.View
@Suppress("UsePropertyAccessSyntax", "UNUSED_VARIABLE", "unused", "UNUSED_PARAMETER", "DEPRECATION")
class WrongAnnotation2 {
@SuppressLint("NewApi")
private val field1: Int = 0
@SuppressLint("NewApi")
private val field2 = 5
companion object {
@SuppressLint("NewApi") // Valid: class-file check on method
fun foobar(view: View, @SuppressLint("NewApi") foo: Int) {
// Invalid: class-file check
@SuppressLint("NewApi") // Invalid
val a: Boolean
@SuppressLint("SdCardPath", "NewApi") // Invalid: class-file based check on local variable
val b: Boolean
@android.annotation.SuppressLint("SdCardPath", "NewApi") // Invalid (FQN)
val c: Boolean
@SuppressLint("SdCardPath") // Valid: AST-based check
val d: Boolean
}
init {
// Local variable outside method: invalid
@SuppressLint("NewApi")
val localvar = 5
}
private fun test() {
@SuppressLint("NewApi") // Invalid
val a = View.MEASURED_STATE_MASK
}
}
}