Load annotations for default getter and setter

#KT-14697 Fixed
This commit is contained in:
Dmitry Petrov
2017-10-04 16:19:35 +03:00
parent c6a00af2f0
commit 67a50e92d0
3 changed files with 27 additions and 4 deletions
@@ -0,0 +1,15 @@
// IGNORE_BACKEND: NATIVE
// FILE: A.kt
package lib
@set:JvmName("renamedSetFoo")
@get:JvmName("renamedGetFoo")
var foo = "not set"
// FILE: B.kt
import lib.*
fun box(): String {
foo = "OK"
return foo
}
@@ -240,6 +240,12 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl
doTest(fileName);
}
@TestMetadata("targetedJvmName.kt")
public void testTargetedJvmName() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/targetedJvmName.kt");
doTest(fileName);
}
@TestMetadata("typeAliasesKt13181.kt")
public void testTypeAliasesKt13181() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/typeAliasesKt13181.kt");
@@ -75,10 +75,11 @@ class MemberDeserializer(private val c: DeserializationContext) {
val isNotDefault = proto.hasGetterFlags() && Flags.IS_NOT_DEFAULT.get(getterFlags)
val isExternal = proto.hasGetterFlags() && Flags.IS_EXTERNAL_ACCESSOR.get(getterFlags)
val isInline = proto.hasGetterFlags() && Flags.IS_INLINE_ACCESSOR.get(getterFlags)
val annotations = getAnnotations(proto, getterFlags, AnnotatedCallableKind.PROPERTY_GETTER)
val getter = if (isNotDefault) {
PropertyGetterDescriptorImpl(
property,
getAnnotations(proto, getterFlags, AnnotatedCallableKind.PROPERTY_GETTER),
annotations,
Deserialization.modality(Flags.MODALITY.get(getterFlags)),
Deserialization.visibility(Flags.VISIBILITY.get(getterFlags)),
/* isDefault = */ !isNotDefault,
@@ -88,7 +89,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
)
}
else {
DescriptorFactory.createDefaultGetter(property, Annotations.EMPTY)
DescriptorFactory.createDefaultGetter(property, annotations)
}
getter.initialize(property.returnType)
getter
@@ -102,10 +103,11 @@ class MemberDeserializer(private val c: DeserializationContext) {
val isNotDefault = proto.hasSetterFlags() && Flags.IS_NOT_DEFAULT.get(setterFlags)
val isExternal = proto.hasSetterFlags() && Flags.IS_EXTERNAL_ACCESSOR.get(setterFlags)
val isInline = proto.hasGetterFlags() && Flags.IS_INLINE_ACCESSOR.get(setterFlags)
val annotations = getAnnotations(proto, setterFlags, AnnotatedCallableKind.PROPERTY_SETTER)
if (isNotDefault) {
val setter = PropertySetterDescriptorImpl(
property,
getAnnotations(proto, setterFlags, AnnotatedCallableKind.PROPERTY_SETTER),
annotations,
Deserialization.modality(Flags.MODALITY.get(setterFlags)),
Deserialization.visibility(Flags.VISIBILITY.get(setterFlags)),
/* isDefault = */ !isNotDefault,
@@ -121,7 +123,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
setter
}
else {
DescriptorFactory.createDefaultSetter(property, Annotations.EMPTY)
DescriptorFactory.createDefaultSetter(property, annotations)
}
}
else {