Pull Java<->Kotlin primitive type mapping up to JavaToKotlinClassMapBuilder

This commit is contained in:
Alexander Udalov
2015-04-22 04:49:07 +03:00
parent 4b07ec11ea
commit b956fb5eb0
4 changed files with 17 additions and 49 deletions
@@ -25,7 +25,6 @@ import org.jetbrains.kotlin.name.ClassId;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.name.FqNameUnsafe;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType;
import java.util.*;
@@ -37,15 +36,6 @@ public class JavaToKotlinClassMap extends JavaToKotlinClassMapBuilder implements
private JavaToKotlinClassMap() {
init();
initPrimitives();
}
private void initPrimitives() {
KotlinBuiltIns builtIns = KotlinBuiltIns.getInstance();
for (JvmPrimitiveType jvmType : JvmPrimitiveType.values()) {
register(ClassId.topLevel(jvmType.getWrapperFqName()), builtIns.getPrimitiveClassDescriptor(jvmType.getPrimitiveType()));
}
}
@Nullable
@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor;
import org.jetbrains.kotlin.name.ClassId;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType;
import java.lang.annotation.Annotation;
import java.util.*;
@@ -56,6 +57,14 @@ public abstract class JavaToKotlinClassMapBuilder {
register(Map.Entry.class, kotlinBuiltIns.getMapEntry(), kotlinBuiltIns.getMutableMapEntry());
register(ListIterator.class, kotlinBuiltIns.getListIterator(), kotlinBuiltIns.getMutableListIterator());
for (JvmPrimitiveType jvmType : JvmPrimitiveType.values()) {
register(
ClassId.topLevel(jvmType.getWrapperFqName()),
kotlinBuiltIns.getPrimitiveClassDescriptor(jvmType.getPrimitiveType()),
Direction.BOTH
);
}
register(classId(Deprecated.class), kotlinBuiltIns.getDeprecatedAnnotation(), Direction.JAVA_TO_KOTLIN);
register(classId(Void.class), kotlinBuiltIns.getNothing(), Direction.KOTLIN_TO_JAVA);