Do not generate constructors for annotation classes.
This commit is contained in:
committed by
Dmitry Petrov
parent
4e112b3f88
commit
4eda19b36a
@@ -32,6 +32,7 @@ import org.jetbrains.kotlin.renderer.DescriptorRenderer
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRendererModifier
|
||||
import org.jetbrains.kotlin.renderer.OverrideRenderingPolicy
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||
import java.lang.AssertionError
|
||||
import java.util.*
|
||||
@@ -186,7 +187,10 @@ class ClassGenerator(val declarationGenerator: DeclarationGenerator) : Generator
|
||||
}
|
||||
|
||||
private fun generatePrimaryConstructor(irClass: IrClassImpl, ktClassOrObject: KtClassOrObject) {
|
||||
val primaryConstructorDescriptor = irClass.descriptor.unsubstitutedPrimaryConstructor ?: return
|
||||
val classDescriptor = irClass.descriptor
|
||||
if (DescriptorUtils.isAnnotationClass(classDescriptor)) return
|
||||
|
||||
val primaryConstructorDescriptor = classDescriptor.unsubstitutedPrimaryConstructor ?: return
|
||||
|
||||
val irPrimaryConstructor = IrConstructorImpl(ktClassOrObject.startOffset, ktClassOrObject.endOffset, IrDeclarationOrigin.DEFINED,
|
||||
primaryConstructorDescriptor)
|
||||
|
||||
@@ -11,10 +11,6 @@ FILE /classes.kt
|
||||
DELEGATING_CONSTRUCTOR_CALL 'constructor Any()'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='TestObject'
|
||||
CLASS ANNOTATION_CLASS TestAnnotationClass
|
||||
CONSTRUCTOR public constructor TestAnnotationClass()
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'constructor Any()'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='TestAnnotationClass'
|
||||
CLASS ENUM_CLASS TestEnumClass
|
||||
CONSTRUCTOR private constructor TestEnumClass()
|
||||
BLOCK_BODY
|
||||
|
||||
Reference in New Issue
Block a user