org.jetbrains.kotlin.descriptors.impl
Class PropertyDescriptorImpl
java.lang.Object
org.jetbrains.kotlin.descriptors.annotations.AnnotatedImpl
org.jetbrains.kotlin.descriptors.impl.DeclarationDescriptorImpl
org.jetbrains.kotlin.descriptors.impl.DeclarationDescriptorNonRootImpl
org.jetbrains.kotlin.descriptors.impl.VariableDescriptorImpl
org.jetbrains.kotlin.descriptors.impl.VariableDescriptorWithInitializerImpl
org.jetbrains.kotlin.descriptors.impl.PropertyDescriptorImpl
- All Implemented Interfaces:
- Annotated, CallableDescriptor, CallableMemberDescriptor, DeclarationDescriptor, DeclarationDescriptorNonRoot, DeclarationDescriptorWithSource, DeclarationDescriptorWithVisibility, MemberDescriptor, Named, PropertyDescriptor, VariableDescriptor
- Direct Known Subclasses:
- AccessorForPropertyDescriptor, JavaPropertyDescriptor
public class PropertyDescriptorImpl
- extends VariableDescriptorWithInitializerImpl
- implements PropertyDescriptor
Constructor Summary |
protected |
PropertyDescriptorImpl(DeclarationDescriptor containingDeclaration,
PropertyDescriptor original,
Annotations annotations,
Modality modality,
Visibility visibility,
boolean isVar,
Name name,
CallableMemberDescriptor.Kind kind,
SourceElement source,
boolean lateInit,
boolean isConst)
|
Method Summary |
|
accept(DeclarationDescriptorVisitor<R,D> visitor,
D data)
|
PropertyDescriptor |
copy(DeclarationDescriptor newOwner,
Modality modality,
Visibility visibility,
CallableMemberDescriptor.Kind kind,
boolean copyOverrides)
|
static PropertyDescriptorImpl |
create(DeclarationDescriptor containingDeclaration,
Annotations annotations,
Modality modality,
Visibility visibility,
boolean isVar,
Name name,
CallableMemberDescriptor.Kind kind,
SourceElement source,
boolean lateInit,
boolean isConst)
|
protected PropertyDescriptorImpl |
createSubstitutedCopy(DeclarationDescriptor newOwner,
Modality newModality,
Visibility newVisibility,
PropertyDescriptor original,
CallableMemberDescriptor.Kind kind)
|
java.util.List<PropertyAccessorDescriptor> |
getAccessors()
|
ReceiverParameterDescriptor |
getDispatchReceiverParameter()
|
ReceiverParameterDescriptor |
getExtensionReceiverParameter()
|
PropertyGetterDescriptorImpl |
getGetter()
|
CallableMemberDescriptor.Kind |
getKind()
Is this a real function or function projection. |
Modality |
getModality()
|
PropertyDescriptor |
getOriginal()
|
java.util.Collection<? extends PropertyDescriptor> |
getOverriddenDescriptors()
|
KotlinType |
getReturnType()
Method may return null for not yet fully initialized object or if error occurred. |
PropertySetterDescriptor |
getSetter()
|
java.util.List<TypeParameterDescriptor> |
getTypeParameters()
|
Visibility |
getVisibility()
|
void |
initialize(PropertyGetterDescriptorImpl getter,
PropertySetterDescriptor setter)
|
boolean |
isConst()
|
boolean |
isLateInit()
|
boolean |
isSetterProjectedOut()
In the following case, the setter is projected out:
trait Tr { var v: T }
fun test(tr: Tr) {
tr.v = null!! // the assignment is illegal, although a read would be fine
} |
void |
setOverriddenDescriptors(java.util.Collection<? extends CallableMemberDescriptor> overriddenDescriptors)
|
void |
setSetterProjectedOut(boolean setterProjectedOut)
|
void |
setType(KotlinType outType,
java.util.List<? extends TypeParameterDescriptor> typeParameters,
ReceiverParameterDescriptor dispatchReceiverParameter,
KotlinType receiverType)
|
void |
setType(KotlinType outType,
java.util.List<? extends TypeParameterDescriptor> typeParameters,
ReceiverParameterDescriptor dispatchReceiverParameter,
ReceiverParameterDescriptor extensionReceiverParameter)
|
void |
setVisibility(Visibility visibility)
|
PropertyDescriptor |
substitute(TypeSubstitutor originalSubstitutor)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.jetbrains.kotlin.descriptors.Named |
getName |
PropertyDescriptorImpl
protected PropertyDescriptorImpl(@NotNull
DeclarationDescriptor containingDeclaration,
@Nullable
PropertyDescriptor original,
@NotNull
Annotations annotations,
@NotNull
Modality modality,
@NotNull
Visibility visibility,
boolean isVar,
@NotNull
Name name,
@NotNull
CallableMemberDescriptor.Kind kind,
@NotNull
SourceElement source,
boolean lateInit,
boolean isConst)
create
@NotNull
public static PropertyDescriptorImpl create(@NotNull
DeclarationDescriptor containingDeclaration,
@NotNull
Annotations annotations,
@NotNull
Modality modality,
@NotNull
Visibility visibility,
boolean isVar,
@NotNull
Name name,
@NotNull
CallableMemberDescriptor.Kind kind,
@NotNull
SourceElement source,
boolean lateInit,
boolean isConst)
setType
public void setType(@NotNull
KotlinType outType,
@ReadOnly@NotNull
java.util.List<? extends TypeParameterDescriptor> typeParameters,
@Nullable
ReceiverParameterDescriptor dispatchReceiverParameter,
@Nullable
KotlinType receiverType)
setType
public void setType(@NotNull
KotlinType outType,
@ReadOnly@NotNull
java.util.List<? extends TypeParameterDescriptor> typeParameters,
@Nullable
ReceiverParameterDescriptor dispatchReceiverParameter,
@Nullable
ReceiverParameterDescriptor extensionReceiverParameter)
initialize
public void initialize(@Nullable
PropertyGetterDescriptorImpl getter,
@Nullable
PropertySetterDescriptor setter)
setSetterProjectedOut
public void setSetterProjectedOut(boolean setterProjectedOut)
setVisibility
public void setVisibility(@NotNull
Visibility visibility)
getTypeParameters
@NotNull
public java.util.List<TypeParameterDescriptor> getTypeParameters()
- Specified by:
getTypeParameters
in interface CallableDescriptor
- Overrides:
getTypeParameters
in class VariableDescriptorImpl
getExtensionReceiverParameter
@Nullable
public ReceiverParameterDescriptor getExtensionReceiverParameter()
- Specified by:
getExtensionReceiverParameter
in interface CallableDescriptor
- Overrides:
getExtensionReceiverParameter
in class VariableDescriptorImpl
getDispatchReceiverParameter
@Nullable
public ReceiverParameterDescriptor getDispatchReceiverParameter()
- Specified by:
getDispatchReceiverParameter
in interface CallableDescriptor
- Overrides:
getDispatchReceiverParameter
in class VariableDescriptorImpl
getReturnType
@NotNull
public KotlinType getReturnType()
- Description copied from interface:
CallableDescriptor
- Method may return null for not yet fully initialized object or if error occurred.
- Specified by:
getReturnType
in interface CallableDescriptor
- Overrides:
getReturnType
in class VariableDescriptorImpl
getModality
@NotNull
public Modality getModality()
- Specified by:
getModality
in interface MemberDescriptor
getVisibility
@NotNull
public Visibility getVisibility()
- Specified by:
getVisibility
in interface DeclarationDescriptorWithVisibility
- Specified by:
getVisibility
in interface MemberDescriptor
getGetter
@Nullable
public PropertyGetterDescriptorImpl getGetter()
- Specified by:
getGetter
in interface PropertyDescriptor
getSetter
@Nullable
public PropertySetterDescriptor getSetter()
- Specified by:
getSetter
in interface PropertyDescriptor
isSetterProjectedOut
public boolean isSetterProjectedOut()
- Description copied from interface:
PropertyDescriptor
- In the following case, the setter is projected out:
trait Tr { var v: T }
fun test(tr: Tr) {
tr.v = null!! // the assignment is illegal, although a read would be fine
}
- Specified by:
isSetterProjectedOut
in interface PropertyDescriptor
isLateInit
public boolean isLateInit()
- Specified by:
isLateInit
in interface PropertyDescriptor
isConst
public boolean isConst()
- Specified by:
isConst
in interface VariableDescriptor
- Overrides:
isConst
in class VariableDescriptorImpl
- Returns:
- true if iff original declaration has appropriate flags and type, e.g. `const` modifier in Kotlin.
It completely does not means that if isConst then `getCompileTimeInitializer` is not null
getAccessors
@NotNull
public java.util.List<PropertyAccessorDescriptor> getAccessors()
- Specified by:
getAccessors
in interface PropertyDescriptor
substitute
public PropertyDescriptor substitute(@NotNull
TypeSubstitutor originalSubstitutor)
- Specified by:
substitute
in interface CallableDescriptor
- Specified by:
substitute
in interface DeclarationDescriptor
- Specified by:
substitute
in interface PropertyDescriptor
- Specified by:
substitute
in interface VariableDescriptor
createSubstitutedCopy
@NotNull
protected PropertyDescriptorImpl createSubstitutedCopy(@NotNull
DeclarationDescriptor newOwner,
@NotNull
Modality newModality,
@NotNull
Visibility newVisibility,
@Nullable
PropertyDescriptor original,
@NotNull
CallableMemberDescriptor.Kind kind)
accept
public <R,D> R accept(DeclarationDescriptorVisitor<R,D> visitor,
D data)
- Specified by:
accept
in interface DeclarationDescriptor
getOriginal
@NotNull
public PropertyDescriptor getOriginal()
- Specified by:
getOriginal
in interface CallableDescriptor
- Specified by:
getOriginal
in interface CallableMemberDescriptor
- Specified by:
getOriginal
in interface DeclarationDescriptor
- Specified by:
getOriginal
in interface DeclarationDescriptorWithSource
- Specified by:
getOriginal
in interface PropertyDescriptor
- Overrides:
getOriginal
in class VariableDescriptorImpl
- Returns:
- The descriptor that corresponds to the original declaration of this element.
A descriptor can be obtained from its original by substituting type arguments (of the declaring class
or of the element itself).
returns
this
object if the current descriptor is original itself
getKind
@NotNull
public CallableMemberDescriptor.Kind getKind()
- Description copied from interface:
CallableMemberDescriptor
- Is this a real function or function projection.
- Specified by:
getKind
in interface CallableMemberDescriptor
setOverriddenDescriptors
public void setOverriddenDescriptors(@NotNull
java.util.Collection<? extends CallableMemberDescriptor> overriddenDescriptors)
- Specified by:
setOverriddenDescriptors
in interface CallableMemberDescriptor
getOverriddenDescriptors
@NotNull
public java.util.Collection<? extends PropertyDescriptor> getOverriddenDescriptors()
- Specified by:
getOverriddenDescriptors
in interface CallableDescriptor
- Specified by:
getOverriddenDescriptors
in interface CallableMemberDescriptor
- Specified by:
getOverriddenDescriptors
in interface PropertyDescriptor
- Overrides:
getOverriddenDescriptors
in class VariableDescriptorImpl
copy
@NotNull
public PropertyDescriptor copy(DeclarationDescriptor newOwner,
Modality modality,
Visibility visibility,
CallableMemberDescriptor.Kind kind,
boolean copyOverrides)
- Specified by:
copy
in interface CallableMemberDescriptor