Support platform/impl modifiers for properties
Do not allow platform properties to have backing fields, initializers, be delegated, lateinit or const, or have accessors with bodies
This commit is contained in:
+1
-1
@@ -46,7 +46,7 @@ public class JavaPropertyDescriptor extends PropertyDescriptorImpl implements Ja
|
||||
boolean isStaticFinal
|
||||
) {
|
||||
super(containingDeclaration, original, annotations, modality, visibility, isVar, name, kind, source,
|
||||
/* lateInit = */ false, /* isConst = */ false);
|
||||
/* lateInit = */ false, /* isConst = */ false, /* isPlatform = */ false, /* isImpl = */ false);
|
||||
|
||||
this.isStaticFinal = isStaticFinal;
|
||||
}
|
||||
|
||||
+14
-8
@@ -44,6 +44,8 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
||||
private final Kind kind;
|
||||
private final boolean lateInit;
|
||||
private final boolean isConst;
|
||||
private final boolean isPlatform;
|
||||
private final boolean isImpl;
|
||||
|
||||
private ReceiverParameterDescriptor dispatchReceiverParameter;
|
||||
private ReceiverParameterDescriptor extensionReceiverParameter;
|
||||
@@ -63,7 +65,9 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
||||
@NotNull Kind kind,
|
||||
@NotNull SourceElement source,
|
||||
boolean lateInit,
|
||||
boolean isConst
|
||||
boolean isConst,
|
||||
boolean isPlatform,
|
||||
boolean isImpl
|
||||
) {
|
||||
super(containingDeclaration, annotations, name, null, isVar, source);
|
||||
this.modality = modality;
|
||||
@@ -72,6 +76,8 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
||||
this.kind = kind;
|
||||
this.lateInit = lateInit;
|
||||
this.isConst = isConst;
|
||||
this.isPlatform = isPlatform;
|
||||
this.isImpl = isImpl;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -85,10 +91,12 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
||||
@NotNull Kind kind,
|
||||
@NotNull SourceElement source,
|
||||
boolean lateInit,
|
||||
boolean isConst
|
||||
boolean isConst,
|
||||
boolean isPlatform,
|
||||
boolean isImpl
|
||||
) {
|
||||
return new PropertyDescriptorImpl(containingDeclaration, null, annotations,
|
||||
modality, visibility, isVar, name, kind, source, lateInit, isConst);
|
||||
modality, visibility, isVar, name, kind, source, lateInit, isConst, isPlatform, isImpl);
|
||||
}
|
||||
|
||||
public void setType(
|
||||
@@ -334,7 +342,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
||||
) {
|
||||
return new PropertyDescriptorImpl(
|
||||
newOwner, original, getAnnotations(), newModality, newVisibility, isVar(), getName(), kind, SourceElement.NO_SOURCE,
|
||||
isLateInit(), isConst()
|
||||
isLateInit(), isConst(), isPlatform(), isImpl()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -357,14 +365,12 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
||||
|
||||
@Override
|
||||
public boolean isPlatform() {
|
||||
// TODO
|
||||
return false;
|
||||
return isPlatform;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isImpl() {
|
||||
// TODO
|
||||
return false;
|
||||
return isImpl;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -365,7 +365,9 @@ public class ErrorUtils {
|
||||
CallableMemberDescriptor.Kind.DECLARATION,
|
||||
SourceElement.NO_SOURCE,
|
||||
/* lateInit = */ false,
|
||||
/* isConst = */ false
|
||||
/* isConst = */ false,
|
||||
/* isPlatform = */ false,
|
||||
/* isImpl = */ false
|
||||
);
|
||||
descriptor.setType(ERROR_PROPERTY_TYPE,
|
||||
Collections.<TypeParameterDescriptor>emptyList(),
|
||||
|
||||
+5
-2
@@ -24,7 +24,10 @@ import org.jetbrains.kotlin.protobuf.MessageLite
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
|
||||
import org.jetbrains.kotlin.serialization.deserialization.TypeTable
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.SimpleType
|
||||
import org.jetbrains.kotlin.types.TypeSubstitutor
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
import org.jetbrains.kotlin.types.asSimpleType
|
||||
|
||||
interface DeserializedMemberDescriptor : MemberDescriptor {
|
||||
val proto: MessageLite
|
||||
@@ -87,7 +90,7 @@ class DeserializedPropertyDescriptor(
|
||||
override val containerSource: SourceElement?
|
||||
) : DeserializedCallableMemberDescriptor,
|
||||
PropertyDescriptorImpl(containingDeclaration, original, annotations,
|
||||
modality, visibility, isVar, name, kind, SourceElement.NO_SOURCE, isLateInit, isConst) {
|
||||
modality, visibility, isVar, name, kind, SourceElement.NO_SOURCE, isLateInit, isConst, false, false) {
|
||||
|
||||
override fun createSubstitutedCopy(
|
||||
newOwner: DeclarationDescriptor,
|
||||
|
||||
Reference in New Issue
Block a user