Update annotation rendering in diagnostics
Disable annotation rendering in default type and descriptor renderers. Preserve annotations in Android and Serialization plugins. Update error texts in ide tests. Nullability annotations in Java descriptors are rendered with context-dependent renderer. #KT-20258 Fixed
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.platform
|
||||
|
||||
import org.jetbrains.kotlin.container.DefaultImplementation
|
||||
import org.jetbrains.kotlin.container.PlatformSpecificExtension
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
|
||||
@DefaultImplementation(impl = PlatformSpecificDiagnosticComponents.Default::class)
|
||||
interface PlatformSpecificDiagnosticComponents : PlatformSpecificExtension<PlatformSpecificDiagnosticComponents> {
|
||||
fun isNullabilityAnnotation(
|
||||
annotationDescriptor: AnnotationDescriptor,
|
||||
containingDeclaration: DeclarationDescriptor
|
||||
): Boolean
|
||||
|
||||
object Default : PlatformSpecificDiagnosticComponents {
|
||||
override fun isNullabilityAnnotation(
|
||||
annotationDescriptor: AnnotationDescriptor,
|
||||
containingDeclaration: DeclarationDescriptor
|
||||
): Boolean = false
|
||||
}
|
||||
}
|
||||
@@ -142,6 +142,11 @@ abstract class DescriptorRenderer {
|
||||
|
||||
@JvmField
|
||||
val FQ_NAMES_IN_TYPES: DescriptorRenderer = withOptions {
|
||||
modifiers = DescriptorRendererModifier.ALL_EXCEPT_ANNOTATIONS
|
||||
}
|
||||
|
||||
@JvmField
|
||||
val FQ_NAMES_IN_TYPES_WITH_ANNOTATIONS: DescriptorRenderer = withOptions {
|
||||
modifiers = DescriptorRendererModifier.ALL
|
||||
}
|
||||
|
||||
@@ -301,7 +306,7 @@ enum class DescriptorRendererModifier(val includeByDefault: Boolean) {
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
val DEFAULTS = values().filter { it.includeByDefault }.toSet()
|
||||
val ALL_EXCEPT_ANNOTATIONS = values().filter { it.includeByDefault }.toSet()
|
||||
|
||||
@JvmField
|
||||
val ALL = values().toSet()
|
||||
|
||||
@@ -69,7 +69,7 @@ internal class DescriptorRendererOptionsImpl : DescriptorRendererOptions {
|
||||
override var classifierNamePolicy: ClassifierNamePolicy by property(ClassifierNamePolicy.SOURCE_CODE_QUALIFIED)
|
||||
override var withDefinedIn by property(true)
|
||||
override var withSourceFileForTopLevel by property(true)
|
||||
override var modifiers: Set<DescriptorRendererModifier> by property(DescriptorRendererModifier.DEFAULTS)
|
||||
override var modifiers: Set<DescriptorRendererModifier> by property(DescriptorRendererModifier.ALL_EXCEPT_ANNOTATIONS)
|
||||
override var startFromName by property(false)
|
||||
override var startFromDeclarationKeyword by property(false)
|
||||
override var debugMode by property(false)
|
||||
|
||||
Reference in New Issue
Block a user