Do not hide synthetic properties except isEmpty from Java

In order to hide synthetic property isEmpty from JDK 15, there was
 added additional logic in 5cc12b49fc but
 it also lead to the fact that now it's impossible to call synthetic
 property `declaringClass` on `Enum` as it's in the same list as method
 isEmpty(). Note that it's questionable behavior, probably we should
 also hide `declaringClass` as well but for now we turn it back to
 preserve compatibility

 #KT-42467 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2020-10-14 23:05:50 +03:00
parent 4227e2dc40
commit eacc94a89d
6 changed files with 35 additions and 2 deletions
@@ -162,7 +162,7 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager, private val l
return descriptor.valueParameters.isEmpty()
&& descriptor.typeParameters.isEmpty()
&& descriptor.visibility.isVisibleOutside()
&& !descriptor.isHiddenForResolutionEverywhereBesideSupercalls
&& !(descriptor.isHiddenForResolutionEverywhereBesideSupercalls && descriptor.name.asString() == "isEmpty") // CharSequence.isEmpty() from JDK15
}
private fun isGoodSetMethod(descriptor: FunctionDescriptor, getMethod: FunctionDescriptor): Boolean {
@@ -179,7 +179,7 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager, private val l
return parameter.varargElementType == null
&& descriptor.typeParameters.isEmpty()
&& descriptor.visibility.isVisibleOutside()
&& !descriptor.isHiddenForResolutionEverywhereBesideSupercalls
&& !(descriptor.isHiddenForResolutionEverywhereBesideSupercalls && descriptor.name.asString() == "isEmpty") // CharSequence.isEmpty() from JDK15
}
private fun FunctionDescriptor.findOverridden(condition: (FunctionDescriptor) -> Boolean): FunctionDescriptor? {