Android lint check for api requirements for classes in catch clause (KT-13243)

Added test for #KT-14047, #KT-13243 Fixed, #KT-14047 Fixed
This commit is contained in:
Vyacheslav Gerasimov
2016-10-26 13:05:57 +03:00
parent 387d5ffd73
commit 29b9521596
4 changed files with 95 additions and 105 deletions
+17 -1
View File
@@ -1,4 +1,5 @@
<error descr="The SDK platform-tools version (23) is too old to check APIs compiled with API 23; please update">// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection</error>
// INSPECTION_CLASS: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintNewApiInspection
// INSPECTION_CLASS2: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintInlinedApiInspection
// INSPECTION_CLASS3: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintOverrideInspection
@@ -13,6 +14,7 @@ import android.view.ViewGroup
import android.view.ViewGroup.LayoutParams
import android.app.Activity
import android.app.ApplicationErrorReport
import android.graphics.Path
import android.graphics.PorterDuff
import android.graphics.Rect
import android.os.Build
@@ -25,6 +27,7 @@ import android.os.Build.VERSION_CODES
import android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH
import android.os.Build.VERSION_CODES.JELLY_BEAN
import android.os.Bundle
import android.system.ErrnoException
import android.widget.TextView
@Suppress("SENSELESS_COMPARISON", "UNUSED_EXPRESSION", "UsePropertyAccessSyntax", "UNUSED_VARIABLE", "unused", "UNUSED_PARAMETER", "DEPRECATION")
@@ -275,6 +278,19 @@ class ApiCallTest: Activity() {
}
}
fun testCatch() {
try {
} catch (e: <error descr="Class requires API level 21 (current min is 1): android.system.ErrnoException">ErrnoException</error>) {
}
}
fun testOverload() {
// this overloaded addOval available only on API Level 21
Path().<error descr="Call requires API level 21 (current min is 1): android.graphics.Path#addOval">addOval</error>(0f, 0f, 0f, 0f, Path.Direction.CW)
}
// Return type
internal // API 14
val gridLayout: GridLayout?