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
+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())