Search for JvmName also among use-site targeted annotations
#KT-9699 Fixed
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class TestIt {
|
||||
@get:JvmName("getIsFries")
|
||||
@set:JvmName("setIsFries")
|
||||
var isFries: Boolean = true
|
||||
|
||||
@get:JvmName("getIsUpdateable")
|
||||
@set:JvmName("setIsUpdateable")
|
||||
var isUpdateable: Boolean by Delegate
|
||||
}
|
||||
|
||||
object Delegate {
|
||||
operator fun getValue(thiz: Any?, metadata: Any?) = true
|
||||
operator fun setValue(thiz: Any?, metadata: Any?, value: Boolean) {}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
assertEquals(
|
||||
listOf("getIsFries", "getIsUpdateable", "setIsFries", "setIsUpdateable"),
|
||||
TestIt::class.java.declaredMethods.map { it.name }.sorted()
|
||||
)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+6
@@ -2131,6 +2131,12 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("propertyAccessorsUseSite.kt")
|
||||
public void testPropertyAccessorsUseSite() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/jvmName/propertyAccessorsUseSite.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("propertyName.kt")
|
||||
public void testPropertyName() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/jvmName/propertyName.kt");
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotated;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationWithTarget;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.impl.FunctionExpressionDescriptor;
|
||||
@@ -595,11 +596,11 @@ public class DescriptorUtils {
|
||||
|
||||
@Nullable
|
||||
public static AnnotationDescriptor getJvmNameAnnotation(@NotNull Annotations annotations) {
|
||||
AnnotationDescriptor jvmNameAnnotation = annotations.findAnnotation(JVM_NAME);
|
||||
if (jvmNameAnnotation == null) {
|
||||
jvmNameAnnotation = annotations.findAnnotation(PLATFORM_NAME);
|
||||
AnnotationWithTarget jvmName = Annotations.Companion.findAnyAnnotation(annotations, JVM_NAME);
|
||||
if (jvmName == null) {
|
||||
jvmName = Annotations.Companion.findAnyAnnotation(annotations, PLATFORM_NAME);
|
||||
}
|
||||
return jvmNameAnnotation;
|
||||
return jvmName == null ? null : jvmName.getAnnotation();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
Reference in New Issue
Block a user