From 0d0222e1aa8b276466c6b0154387f310ffbbac73 Mon Sep 17 00:00:00 2001 From: Evgeny Gerashchenko Date: Tue, 3 Feb 2015 17:30:52 +0300 Subject: [PATCH] Expanded workaround for EA-64030 (IDEA doesn't allow keywords in cls annotations). --- .../kotlin/idea/inspections/UnusedSymbolInspection.kt | 4 +--- .../unusedSymbol/function/inspectionData/expected.xml | 9 +++++++++ .../unusedSymbol/function/withNativeAnnotation.kt | 4 +++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedSymbolInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedSymbolInspection.kt index 41d79009904..2d6bce9e65f 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedSymbolInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedSymbolInspection.kt @@ -125,9 +125,7 @@ public class UnusedSymbolInspection : AbstractKotlinInspection() { private fun isEntryPoint(declaration: JetNamedDeclaration): Boolean { // TODO Workaround for EA-64030 - IOE: PsiJavaParserFacadeImpl.createAnnotationFromText // This should be fixed on IDEA side: ClsAnnotation should not throw exceptions when annotation class has Java keyword - if (declaration is JetNamedFunction) { - if (declaration.getAnnotationEntries().any { it.getTypeReference().getText().endsWith("native") }) return false - } + if (declaration.getAnnotationEntries().any { it.getTypeReference().getText().endsWith("native") }) return false val lightElement: PsiElement? = when (declaration) { is JetClassOrObject -> declaration.toLightClass() diff --git a/idea/testData/inspections/unusedSymbol/function/inspectionData/expected.xml b/idea/testData/inspections/unusedSymbol/function/inspectionData/expected.xml index 311ce44858a..6c57dc3abd3 100644 --- a/idea/testData/inspections/unusedSymbol/function/inspectionData/expected.xml +++ b/idea/testData/inspections/unusedSymbol/function/inspectionData/expected.xml @@ -60,4 +60,13 @@ Unused Symbol Function 'withNativeAnnotation' is never used + + + withNativeAnnotation.kt + 7 + light_idea_test_case + + Unused Symbol + Class 'WithNativeAnnotation' is never used + diff --git a/idea/testData/inspections/unusedSymbol/function/withNativeAnnotation.kt b/idea/testData/inspections/unusedSymbol/function/withNativeAnnotation.kt index c5b5f5cf07d..68080d24dc6 100644 --- a/idea/testData/inspections/unusedSymbol/function/withNativeAnnotation.kt +++ b/idea/testData/inspections/unusedSymbol/function/withNativeAnnotation.kt @@ -2,4 +2,6 @@ annotation class native native fun withNativeAnnotation() { -} \ No newline at end of file +} + +native class WithNativeAnnotation