Stdlib rename: 'name' and 'ordinal' are now properties in Enum, same name functions are deprecated

This commit is contained in:
Mikhail Glukhikh
2015-10-12 17:52:55 +03:00
parent 78cfeb0d7d
commit f8a356747e
193 changed files with 522 additions and 454 deletions
+2 -2
View File
@@ -27,13 +27,13 @@ public abstract class Enum<E : Enum<E>>(name: String, ordinal: Int): Comparable<
/**
* Returns the name of this enum constant, exactly as declared in its enum declaration.
*/
public final fun name(): String
public final val name: String
/**
* Returns the ordinal of this enumeration constant (its position in its enum declaration, where the initial constant
* is assigned an ordinal of zero).
*/
public final fun ordinal(): Int
public final val ordinal: Int
public override final fun compareTo(other: E): Int
@@ -33,6 +33,8 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
object BuiltinSpecialProperties {
private val PROPERTY_FQ_NAME_TO_JVM_GETTER_NAME_MAP = mapOf(
FqName("kotlin.Enum.name") to Name.identifier("name"),
FqName("kotlin.Enum.ordinal") to Name.identifier("ordinal"),
FqName("kotlin.Collection.size") to Name.identifier("size"),
FqName("kotlin.Map.size") to Name.identifier("size"),
FqName("kotlin.CharSequence.length") to Name.identifier("length"),