New J2K: convert Long.parseLong(s) to s.toLong()
#KT-21504 Fixed
This commit is contained in:
committed by
Ilya Kirillov
parent
9290ec34db
commit
a1c52f69f2
@@ -212,6 +212,19 @@ class BuiltinMembersConversion(private val context: NewJ2kConverterContext) : Re
|
||||
Method("java.lang.Short.valueOf") convertTo ExtensionMethod("kotlin.Short.toShort")
|
||||
withReplaceType ReplaceType.REPLACE_WITH_QUALIFIER,
|
||||
|
||||
Method("java.lang.Byte.parseByte") convertTo ExtensionMethod("kotlin.text.toByte")
|
||||
withReplaceType ReplaceType.REPLACE_WITH_QUALIFIER,
|
||||
Method("java.lang.Short.parseShort") convertTo ExtensionMethod("kotlin.text.toShort")
|
||||
withReplaceType ReplaceType.REPLACE_WITH_QUALIFIER,
|
||||
Method("java.lang.Integer.parseInt") convertTo ExtensionMethod("kotlin.text.toInt")
|
||||
withReplaceType ReplaceType.REPLACE_WITH_QUALIFIER,
|
||||
Method("java.lang.Long.parseLong") convertTo ExtensionMethod("kotlin.text.toLong")
|
||||
withReplaceType ReplaceType.REPLACE_WITH_QUALIFIER,
|
||||
Method("java.lang.Float.parseFloat") convertTo ExtensionMethod("kotlin.text.toFloat")
|
||||
withReplaceType ReplaceType.REPLACE_WITH_QUALIFIER,
|
||||
Method("java.lang.Double.parseDouble") convertTo ExtensionMethod("kotlin.text.toDouble")
|
||||
withReplaceType ReplaceType.REPLACE_WITH_QUALIFIER,
|
||||
|
||||
Method("java.io.PrintStream.println") convertTo Method("kotlin.io.println")
|
||||
withReplaceType ReplaceType.REPLACE_WITH_QUALIFIER
|
||||
withFilter ::isSystemOutCall,
|
||||
|
||||
@@ -40,4 +40,18 @@ class A {
|
||||
entry.setValue(value + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void kt21504() {
|
||||
byte b = Byte.parseByte("1");
|
||||
short s = Short.parseShort("1");
|
||||
int i = Integer.parseInt("1");
|
||||
long l = Long.parseLong("1");
|
||||
float f = Float.parseFloat("1");
|
||||
double d = Double.parseDouble("1");
|
||||
|
||||
byte b2 = Byte.parseByte("1", 10);
|
||||
short s2 = Short.parseShort("1", 10);
|
||||
int i2 = Integer.parseInt("1", 10);
|
||||
long l2 = Long.parseLong("1", 10);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,4 +34,18 @@ internal class A {
|
||||
entry.setValue(value + 1)
|
||||
}
|
||||
}
|
||||
|
||||
fun kt21504() {
|
||||
val b = "1".toByte()
|
||||
val s = "1".toShort()
|
||||
val i = "1".toInt()
|
||||
val l = "1".toLong()
|
||||
val f = "1".toFloat()
|
||||
val d = "1".toDouble()
|
||||
|
||||
val b2 = "1".toByte(10)
|
||||
val s2 = "1".toShort(10)
|
||||
val i2 = "1".toInt(10)
|
||||
val l2 = "1".toLong(10)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user