diff --git a/plugins/annotation-processing/testData/processors/DefaultValueFromBinary.kt b/plugins/annotation-processing/testData/processors/DefaultValueFromBinary.kt new file mode 100644 index 00000000000..54e4ee6a8d1 --- /dev/null +++ b/plugins/annotation-processing/testData/processors/DefaultValueFromBinary.kt @@ -0,0 +1,12 @@ +// Some user annotation is required because annoations from kotlin.jvm are filtered out in kapt +annotation class Anno + +@JvmSuppressWildcards +@Anno +class Test + +@JvmSuppressWildcards(suppress = true) +class TestTrue + +@JvmSuppressWildcards(suppress = false) +class TestFalse \ No newline at end of file diff --git a/plugins/java-model-wrappers/src/org/jetbrains/kotlin/java/model/internal/internalUtil.kt b/plugins/java-model-wrappers/src/org/jetbrains/kotlin/java/model/internal/internalUtil.kt index b26a66b21fb..57d4eaf437e 100644 --- a/plugins/java-model-wrappers/src/org/jetbrains/kotlin/java/model/internal/internalUtil.kt +++ b/plugins/java-model-wrappers/src/org/jetbrains/kotlin/java/model/internal/internalUtil.kt @@ -52,7 +52,7 @@ private fun PsiModifierList.getJavaModifiers(): Set { internal fun PsiExpression.calcConstantValue(evaluator: PsiConstantEvaluationHelper? = null): Any? { return when (this) { is PsiLiteral -> value - is KtLightAnnotation.LightExpressionValue<*> -> getConstantValue() + is KtLightAnnotation.LightExpressionValue<*> -> getConstantValue() ?: delegate.calcConstantValue(evaluator) is PsiExpression -> (evaluator ?: getConstantEvaluator(this)).computeConstantExpression(this) else -> null } diff --git a/plugins/plugins-tests/tests/org/jetbrains/kotlin/annotation/processing/test/processor/ProcessorTests.kt b/plugins/plugins-tests/tests/org/jetbrains/kotlin/annotation/processing/test/processor/ProcessorTests.kt index c44b870a455..786c89c4a5f 100644 --- a/plugins/plugins-tests/tests/org/jetbrains/kotlin/annotation/processing/test/processor/ProcessorTests.kt +++ b/plugins/plugins-tests/tests/org/jetbrains/kotlin/annotation/processing/test/processor/ProcessorTests.kt @@ -217,4 +217,16 @@ class ProcessorTests : AbstractProcessorTest() { val annotations = (annotationHandler as SourceRetentionAnnotationHandlerImpl).sourceRetentionAnnotations.sorted() assertEquals("Source1, Source2, Source3, Source4, Test5\$Source5", annotations.joinToString()) } + + fun testKotlinAnnotationDefaultValueFromBinary() = test("DefaultValueFromBinary", "*") { set, roundEnv, env -> + fun check(expectedValue: Boolean, className: String) { + val clazz = env.findClass(className) + val anno = clazz.getAnnotation(JvmSuppressWildcards::class.java)!! + assertEquals(expectedValue, anno.suppress) + } + + check(true, "Test") + check(true, "TestTrue") + check(false, "TestFalse") + } } \ No newline at end of file