diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/SharedPrefsDetector.java b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/SharedPrefsDetector.java index 0dc32eee7fd..0514abe455f 100644 --- a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/SharedPrefsDetector.java +++ b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/SharedPrefsDetector.java @@ -125,7 +125,11 @@ public class SharedPrefsDetector extends Detector implements UastScanner { } else { if (!verifiedType) { UType type = definition.getType(); - String possiblefqName = type.resolveOrEmpty(context).getFqNameOrName(); + UClass clazz = type.resolveOrEmpty(context); + String possiblefqName = clazz.getFqName(); + if (possiblefqName == null) { + possiblefqName = clazz.getName(); + } if (possiblefqName.endsWith("SharedPreferences.Editor")) { //$NON-NLS-1$ if (!type.matchesFqName("Editor") || //$NON-NLS-1$ !LintUtils.isImported(context.getLintContext().getCompilationUnit(), diff --git a/plugins/uast-common/src/org/jetbrains/uast/baseElements/UAnnotation.kt b/plugins/uast-common/src/org/jetbrains/uast/baseElements/UAnnotation.kt index d5a73e13253..4efb24d131b 100644 --- a/plugins/uast-common/src/org/jetbrains/uast/baseElements/UAnnotation.kt +++ b/plugins/uast-common/src/org/jetbrains/uast/baseElements/UAnnotation.kt @@ -15,7 +15,7 @@ */ package org.jetbrains.uast -interface UAnnotation : UElement, UNamed, UFqNamed, NoTraverse { +interface UAnnotation : UElement, UNamed, UFqNamed, LeafUElement { fun resolve(context: UastContext): UClass? val valueArguments: List diff --git a/plugins/uast-common/src/org/jetbrains/uast/baseElements/UElement.kt b/plugins/uast-common/src/org/jetbrains/uast/baseElements/UElement.kt index cf4b28f4561..69d133e921f 100644 --- a/plugins/uast-common/src/org/jetbrains/uast/baseElements/UElement.kt +++ b/plugins/uast-common/src/org/jetbrains/uast/baseElements/UElement.kt @@ -38,7 +38,7 @@ interface UModifierOwner { fun hasModifier(modifier: UastModifier): Boolean } -interface NoTraverse : UElement { +interface LeafUElement : UElement { override fun traverse(callback: UastCallback) {} } diff --git a/plugins/uast-common/src/org/jetbrains/uast/baseElements/UExpression.kt b/plugins/uast-common/src/org/jetbrains/uast/baseElements/UExpression.kt index 01a5ef928b7..962087e2c23 100644 --- a/plugins/uast-common/src/org/jetbrains/uast/baseElements/UExpression.kt +++ b/plugins/uast-common/src/org/jetbrains/uast/baseElements/UExpression.kt @@ -34,6 +34,6 @@ interface NoModifiers : UModifierOwner { override fun hasModifier(modifier: UastModifier) = false } -class EmptyExpression(override val parent: UElement) : UExpression, NoTraverse, NoEvaluate { +class EmptyExpression(override val parent: UElement) : UExpression, LeafUElement, NoEvaluate { override fun logString() = "EmptyExpression" } \ No newline at end of file diff --git a/plugins/uast-common/src/org/jetbrains/uast/declarations/UDeclaration.kt b/plugins/uast-common/src/org/jetbrains/uast/declarations/UDeclaration.kt index 4d0056db72c..df2c3ebbdab 100644 --- a/plugins/uast-common/src/org/jetbrains/uast/declarations/UDeclaration.kt +++ b/plugins/uast-common/src/org/jetbrains/uast/declarations/UDeclaration.kt @@ -19,7 +19,7 @@ interface UDeclaration : UElement, UNamed { val nameElement: UElement? } -object UDeclarationNotResolved : UDeclaration, NoTraverse { +object UDeclarationNotResolved : UDeclaration, LeafUElement { override val name = "" override val nameElement = null override val parent = null diff --git a/plugins/uast-common/src/org/jetbrains/uast/declarations/UType.kt b/plugins/uast-common/src/org/jetbrains/uast/declarations/UType.kt index 26b061dd653..dcab4ff5e5b 100644 --- a/plugins/uast-common/src/org/jetbrains/uast/declarations/UType.kt +++ b/plugins/uast-common/src/org/jetbrains/uast/declarations/UType.kt @@ -15,7 +15,7 @@ */ package org.jetbrains.uast -interface UType : UElement, UNamed, UFqNamed, UAnnotated, UResolvable, NoTraverse { +interface UType : UElement, UNamed, UFqNamed, UAnnotated, UResolvable, LeafUElement { override fun matchesName(name: String) = this.name == name || this.name.endsWith(".$name") /* The simple type name is only for the debug purposes. Do not check against it in the production code */ @@ -37,7 +37,7 @@ interface UType : UElement, UNamed, UFqNamed, UAnnotated, UResolvable, NoTravers override fun resolveOrEmpty(context: UastContext) = resolve(context) ?: UClassNotResolved } -interface UTypeReference : UDeclaration, UResolvable, NoTraverse { +interface UTypeReference : UDeclaration, UResolvable, LeafUElement { override fun renderString() = "" override fun logString() = log("UTypeReference") diff --git a/plugins/uast-common/src/org/jetbrains/uast/expressions/UClassLiteralExpression.kt b/plugins/uast-common/src/org/jetbrains/uast/expressions/UClassLiteralExpression.kt index 03080a92060..f29281599cd 100644 --- a/plugins/uast-common/src/org/jetbrains/uast/expressions/UClassLiteralExpression.kt +++ b/plugins/uast-common/src/org/jetbrains/uast/expressions/UClassLiteralExpression.kt @@ -15,7 +15,7 @@ */ package org.jetbrains.uast -interface UClassLiteralExpression : UExpression, NoTraverse { +interface UClassLiteralExpression : UExpression, LeafUElement { override fun logString() = "UClassLiteralExpression" override fun renderString() = getExpressionType()?.name ?: "::class" diff --git a/plugins/uast-common/src/org/jetbrains/uast/expressions/USimpleReferenceExpression.kt b/plugins/uast-common/src/org/jetbrains/uast/expressions/USimpleReferenceExpression.kt index ffb6155e4f6..e6925872f65 100644 --- a/plugins/uast-common/src/org/jetbrains/uast/expressions/USimpleReferenceExpression.kt +++ b/plugins/uast-common/src/org/jetbrains/uast/expressions/USimpleReferenceExpression.kt @@ -15,7 +15,7 @@ */ package org.jetbrains.uast -interface USimpleReferenceExpression : UExpression, UResolvable, NoTraverse { +interface USimpleReferenceExpression : UExpression, UResolvable, LeafUElement { val identifier: String override fun logString() = "USimpleReferenceExpression ($identifier)" diff --git a/plugins/uast-java/src/org/jetbrains/uast/java/expressions/JavaDumbUElement.kt b/plugins/uast-java/src/org/jetbrains/uast/java/expressions/JavaDumbUElement.kt index 0b133c8ed55..59d3053f1cb 100644 --- a/plugins/uast-java/src/org/jetbrains/uast/java/expressions/JavaDumbUElement.kt +++ b/plugins/uast-java/src/org/jetbrains/uast/java/expressions/JavaDumbUElement.kt @@ -16,14 +16,14 @@ package org.jetbrains.uast.java import com.intellij.psi.PsiElement -import org.jetbrains.uast.NoTraverse +import org.jetbrains.uast.LeafUElement import org.jetbrains.uast.UElement import org.jetbrains.uast.psi.PsiElementBacked class JavaDumbUElement( override val psi: PsiElement?, override val parent: UElement -) : JavaAbstractUElement(), UElement, PsiElementBacked, NoTraverse { +) : JavaAbstractUElement(), UElement, PsiElementBacked, LeafUElement { override fun logString() = "JavaPsiElementStub" override fun renderString() = "" } \ No newline at end of file diff --git a/plugins/uast-java/src/org/jetbrains/uast/java/expressions/UnknownJavaExpression.kt b/plugins/uast-java/src/org/jetbrains/uast/java/expressions/UnknownJavaExpression.kt index 1aeaa059680..184d4f77f59 100644 --- a/plugins/uast-java/src/org/jetbrains/uast/java/expressions/UnknownJavaExpression.kt +++ b/plugins/uast-java/src/org/jetbrains/uast/java/expressions/UnknownJavaExpression.kt @@ -22,6 +22,6 @@ import org.jetbrains.uast.psi.PsiElementBacked class UnknownJavaExpression( override val psi: PsiElement, override val parent: UElement -) : UExpression, PsiElementBacked, NoEvaluate, NoTraverse { +) : UExpression, PsiElementBacked, NoEvaluate, LeafUElement { override fun logString() = "[!] UnknownJavaExpression ($psi)" } \ No newline at end of file diff --git a/plugins/uast-kotlin/src/org/jetbrains/kotlin/uast/declarations/KotlinDumbUElement.kt b/plugins/uast-kotlin/src/org/jetbrains/kotlin/uast/declarations/KotlinDumbUElement.kt index 3806bada22a..1ab1406fd78 100644 --- a/plugins/uast-kotlin/src/org/jetbrains/kotlin/uast/declarations/KotlinDumbUElement.kt +++ b/plugins/uast-kotlin/src/org/jetbrains/kotlin/uast/declarations/KotlinDumbUElement.kt @@ -17,14 +17,14 @@ package org.jetbrains.kotlin.uast import com.intellij.psi.PsiElement -import org.jetbrains.uast.NoTraverse +import org.jetbrains.uast.LeafUElement import org.jetbrains.uast.UElement import org.jetbrains.uast.psi.PsiElementBacked class KotlinDumbUElement( override val psi: PsiElement?, override val parent: UElement -) : KotlinAbstractUElement(), UElement, PsiElementBacked, NoTraverse { +) : KotlinAbstractUElement(), UElement, PsiElementBacked, LeafUElement { override fun logString() = "KotlinPsiElementStub" override fun renderString() = "" } \ No newline at end of file