Support java synthetic properties in DependencyCollector
This commit is contained in:
@@ -82,16 +82,25 @@ class DependenciesCollector {
|
||||
|
||||
private fun Collection<IrSymbol>.addTopLevelDeclarations() {
|
||||
forEach {
|
||||
addTopLevelDescriptor(getTopLevelDeclaration(it.descriptor))
|
||||
getTopLevelDeclaration(it.descriptor)?.let { addTopLevelDescriptor(it) }
|
||||
}
|
||||
}
|
||||
|
||||
private fun getTopLevelDeclaration(descriptor: DeclarationDescriptor): DeclarationDescriptor {
|
||||
private fun getTopLevelDeclaration(descriptor: DeclarationDescriptor): DeclarationDescriptor? {
|
||||
val containingDeclaration = descriptor.containingDeclaration
|
||||
return when (containingDeclaration) {
|
||||
is PackageFragmentDescriptor -> descriptor
|
||||
is ClassDescriptor -> getTopLevelDeclaration(containingDeclaration)
|
||||
else -> throw AssertionError("Package or class expected: $containingDeclaration; for $descriptor")
|
||||
else ->
|
||||
if (descriptor is PropertyAccessorDescriptor &&
|
||||
descriptor.kind == CallableMemberDescriptor.Kind.SYNTHESIZED &&
|
||||
containingDeclaration is ModuleDescriptor
|
||||
) {
|
||||
//skip synthetic java properties
|
||||
null
|
||||
} else {
|
||||
throw AssertionError("Package or class expected: $containingDeclaration; for $descriptor")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user