From 2d50ad82a528c11d1386f9a349d0435d366beb69 Mon Sep 17 00:00:00 2001 From: Denis Zharkov Date: Tue, 3 Jul 2018 15:37:53 +0300 Subject: [PATCH] Optimize SyntheticJavaPropertyDescriptor.Companion::findByGetterOrSetter Do not force getContributedDescriptors call when we need to request at most three names --- .../synthetic/JavaSyntheticPropertiesScope.kt | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt index 620d809ffe7..be1a008aadf 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt @@ -58,8 +58,21 @@ interface SyntheticJavaPropertyDescriptor : PropertyDescriptor { val classDescriptorOwner = getterOrSetter.containingDeclaration as? ClassDescriptor ?: return null val originalGetterOrSetter = getterOrSetter.original - return syntheticScopes.collectSyntheticExtensionProperties(listOf(classDescriptorOwner.defaultType)) - .filterIsInstance() + + val names = listOfNotNull( + propertyNameByGetMethodName(name), + propertyNameBySetMethodName(name, withIsPrefix = true), + propertyNameBySetMethodName(name, withIsPrefix = false) + ) + + return names + .flatMap { + syntheticScopes.collectSyntheticExtensionProperties( + listOf(classDescriptorOwner.defaultType), + it, + NoLookupLocation.FROM_SYNTHETIC_SCOPE + ) + }.filterIsInstance() .firstOrNull { originalGetterOrSetter == it.getMethod || originalGetterOrSetter == it.setMethod } }