Calls to Java's primitive class methods work.
Calls to Java's primitive classes that had the same name as the corresponding primitive in Kotlin didn't work. Now calls like Short.valueOf() is turned to java.lang.Short.valueOf() in Kotlin.
This commit is contained in:
committed by
Pavel V. Talanov
parent
1fe978e216
commit
b45b0e6c3a
@@ -12,6 +12,7 @@ import java.util.ArrayList
|
||||
import java.util.Collections
|
||||
import com.intellij.psi.CommonClassNames.*
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
import org.jetbrains.jet.lang.types.lang.PrimitiveType
|
||||
|
||||
public open class ExpressionVisitor(converter: Converter): StatementVisitor(converter) {
|
||||
{
|
||||
@@ -235,6 +236,14 @@ public open class ExpressionVisitor(converter: Converter): StatementVisitor(conv
|
||||
}
|
||||
else if (qualifier == null) {
|
||||
val resolved = expression.getReference()?.resolve()
|
||||
if (resolved is PsiClass) {
|
||||
val clazz = resolved as PsiClass
|
||||
|
||||
if (PrimitiveType.values() any { it.getTypeName().getName() == clazz.getName() }) {
|
||||
myResult = Identifier(clazz.getQualifiedName()!!, false)
|
||||
return
|
||||
}
|
||||
}
|
||||
if (resolved is PsiMember && resolved.hasModifierProperty(PsiModifier.STATIC) &&
|
||||
resolved.getContainingClass() != null &&
|
||||
PsiTreeUtil.getParentOfType(expression, javaClass<PsiClass>()) != resolved.getContainingClass() &&
|
||||
|
||||
@@ -3,6 +3,7 @@ package demo;
|
||||
class Test {
|
||||
void test() {
|
||||
Integer i = Integer.valueOf(100);
|
||||
Short s = Short.valueOf(100);
|
||||
short s = 3;
|
||||
Short ss = Short.valueOf(s);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package demo
|
||||
open class Test() {
|
||||
open fun test() : Unit {
|
||||
var i : Int? = Integer.valueOf(100)
|
||||
var s : Short? = Short.valueOf(100)
|
||||
var s : Short = 3
|
||||
var ss : Short? = java.lang.Short.valueOf(s)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user