Fixed exception in android lint

This commit is contained in:
Vyacheslav Gerasimov
2017-02-03 13:09:49 +03:00
parent 1ea2e8c1d1
commit bad15249e7
2 changed files with 9 additions and 6 deletions
@@ -16,6 +16,7 @@
package org.jetbrains.kotlin.asJava.elements
import com.intellij.openapi.util.TextRange
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiJavaCodeReferenceElement
import com.intellij.psi.PsiReferenceList
@@ -56,6 +57,8 @@ class KtLightPsiReferenceList (
val entry = kotlinOrigin ?: return
superTypeList.removeEntry(entry)
}
override fun getTextRange(): TextRange? = kotlinOrigin?.typeReference?.textRange ?: TextRange.EMPTY_RANGE
}
override val kotlinOrigin: KtSuperTypeList?
+6 -6
View File
@@ -29,6 +29,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.os.Parcelable
import android.system.ErrnoException
import android.widget.TextView
@@ -415,16 +416,15 @@ class ApiCallTest: Activity() {
layout as? LinearLayout // OK API 1
layout as LinearLayout // OK API 1
if (layout !is GridLayout) {} // TODO: should be error, fixed in uast > 1.0.8
layout as? GridLayout // TODO: should be error, fixed in uast > 1.0.8
layout as GridLayout // TODO: should be error, fixed in uast > 1.0.8
if (layout !is <error descr="Class requires API level 14 (current min is 1): android.widget.GridLayout">GridLayout</error>) {}
layout as? <error descr="Class requires API level 14 (current min is 1): android.widget.GridLayout">GridLayout</error>
layout as <error descr="Class requires API level 14 (current min is 1): android.widget.GridLayout">GridLayout</error>
val grid = layout as? GridLayout // TODO: should be error, fixed in uast > 1.0.8
val grid = layout as? <error descr="Class requires API level 14 (current min is 1): android.widget.GridLayout">GridLayout</error>
val linear = layout as LinearLayout // OK API 1
}
// TODO: should be error
class ErrorVectorDravable : VectorDrawable()
abstract class ErrorVectorDravable : <error descr="Class requires API level 21 (current min is 1): android.graphics.drawable.VectorDrawable">VectorDrawable</error>(), Parcelable
@TargetApi(21)
class MyVectorDravable : VectorDrawable()