default -> companion: replace all mentions of default and default object

This commit is contained in:
Pavel V. Talanov
2015-03-16 14:56:06 +03:00
parent a0783757e8
commit 06916d98c6
1019 changed files with 2468 additions and 2469 deletions
@@ -47,7 +47,7 @@ public final class JvmAbi {
//TODO: To be removed after kotlin M11
@Deprecated
public static final String DEPRECATED_DEFAULT_OBJECT_FIELD = "OBJECT$";
public static final String DEPRECATED_COMPANION_OBJECT_FIELD = "OBJECT$";
@NotNull
public static String getSyntheticMethodNameForAnnotatedProperty(@NotNull Name propertyName) {
@@ -85,7 +85,7 @@ class LazyJavaClassDescriptor(
override fun getUnsubstitutedPrimaryConstructor(): ConstructorDescriptor? = null
override fun getDefaultObjectDescriptor(): ClassDescriptor? = null
override fun getCompanionObjectDescriptor(): ClassDescriptor? = null
override fun getConstructors() = scopeForMemberLookup.constructors()
@@ -100,7 +100,7 @@ class LazyJavaClassDescriptor(
override fun getFunctionTypeForSamInterface(): JetType? = functionTypeForSamInterface()
override fun isDefaultObject() = false
override fun isCompanionObject() = false
override fun toString() = "lazy java class $fqName"
@@ -159,7 +159,7 @@ public abstract class AbstractBinaryClassAnnotationAndConstantLoader<A : Any, C
val classKind = Flags.CLASS_KIND[classProto.getFlags()]
val classId = nameResolver.getClassId(classProto.getFqName())
if (classKind == ProtoBuf.Class.Kind.CLASS_OBJECT && isStaticFieldInOuter(proto)) {
// Backing fields of properties of a default object are generated in the outer class
// Backing fields of properties of a companion object are generated in the outer class
return kotlinClassFinder.findKotlinClass(classId.getOuterClassId())
}
else if (classKind == ProtoBuf.Class.Kind.TRAIT && annotatedCallableKind == AnnotatedCallableKind.PROPERTY) {
@@ -64,7 +64,7 @@ public interface ClassDescriptor extends ClassifierDescriptor, MemberDescriptor,
* @return nested object declared as 'default' if one is present.
*/
@Nullable
ClassDescriptor getDefaultObjectDescriptor();
ClassDescriptor getCompanionObjectDescriptor();
@NotNull
ClassKind getKind();
@@ -82,7 +82,7 @@ public interface ClassDescriptor extends ClassifierDescriptor, MemberDescriptor,
*/
boolean isInner();
boolean isDefaultObject();
boolean isCompanionObject();
@NotNull
ReceiverParameterDescriptor getThisAsReceiverParameter();
@@ -40,7 +40,7 @@ public class Visibilities {
DeclarationDescriptor parent = what;
while (parent != null) {
parent = parent.getContainingDeclaration();
if ((parent instanceof ClassDescriptor && !DescriptorUtils.isDefaultObject(parent)) ||
if ((parent instanceof ClassDescriptor && !DescriptorUtils.isCompanionObject(parent)) ||
parent instanceof PackageFragmentDescriptor) {
break;
}
@@ -97,7 +97,7 @@ public class Visibilities {
@Override
protected boolean isVisible(@NotNull ReceiverValue receiver, @NotNull DeclarationDescriptorWithVisibility what, @NotNull DeclarationDescriptor from) {
ClassDescriptor classDescriptor = DescriptorUtils.getParentOfType(what, ClassDescriptor.class);
if (DescriptorUtils.isDefaultObject(classDescriptor)) {
if (DescriptorUtils.isCompanionObject(classDescriptor)) {
classDescriptor = DescriptorUtils.getParentOfType(classDescriptor, ClassDescriptor.class);
}
if (classDescriptor == null) return false;
@@ -152,7 +152,7 @@ public abstract class AbstractTypeParameterDescriptor extends DeclarationDescrip
@Override
public JetType getClassObjectType() {
// TODO: default object bounds
// TODO: companion object bounds
return null;
}
@@ -101,7 +101,7 @@ public class ClassDescriptorImpl extends ClassDescriptorBase {
@Nullable
@Override
public ClassDescriptor getDefaultObjectDescriptor() {
public ClassDescriptor getCompanionObjectDescriptor() {
return null;
}
@@ -112,7 +112,7 @@ public class ClassDescriptorImpl extends ClassDescriptorBase {
}
@Override
public boolean isDefaultObject() {
public boolean isCompanionObject() {
return false;
}
@@ -50,7 +50,7 @@ public class EnumEntrySyntheticClassDescriptor extends ClassDescriptorBase {
private final NotNullLazyValue<Collection<Name>> enumMemberNames;
/**
* Creates and initializes descriptors for enum entry with the given name and its default object
* Creates and initializes descriptors for enum entry with the given name and its companion object
* @param enumMemberNames needed for fake overrides resolution
*/
@NotNull
@@ -115,7 +115,7 @@ public class EnumEntrySyntheticClassDescriptor extends ClassDescriptorBase {
@Nullable
@Override
public ClassDescriptor getDefaultObjectDescriptor() {
public ClassDescriptor getCompanionObjectDescriptor() {
return null;
}
@@ -143,7 +143,7 @@ public class EnumEntrySyntheticClassDescriptor extends ClassDescriptorBase {
}
@Override
public boolean isDefaultObject() {
public boolean isCompanionObject() {
return false;
}
@@ -219,7 +219,7 @@ public class EnumEntrySyntheticClassDescriptor extends ClassDescriptorBase {
@NotNull
private JetScope getSupertypeScope() {
Collection<JetType> supertype = getTypeConstructor().getSupertypes();
assert supertype.size() == 1 : "Enum entry and its default object both should have exactly one supertype: " + supertype;
assert supertype.size() == 1 : "Enum entry and its companion object both should have exactly one supertype: " + supertype;
return supertype.iterator().next().getMemberScope();
}
@@ -169,8 +169,8 @@ public class LazySubstitutingClassDescriptor implements ClassDescriptor {
}
@Override
public ClassDescriptor getDefaultObjectDescriptor() {
return original.getDefaultObjectDescriptor();
public ClassDescriptor getCompanionObjectDescriptor() {
return original.getCompanionObjectDescriptor();
}
@NotNull
@@ -197,8 +197,8 @@ public class LazySubstitutingClassDescriptor implements ClassDescriptor {
}
@Override
public boolean isDefaultObject() {
return original.isDefaultObject();
public boolean isCompanionObject() {
return original.isCompanionObject();
}
@Override
@@ -23,7 +23,7 @@ public class SpecialNames {
public static final Name NO_NAME_PROVIDED = Name.special("<no name provided>");
public static final Name ROOT_PACKAGE = Name.special("<root package>");
public static final Name DEFAULT_NAME_FOR_DEFAULT_OBJECT = Name.identifier("Default");
public static final Name DEFAULT_NAME_FOR_COMPANION_OBJECT = Name.identifier("Companion");
// This name is used as a key for the case when something has no name _due to a syntactic error_
// Example: fun (x: Int) = 5
@@ -53,7 +53,7 @@ public interface DescriptorRenderer extends Renderer<DeclarationDescriptor> {
.setWithoutTypeParameters(true)
.setWithoutFunctionParameterNames(true)
.setReceiverAfterName(true)
.setRenderDefaultObjectName(true)
.setRenderCompanionObjectName(true)
.setWithoutSuperTypes(true)
.setStartFromName(true).build();
@@ -78,7 +78,7 @@ public interface DescriptorRenderer extends Renderer<DeclarationDescriptor> {
DescriptorRenderer HTML_NAMES_WITH_SHORT_TYPES = new DescriptorRendererBuilder()
.setWithDefinedIn(false)
.setNameShortness(NameShortness.SHORT)
.setRenderDefaultObjectName(true)
.setRenderCompanionObjectName(true)
.setTextFormat(TextFormat.HTML).build();
DescriptorRenderer HTML = new DescriptorRendererBuilder().setTextFormat(TextFormat.HTML).build();
@@ -64,7 +64,7 @@ public class DescriptorRendererBuilder {
@NotNull
private Collection<FqName> excludedAnnotationClasses = Collections.emptyList();
private boolean receiverAfterName = false;
private boolean renderDefaultObjectName = false;
private boolean renderCompanionObjectName = false;
public DescriptorRendererBuilder() {
}
@@ -201,8 +201,8 @@ public class DescriptorRendererBuilder {
}
@NotNull
public DescriptorRendererBuilder setRenderDefaultObjectName(boolean renderDefaultObjectName) {
this.renderDefaultObjectName = renderDefaultObjectName;
public DescriptorRendererBuilder setRenderCompanionObjectName(boolean renderCompanionObjectName) {
this.renderCompanionObjectName = renderCompanionObjectName;
return this;
}
@@ -243,7 +243,7 @@ public class DescriptorRendererBuilder {
normalizedVisibilities, showInternalKeyword, prettyFunctionTypes, uninferredTypeParameterAsName,
overrideRenderingPolicy, valueParametersHandler, textFormat, excludedAnnotationClasses, includePropertyConstant,
includeSynthesizedParameterNames, withoutFunctionParameterNames, withoutTypeParameters, receiverAfterName,
renderDefaultObjectName, withoutSuperTypes, typeNormalizer, renderDefaultValues, flexibleTypesForCode,
renderCompanionObjectName, withoutSuperTypes, typeNormalizer, renderDefaultValues, flexibleTypesForCode,
secondaryConstructorsAsPrimary);
}
@@ -42,7 +42,7 @@ import org.jetbrains.kotlin.utils.UtilsPackage;
import java.util.*;
import static org.jetbrains.kotlin.resolve.DescriptorUtils.isDefaultObject;
import static org.jetbrains.kotlin.resolve.DescriptorUtils.isCompanionObject;
import static org.jetbrains.kotlin.types.TypeUtils.CANT_INFER_FUNCTION_PARAM_TYPE;
public class DescriptorRendererImpl implements DescriptorRenderer {
@@ -63,7 +63,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
private final boolean includeSynthesizedParameterNames;
private final boolean withoutFunctionParameterNames;
private final boolean withoutTypeParameters;
private final boolean renderDefaultObjectName;
private final boolean renderCompanionObjectName;
private final boolean withoutSuperTypes;
private final boolean receiverAfterName;
private final boolean renderDefaultValues;
@@ -102,7 +102,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
boolean withoutFunctionParameterNames,
boolean withoutTypeParameters,
boolean receiverAfterName,
boolean renderDefaultObjectName,
boolean renderCompanionObjectName,
boolean withoutSuperTypes,
@NotNull Function1<JetType, JetType> typeNormalizer,
boolean renderDefaultValues,
@@ -131,7 +131,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
this.withoutFunctionParameterNames = withoutFunctionParameterNames;
this.withoutTypeParameters = withoutTypeParameters;
this.receiverAfterName = receiverAfterName;
this.renderDefaultObjectName = renderDefaultObjectName;
this.renderCompanionObjectName = renderCompanionObjectName;
this.withoutSuperTypes = withoutSuperTypes;
this.typeNormalizer = typeNormalizer;
this.renderDefaultValues = renderDefaultValues;
@@ -238,10 +238,10 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
builder.append(renderName(descriptor.getName()));
}
private void renderDefaultObjectName(@NotNull DeclarationDescriptor descriptor, @NotNull StringBuilder builder) {
if (renderDefaultObjectName) {
private void renderCompanionObjectName(@NotNull DeclarationDescriptor descriptor, @NotNull StringBuilder builder) {
if (renderCompanionObjectName) {
if (startFromName) {
builder.append("default object");
builder.append("companion object");
}
renderSpaceIfNeeded(builder);
DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration();
@@ -958,12 +958,12 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
renderClassKindPrefix(klass, builder);
}
if (!isDefaultObject(klass)) {
if (!isCompanionObject(klass)) {
if (!startFromName) renderSpaceIfNeeded(builder);
renderName(klass, builder);
}
else {
renderDefaultObjectName(klass, builder);
renderCompanionObjectName(klass, builder);
}
List<TypeParameterDescriptor> typeParameters = klass.getTypeConstructor().getParameters();
@@ -1009,8 +1009,8 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
@NotNull
public static String getClassKindPrefix(@NotNull ClassDescriptor klass) {
if (klass.isDefaultObject()) {
return "default object";
if (klass.isCompanionObject()) {
return "companion object";
}
switch (klass.getKind()) {
case CLASS:
@@ -193,7 +193,7 @@ public class DescriptorUtils {
public static ClassDescriptor getContainingClass(@NotNull DeclarationDescriptor descriptor) {
DeclarationDescriptor containing = descriptor.getContainingDeclaration();
while (containing != null) {
if (containing instanceof ClassDescriptor && !isDefaultObject(containing)) {
if (containing instanceof ClassDescriptor && !isCompanionObject(containing)) {
return (ClassDescriptor) containing;
}
containing = containing.getContainingDeclaration();
@@ -253,16 +253,16 @@ public class DescriptorUtils {
return descriptor instanceof FunctionExpressionDescriptor;
}
public static boolean isDefaultObject(@Nullable DeclarationDescriptor descriptor) {
return isKindOf(descriptor, ClassKind.OBJECT) && ((ClassDescriptor) descriptor).isDefaultObject();
public static boolean isCompanionObject(@Nullable DeclarationDescriptor descriptor) {
return isKindOf(descriptor, ClassKind.OBJECT) && ((ClassDescriptor) descriptor).isCompanionObject();
}
public static boolean isAnonymousObject(@NotNull DeclarationDescriptor descriptor) {
return isClass(descriptor) && descriptor.getName().equals(SpecialNames.NO_NAME_PROVIDED);
}
public static boolean isNonDefaultObject(@NotNull DeclarationDescriptor descriptor) {
return isKindOf(descriptor, ClassKind.OBJECT) && !((ClassDescriptor) descriptor).isDefaultObject();
public static boolean isNonCompanionObject(@NotNull DeclarationDescriptor descriptor) {
return isKindOf(descriptor, ClassKind.OBJECT) && !((ClassDescriptor) descriptor).isCompanionObject();
}
public static boolean isObject(@NotNull DeclarationDescriptor descriptor) {
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
public fun ClassDescriptor.getClassObjectReferenceTarget(): ClassDescriptor = getDefaultObjectDescriptor() ?: this
public fun ClassDescriptor.getClassObjectReferenceTarget(): ClassDescriptor = getCompanionObjectDescriptor() ?: this
public fun DeclarationDescriptor.getImportableDescriptor(): DeclarationDescriptor {
return when {
@@ -67,7 +67,7 @@ public val ClassDescriptor.classObjectDescriptor: ClassDescriptor?
assert(container is ClassDescriptor && container.getKind() == ENUM_CLASS)
container as ClassDescriptor
}
else -> getDefaultObjectDescriptor()
else -> getCompanionObjectDescriptor()
}
}
@@ -144,8 +144,8 @@ public class MemberComparator implements Comparator<DeclarationDescriptor> {
return class1.getKind().ordinal() - class2.getKind().ordinal();
}
if (class1.isDefaultObject() != class2.isDefaultObject()) {
return class1.isDefaultObject() ? 1 : -1;
if (class1.isCompanionObject() != class2.isCompanionObject()) {
return class1.isCompanionObject() ? 1 : -1;
}
}
else {
@@ -32,7 +32,7 @@ public class EnumValue extends CompileTimeConstant<ClassDescriptor> {
@Override
public JetType getType(@NotNull KotlinBuiltIns kotlinBuiltIns) {
JetType type = value.getClassObjectType();
assert type != null : "Enum entry should have a default object: " + value;
assert type != null : "Enum entry should have a companion object: " + value;
return type;
}
@@ -59,10 +59,10 @@ object RuntimeTypeMapper : JavaToKotlinClassMapBuilder() {
kotlinFqNameToJvmDesc[DescriptorUtils.getFqNameSafe(kotlinDescriptor)] = jvmDesc
jvmDescToKotlinClassId[jvmDesc] = kotlinDescriptor.classId
val defaultObject = kotlinDescriptor.getDefaultObjectDescriptor()
if (defaultObject != null) {
val companionObject = kotlinDescriptor.getCompanionObjectDescriptor()
if (companionObject != null) {
// TODO: see org.jetbrains.kotlin.codegen.intrinsics.IntrinsicObjects, extract that logic to core/
recordMapping(defaultObject, "Lkotlin/jvm/internal/${kotlinDescriptor.getName().asString()}DefaultObject;")
recordMapping(companionObject, "Lkotlin/jvm/internal/${kotlinDescriptor.getName().asString()}CompanionObject;")
}
}
@@ -16,22 +16,22 @@
package kotlin.jvm.internal
private object DoubleDefaultObject : FloatingPointConstants<Double> {
private object DoubleCompanionObject : FloatingPointConstants<Double> {
override val POSITIVE_INFINITY : Double = java.lang.Double.POSITIVE_INFINITY
override val NEGATIVE_INFINITY : Double = java.lang.Double.NEGATIVE_INFINITY
override val NaN : Double = java.lang.Double.NaN
}
private object FloatDefaultObject : FloatingPointConstants<Float> {
private object FloatCompanionObject : FloatingPointConstants<Float> {
override val POSITIVE_INFINITY : Float = java.lang.Float.POSITIVE_INFINITY
override val NEGATIVE_INFINITY : Float = java.lang.Float.NEGATIVE_INFINITY
override val NaN : Float = java.lang.Float.NaN
}
private object IntDefaultObject {}
private object LongDefaultObject {}
private object ShortDefaultObject {}
private object ByteDefaultObject {}
private object IntCompanionObject {}
private object LongCompanionObject {}
private object ShortCompanionObject {}
private object ByteCompanionObject {}
private object StringDefaultObject {}
private object EnumDefaultObject {}
private object StringCompanionObject {}
private object EnumCompanionObject {}
@@ -52,7 +52,7 @@ message JvmFieldSignature {
required int32 name = 1;
required JvmType type = 2;
// True iff this field is a backing field for a default object and is really present as a static
// True iff this field is a backing field for a companion object and is really present as a static
// field in the outer class, not as an instance field here
optional bool is_static_in_outer = 3 [default = false];
}
@@ -1379,7 +1379,7 @@ public final class JvmProtoBuf {
* <code>optional bool is_static_in_outer = 3 [default = false];</code>
*
* <pre>
* True iff this field is a backing field for a default object and is really present as a static
* True iff this field is a backing field for a companion object and is really present as a static
* field in the outer class, not as an instance field here
* </pre>
*/
@@ -1388,7 +1388,7 @@ public final class JvmProtoBuf {
* <code>optional bool is_static_in_outer = 3 [default = false];</code>
*
* <pre>
* True iff this field is a backing field for a default object and is really present as a static
* True iff this field is a backing field for a companion object and is really present as a static
* field in the outer class, not as an instance field here
* </pre>
*/
@@ -1526,7 +1526,7 @@ public final class JvmProtoBuf {
* <code>optional bool is_static_in_outer = 3 [default = false];</code>
*
* <pre>
* True iff this field is a backing field for a default object and is really present as a static
* True iff this field is a backing field for a companion object and is really present as a static
* field in the outer class, not as an instance field here
* </pre>
*/
@@ -1537,7 +1537,7 @@ public final class JvmProtoBuf {
* <code>optional bool is_static_in_outer = 3 [default = false];</code>
*
* <pre>
* True iff this field is a backing field for a default object and is really present as a static
* True iff this field is a backing field for a companion object and is really present as a static
* field in the outer class, not as an instance field here
* </pre>
*/
@@ -1880,7 +1880,7 @@ public final class JvmProtoBuf {
* <code>optional bool is_static_in_outer = 3 [default = false];</code>
*
* <pre>
* True iff this field is a backing field for a default object and is really present as a static
* True iff this field is a backing field for a companion object and is really present as a static
* field in the outer class, not as an instance field here
* </pre>
*/
@@ -1891,7 +1891,7 @@ public final class JvmProtoBuf {
* <code>optional bool is_static_in_outer = 3 [default = false];</code>
*
* <pre>
* True iff this field is a backing field for a default object and is really present as a static
* True iff this field is a backing field for a companion object and is really present as a static
* field in the outer class, not as an instance field here
* </pre>
*/
@@ -1902,7 +1902,7 @@ public final class JvmProtoBuf {
* <code>optional bool is_static_in_outer = 3 [default = false];</code>
*
* <pre>
* True iff this field is a backing field for a default object and is really present as a static
* True iff this field is a backing field for a companion object and is really present as a static
* field in the outer class, not as an instance field here
* </pre>
*/
@@ -1916,7 +1916,7 @@ public final class JvmProtoBuf {
* <code>optional bool is_static_in_outer = 3 [default = false];</code>
*
* <pre>
* True iff this field is a backing field for a default object and is really present as a static
* True iff this field is a backing field for a companion object and is really present as a static
* field in the outer class, not as an instance field here
* </pre>
*/
+2 -2
View File
@@ -179,8 +179,8 @@ message Class {
required int32 fq_name = 3;
// If this field is present, it contains the name of default object.
optional int32 default_object_name = 4;
// If this field is present, it contains the name of companion object.
optional int32 companion_object_name = 4;
repeated TypeParameter type_parameter = 5;
repeated Type supertype = 6;
@@ -83,7 +83,7 @@ public class DescriptorSerializer {
ProtoBuf.Class.Builder builder = ProtoBuf.Class.newBuilder();
int flags = Flags.getClassFlags(hasAnnotations(classDescriptor), classDescriptor.getVisibility(), classDescriptor.getModality(),
classDescriptor.getKind(), classDescriptor.isInner(), classDescriptor.isDefaultObject());
classDescriptor.getKind(), classDescriptor.isInner(), classDescriptor.isCompanionObject());
builder.setFlags(flags);
builder.setFqName(getClassId(classDescriptor));
@@ -133,9 +133,9 @@ public class DescriptorSerializer {
}
}
ClassDescriptor defaultObjectDescriptor = classDescriptor.getDefaultObjectDescriptor();
if (defaultObjectDescriptor != null) {
builder.setDefaultObjectName(stringTable.getSimpleNameIndex(defaultObjectDescriptor.getName()));
ClassDescriptor companionObjectDescriptor = classDescriptor.getCompanionObjectDescriptor();
if (companionObjectDescriptor != null) {
builder.setCompanionObjectName(stringTable.getSimpleNameIndex(companionObjectDescriptor.getName()));
}
extension.serializeClass(classDescriptor, builder, stringTable);
@@ -74,18 +74,18 @@ public class Flags {
Modality modality,
ClassKind kind,
boolean inner,
boolean isDefaultObject
boolean isCompanionObject
) {
return HAS_ANNOTATIONS.toFlags(hasAnnotations)
| MODALITY.toFlags(modality(modality))
| VISIBILITY.toFlags(visibility(visibility))
| CLASS_KIND.toFlags(classKind(kind, isDefaultObject))
| CLASS_KIND.toFlags(classKind(kind, isCompanionObject))
| INNER.toFlags(inner)
;
}
private static ProtoBuf.Class.Kind classKind(ClassKind kind, boolean isDefaultObject) {
if (isDefaultObject) return ProtoBuf.Class.Kind.CLASS_OBJECT;
private static ProtoBuf.Class.Kind classKind(ClassKind kind, boolean isCompanionObject) {
if (isCompanionObject) return ProtoBuf.Class.Kind.CLASS_OBJECT;
switch (kind) {
case CLASS:
@@ -7306,23 +7306,23 @@ public final class ProtoBuf {
*/
int getFqName();
// optional int32 default_object_name = 4;
// optional int32 companion_object_name = 4;
/**
* <code>optional int32 default_object_name = 4;</code>
* <code>optional int32 companion_object_name = 4;</code>
*
* <pre>
* If this field is present, it contains the name of default object.
* If this field is present, it contains the name of companion object.
* </pre>
*/
boolean hasDefaultObjectName();
boolean hasCompanionObjectName();
/**
* <code>optional int32 default_object_name = 4;</code>
* <code>optional int32 companion_object_name = 4;</code>
*
* <pre>
* If this field is present, it contains the name of default object.
* If this field is present, it contains the name of companion object.
* </pre>
*/
int getDefaultObjectName();
int getCompanionObjectName();
// repeated .org.jetbrains.kotlin.serialization.TypeParameter type_parameter = 5;
/**
@@ -7500,7 +7500,7 @@ public final class ProtoBuf {
}
case 32: {
bitField0_ |= 0x00000004;
defaultObjectName_ = input.readInt32();
companionObjectName_ = input.readInt32();
break;
}
case 42: {
@@ -8225,28 +8225,28 @@ public final class ProtoBuf {
return fqName_;
}
// optional int32 default_object_name = 4;
public static final int DEFAULT_OBJECT_NAME_FIELD_NUMBER = 4;
private int defaultObjectName_;
// optional int32 companion_object_name = 4;
public static final int COMPANION_OBJECT_NAME_FIELD_NUMBER = 4;
private int companionObjectName_;
/**
* <code>optional int32 default_object_name = 4;</code>
* <code>optional int32 companion_object_name = 4;</code>
*
* <pre>
* If this field is present, it contains the name of default object.
* If this field is present, it contains the name of companion object.
* </pre>
*/
public boolean hasDefaultObjectName() {
public boolean hasCompanionObjectName() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional int32 default_object_name = 4;</code>
* <code>optional int32 companion_object_name = 4;</code>
*
* <pre>
* If this field is present, it contains the name of default object.
* If this field is present, it contains the name of companion object.
* </pre>
*/
public int getDefaultObjectName() {
return defaultObjectName_;
public int getCompanionObjectName() {
return companionObjectName_;
}
// repeated .org.jetbrains.kotlin.serialization.TypeParameter type_parameter = 5;
@@ -8481,7 +8481,7 @@ public final class ProtoBuf {
private void initFields() {
flags_ = 0;
fqName_ = 0;
defaultObjectName_ = 0;
companionObjectName_ = 0;
typeParameter_ = java.util.Collections.emptyList();
supertype_ = java.util.Collections.emptyList();
nestedClassName_ = java.util.Collections.emptyList();
@@ -8550,7 +8550,7 @@ public final class ProtoBuf {
output.writeInt32(3, fqName_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeInt32(4, defaultObjectName_);
output.writeInt32(4, companionObjectName_);
}
for (int i = 0; i < typeParameter_.size(); i++) {
output.writeMessage(5, typeParameter_.get(i));
@@ -8592,7 +8592,7 @@ public final class ProtoBuf {
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(4, defaultObjectName_);
.computeInt32Size(4, companionObjectName_);
}
for (int i = 0; i < typeParameter_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
@@ -8727,7 +8727,7 @@ public final class ProtoBuf {
bitField0_ = (bitField0_ & ~0x00000001);
fqName_ = 0;
bitField0_ = (bitField0_ & ~0x00000002);
defaultObjectName_ = 0;
companionObjectName_ = 0;
bitField0_ = (bitField0_ & ~0x00000004);
typeParameter_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000008);
@@ -8777,7 +8777,7 @@ public final class ProtoBuf {
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000004;
}
result.defaultObjectName_ = defaultObjectName_;
result.companionObjectName_ = companionObjectName_;
if (((bitField0_ & 0x00000008) == 0x00000008)) {
typeParameter_ = java.util.Collections.unmodifiableList(typeParameter_);
bitField0_ = (bitField0_ & ~0x00000008);
@@ -8824,8 +8824,8 @@ public final class ProtoBuf {
if (other.hasFqName()) {
setFqName(other.getFqName());
}
if (other.hasDefaultObjectName()) {
setDefaultObjectName(other.getDefaultObjectName());
if (other.hasCompanionObjectName()) {
setCompanionObjectName(other.getCompanionObjectName());
}
if (!other.typeParameter_.isEmpty()) {
if (typeParameter_.isEmpty()) {
@@ -9057,51 +9057,51 @@ public final class ProtoBuf {
return this;
}
// optional int32 default_object_name = 4;
private int defaultObjectName_ ;
// optional int32 companion_object_name = 4;
private int companionObjectName_ ;
/**
* <code>optional int32 default_object_name = 4;</code>
* <code>optional int32 companion_object_name = 4;</code>
*
* <pre>
* If this field is present, it contains the name of default object.
* If this field is present, it contains the name of companion object.
* </pre>
*/
public boolean hasDefaultObjectName() {
public boolean hasCompanionObjectName() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional int32 default_object_name = 4;</code>
* <code>optional int32 companion_object_name = 4;</code>
*
* <pre>
* If this field is present, it contains the name of default object.
* If this field is present, it contains the name of companion object.
* </pre>
*/
public int getDefaultObjectName() {
return defaultObjectName_;
public int getCompanionObjectName() {
return companionObjectName_;
}
/**
* <code>optional int32 default_object_name = 4;</code>
* <code>optional int32 companion_object_name = 4;</code>
*
* <pre>
* If this field is present, it contains the name of default object.
* If this field is present, it contains the name of companion object.
* </pre>
*/
public Builder setDefaultObjectName(int value) {
public Builder setCompanionObjectName(int value) {
bitField0_ |= 0x00000004;
defaultObjectName_ = value;
companionObjectName_ = value;
return this;
}
/**
* <code>optional int32 default_object_name = 4;</code>
* <code>optional int32 companion_object_name = 4;</code>
*
* <pre>
* If this field is present, it contains the name of default object.
* If this field is present, it contains the name of companion object.
* </pre>
*/
public Builder clearDefaultObjectName() {
public Builder clearCompanionObjectName() {
bitField0_ = (bitField0_ & ~0x00000004);
defaultObjectName_ = 0;
companionObjectName_ = 0;
return this;
}
@@ -64,7 +64,7 @@ public class DeserializedClassDescriptor(
private val containingDeclaration = outerContext.containingDeclaration
private val primaryConstructor = c.storageManager.createNullableLazyValue { computePrimaryConstructor() }
private val constructors = c.storageManager.createLazyValue { computeConstructors() }
private val defaultObjectDescriptor = c.storageManager.createNullableLazyValue { computeDefaultObjectDescriptor() }
private val companionObjectDescriptor = c.storageManager.createNullableLazyValue { computeCompanionObjectDescriptor() }
private val annotations =
if (!Flags.HAS_ANNOTATIONS.get(classProto.getFlags())) {
@@ -92,7 +92,7 @@ public class DeserializedClassDescriptor(
override fun getStaticScope() = staticScope
override fun isDefaultObject(): Boolean = isDefault
override fun isCompanionObject(): Boolean = isDefault
private fun computePrimaryConstructor(): ConstructorDescriptor? {
if (!classProto.hasPrimaryConstructor()) return null
@@ -119,14 +119,14 @@ public class DeserializedClassDescriptor(
override fun getConstructors() = constructors()
private fun computeDefaultObjectDescriptor(): ClassDescriptor? {
if (!classProto.hasDefaultObjectName()) return null
private fun computeCompanionObjectDescriptor(): ClassDescriptor? {
if (!classProto.hasCompanionObjectName()) return null
val defaultObjectName = c.nameResolver.getName(classProto.getDefaultObjectName())
return memberScope.getClassifier(defaultObjectName) as? ClassDescriptor
val companionObjectName = c.nameResolver.getName(classProto.getCompanionObjectName())
return memberScope.getClassifier(companionObjectName) as? ClassDescriptor
}
override fun getDefaultObjectDescriptor(): ClassDescriptor? = defaultObjectDescriptor()
override fun getCompanionObjectDescriptor(): ClassDescriptor? = companionObjectDescriptor()
private fun computeSuperTypes(): Collection<JetType> {
val supertypes = ArrayList<JetType>(classProto.getSupertypeCount())