2/2 FirUnsupportedSyntheticCallableReferenceChecker: don't report error on FirJavaOverriddenSyntheticPropertySymbol

Meta issue: KT-8575
^KT-58061 Fixed
Review: https://jetbrains.team/p/kt/reviews/9677

This commit fixes an inconsistency between
FirUnsupportedSyntheticCallableReferenceChecker and
UnsupportedSyntheticCallableReferenceChecker

In K1 such properties were not considered synthetic and are called
JavaPropertyDescriptor. That's why we need to do an additional check in
K2 checker, while in K1 we didn't need to do it

Also see the previous commit for more related tests that already was
green without this fix but are related to KT-58061 problem
This commit is contained in:
Nikita Bobko
2023-04-19 12:07:15 +02:00
committed by Space Team
parent 11f376ae84
commit 8314812ef9
9 changed files with 109 additions and 4 deletions
@@ -14,8 +14,7 @@ import org.jetbrains.kotlin.name.CallableId
* Frontend IR creates such kind a symbol when a Java class is asked for a property which
* exists in one of its base Kotlin classes, and the Java class itself contains the bound getter.
*
* The typical example:
*
* ## Example 1
* ```
* abstract class SomeKotlinClass {
* abstract val foo: Int
@@ -26,6 +25,21 @@ import org.jetbrains.kotlin.name.CallableId
* public int getFoo() { return 42; }
* }
* ```
*
* ## Example 2
* Another use-case is "properties" of Java annotations:
* ```
* public @interface JavaAnnotation {
* public String javaProperty() default ""; // Java method which is considered property in Kotlin,
* // because methods in Java annotations can't have parameters
* }
*
* fun main(annotation: JavaAnnotation) {
* annotation.javaProperty // FirJavaOverriddenSyntheticPropertySymbol
* }
* ```
* The mental model is that in Kotlin world annotations can have only constructor-properties.
* And Java "overrides" Kotlin's "base Annotation" class (yes, technically there is no base class for annotations).
*/
class FirJavaOverriddenSyntheticPropertySymbol(
propertyId: CallableId,