Get rid of 'class object' usages in code and builtins
Replace some comments and library usages as well
This commit is contained in:
@@ -22,7 +22,7 @@ package kotlin
|
||||
* information on enum classes.
|
||||
*/
|
||||
public abstract class Enum<E : Enum<E>>(name: String, ordinal: Int): Comparable<E> {
|
||||
class object Companion {}
|
||||
companion object {}
|
||||
|
||||
/**
|
||||
* Returns the name of this enum constant, exactly as declared in its enum declaration.
|
||||
|
||||
@@ -23,7 +23,7 @@ package kotlin
|
||||
* On the JVM, non-nullable values of this type are represented as values of the primitive type `byte`.
|
||||
*/
|
||||
public class Byte private () : Number, Comparable<Byte> {
|
||||
class object Companion {}
|
||||
companion object {}
|
||||
|
||||
/**
|
||||
* Compares this value with the specified value for order.
|
||||
@@ -181,7 +181,7 @@ public class Byte private () : Number, Comparable<Byte> {
|
||||
* On the JVM, non-nullable values of this type are represented as values of the primitive type `char`.
|
||||
*/
|
||||
public class Char private () : Comparable<Char> {
|
||||
class object Companion {}
|
||||
companion object {}
|
||||
|
||||
/**
|
||||
* Compares the character code of this character with the specified value for order.
|
||||
@@ -326,7 +326,7 @@ public class Char private () : Comparable<Char> {
|
||||
* On the JVM, non-nullable values of this type are represented as values of the primitive type `short`.
|
||||
*/
|
||||
public class Short private () : Number, Comparable<Short> {
|
||||
class object Companion {}
|
||||
companion object {}
|
||||
|
||||
/**
|
||||
* Compares this value with the specified value for order.
|
||||
@@ -484,7 +484,7 @@ public class Short private () : Number, Comparable<Short> {
|
||||
* On the JVM, non-nullable values of this type are represented as values of the primitive type `int`.
|
||||
*/
|
||||
public class Int private () : Number, Comparable<Int> {
|
||||
class object Companion {}
|
||||
companion object {}
|
||||
|
||||
/**
|
||||
* Compares this value with the specified value for order.
|
||||
@@ -657,7 +657,7 @@ public class Int private () : Number, Comparable<Int> {
|
||||
* On the JVM, non-nullable values of this type are represented as values of the primitive type `long`.
|
||||
*/
|
||||
public class Long private () : Number, Comparable<Long> {
|
||||
class object Companion {}
|
||||
companion object {}
|
||||
|
||||
/**
|
||||
* Compares this value with the specified value for order.
|
||||
@@ -830,7 +830,7 @@ public class Long private () : Number, Comparable<Long> {
|
||||
* On the JVM, non-nullable values of this type are represented as values of the primitive type `float`.
|
||||
*/
|
||||
public class Float private () : Number, Comparable<Float> {
|
||||
class object Companion : FloatingPointConstants<Float> {}
|
||||
companion object : FloatingPointConstants<Float> {}
|
||||
|
||||
/**
|
||||
* Compares this value with the specified value for order.
|
||||
@@ -988,7 +988,7 @@ public class Float private () : Number, Comparable<Float> {
|
||||
* On the JVM, non-nullable values of this type are represented as values of the primitive type `double`.
|
||||
*/
|
||||
public class Double private () : Number, Comparable<Double> {
|
||||
class object Companion : FloatingPointConstants<Double> {}
|
||||
companion object : FloatingPointConstants<Double> {}
|
||||
|
||||
/**
|
||||
* Compares this value with the specified value for order.
|
||||
|
||||
@@ -21,7 +21,7 @@ package kotlin
|
||||
* implemented as instances of this class.
|
||||
*/
|
||||
public class String : Comparable<String>, CharSequence {
|
||||
class object Companion {}
|
||||
companion object {}
|
||||
|
||||
/**
|
||||
* Returns a string obtained by concatenating this string with the string representation of the given [other] object.
|
||||
|
||||
@@ -38,7 +38,7 @@ public class ByteRange(override val start: Byte, override val end: Byte) : Range
|
||||
override fun hashCode(): Int =
|
||||
if (isEmpty()) -1 else (31 * start.toInt() + end)
|
||||
|
||||
class object Companion {
|
||||
companion object {
|
||||
/** An empty range of values of type Byte. */
|
||||
public val EMPTY: ByteRange = ByteRange(1, 0)
|
||||
}
|
||||
@@ -64,7 +64,7 @@ public class CharRange(override val start: Char, override val end: Char) : Range
|
||||
override fun hashCode(): Int =
|
||||
if (isEmpty()) -1 else (31 * start.toInt() + end)
|
||||
|
||||
class object Companion {
|
||||
companion object {
|
||||
/** An empty range of values of type Char. */
|
||||
public val EMPTY: CharRange = CharRange(1.toChar(), 0.toChar())
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public class ShortRange(override val start: Short, override val end: Short) : Ra
|
||||
override fun hashCode(): Int =
|
||||
if (isEmpty()) -1 else (31 * start.toInt() + end)
|
||||
|
||||
class object Companion {
|
||||
companion object {
|
||||
/** An empty range of values of type Short. */
|
||||
public val EMPTY: ShortRange = ShortRange(1, 0)
|
||||
}
|
||||
@@ -116,7 +116,7 @@ public class IntRange(override val start: Int, override val end: Int) : Range<In
|
||||
override fun hashCode(): Int =
|
||||
if (isEmpty()) -1 else (31 * start + end)
|
||||
|
||||
class object Companion {
|
||||
companion object {
|
||||
/** An empty range of values of type Int. */
|
||||
public val EMPTY: IntRange = IntRange(1, 0)
|
||||
}
|
||||
@@ -142,7 +142,7 @@ public class LongRange(override val start: Long, override val end: Long) : Range
|
||||
override fun hashCode(): Int =
|
||||
if (isEmpty()) -1 else (31 * (start xor (start ushr 32)) + (end xor (end ushr 32))).toInt()
|
||||
|
||||
class object Companion {
|
||||
companion object {
|
||||
/** An empty range of values of type Long. */
|
||||
public val EMPTY: LongRange = LongRange(1, 0)
|
||||
}
|
||||
@@ -168,7 +168,7 @@ public class FloatRange(override val start: Float, override val end: Float) : Ra
|
||||
override fun hashCode(): Int =
|
||||
if (isEmpty()) -1 else (31 * java.lang.Float.floatToIntBits(start) + java.lang.Float.floatToIntBits(end))
|
||||
|
||||
class object Companion {
|
||||
companion object {
|
||||
/** An empty range of values of type Float. */
|
||||
public val EMPTY: FloatRange = FloatRange(1.0f, 0.0f)
|
||||
}
|
||||
@@ -199,7 +199,7 @@ public class DoubleRange(override val start: Double, override val end: Double) :
|
||||
return (31 * result + (temp xor (temp ushr 32))).toInt()
|
||||
}
|
||||
|
||||
class object Companion {
|
||||
companion object {
|
||||
/** An empty range of values of type Double. */
|
||||
public val EMPTY: DoubleRange = DoubleRange(1.0, 0.0)
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.resolve.scopes.JetScope
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
|
||||
public trait SamConversionResolver {
|
||||
public class object EMPTY : SamConversionResolver {
|
||||
public companion object EMPTY : SamConversionResolver {
|
||||
override fun <D : FunctionDescriptor> resolveSamAdapter(original: D) = null
|
||||
override fun resolveSamConstructor(name: Name, scope: JetScope) = null
|
||||
override fun resolveFunctionTypeIfSamInterface(
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.name.Name
|
||||
// The purpose of this class is to hold a unique signature of either a method or a field, so that annotations on a member can be put
|
||||
// into a map indexed by these signatures
|
||||
data class MemberSignature private(private val signature: String) {
|
||||
class object {
|
||||
companion object {
|
||||
platformStatic public fun fromMethodNameAndDesc(nameAndDesc: String): MemberSignature {
|
||||
return MemberSignature(nameAndDesc)
|
||||
}
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.name.Name
|
||||
abstract class ReflectJavaAnnotationArgument(
|
||||
override val name: Name?
|
||||
) : JavaAnnotationArgument {
|
||||
class object Factory {
|
||||
companion object Factory {
|
||||
fun create(value: Any, name: Name?): ReflectJavaAnnotationArgument {
|
||||
return when {
|
||||
value.javaClass.isEnumClassOrSpecializedEnumEntryClass() -> ReflectJavaEnumValueAnnotationArgument(name, value as Enum<*>)
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public abstract class ReflectJavaType : JavaType {
|
||||
|
||||
override fun createArrayType(): JavaArrayType = throw UnsupportedOperationException()
|
||||
|
||||
class object Factory {
|
||||
companion object Factory {
|
||||
fun create(type: Type): ReflectJavaType {
|
||||
return when {
|
||||
type is Class<*> && type.isPrimitive() -> ReflectJavaPrimitiveType(type)
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ public class ReflectKotlinClass private(
|
||||
private val classHeader: KotlinClassHeader
|
||||
) : KotlinJvmBinaryClass {
|
||||
|
||||
class object Factory {
|
||||
companion object Factory {
|
||||
|
||||
public fun create(klass: Class<*>): ReflectKotlinClass? {
|
||||
val headerReader = ReadKotlinClassHeaderAnnotationVisitor()
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ public class RuntimeModuleData private(private val injector: InjectorForRuntimeD
|
||||
|
||||
public val localClassResolver: LocalClassResolver get() = injector.getDeserializationComponentsForJava().components.localClassResolver
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
public fun create(classLoader: ClassLoader): RuntimeModuleData {
|
||||
val module = ModuleDescriptorImpl(Name.special("<runtime module for $classLoader>"), listOf(), JavaToKotlinClassMap.INSTANCE)
|
||||
module.addDependencyOnModule(module)
|
||||
|
||||
@@ -26,7 +26,7 @@ public trait Annotations : Iterable<AnnotationDescriptor> {
|
||||
|
||||
public fun findAnnotation(fqName: FqName): AnnotationDescriptor?
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
public val EMPTY: Annotations = object : Annotations {
|
||||
override fun isEmpty() = true
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ public trait JetScope {
|
||||
}
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
public val ALL_NAME_FILTER: (Name) -> Boolean = { true }
|
||||
}
|
||||
}
|
||||
@@ -141,7 +141,7 @@ public class DescriptorKindFilter(
|
||||
}
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
public val NON_SINGLETON_CLASSIFIERS_MASK: Int = 0x01
|
||||
public val SINGLETON_CLASSIFIERS_MASK: Int = 0x02
|
||||
public val PACKAGES_MASK: Int = 0x04
|
||||
|
||||
@@ -33,7 +33,7 @@ public trait FlexibleTypeCapabilities {
|
||||
}
|
||||
|
||||
public trait Flexibility : TypeCapability, SubtypingRepresentatives {
|
||||
class object {
|
||||
companion object {
|
||||
// This is a "magic" classifier: when type resolver sees it in the code, e.g. ft<Foo, Foo?>, instead of creating a normal type,
|
||||
// it creates a flexible type, e.g. (Foo..Foo?).
|
||||
// This is used in tests and Evaluate Expression to have flexible types in the code,
|
||||
@@ -145,7 +145,7 @@ public open class DelegatingFlexibleType protected (
|
||||
override val upperBound: JetType,
|
||||
override val extraCapabilities: FlexibleTypeCapabilities
|
||||
) : DelegatingType(), NullAwareness, Flexibility, FlexibleTypeDelegation, Approximation {
|
||||
class object {
|
||||
companion object {
|
||||
platformStatic fun create(lowerBound: JetType, upperBound: JetType, extraCapabilities: FlexibleTypeCapabilities): JetType {
|
||||
if (lowerBound == upperBound) return lowerBound
|
||||
return DelegatingFlexibleType(lowerBound, upperBound, extraCapabilities)
|
||||
|
||||
Reference in New Issue
Block a user