Use TypeUtils.isNullableType() in codegen
This commit is contained in:
@@ -220,7 +220,7 @@ public class JetTypeMapper {
|
|||||||
if (descriptor instanceof ClassDescriptor) {
|
if (descriptor instanceof ClassDescriptor) {
|
||||||
FqNameUnsafe className = DescriptorUtils.getFqName(descriptor);
|
FqNameUnsafe className = DescriptorUtils.getFqName(descriptor);
|
||||||
if (className.isSafe()) {
|
if (className.isSafe()) {
|
||||||
known = KotlinToJavaTypesMap.getInstance().getJavaAnalog(className.toSafe(), jetType.isNullable());
|
known = KotlinToJavaTypesMap.getInstance().getJavaAnalog(className.toSafe(), TypeUtils.isNullableType(jetType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import org.jetbrains.jet.lang.resolve.BindingContext;
|
|||||||
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
|
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
|
||||||
import org.jetbrains.jet.lang.resolve.constants.NullValue;
|
import org.jetbrains.jet.lang.resolve.constants.NullValue;
|
||||||
import org.jetbrains.jet.lang.types.JetType;
|
import org.jetbrains.jet.lang.types.JetType;
|
||||||
|
import org.jetbrains.jet.lang.types.TypeUtils;
|
||||||
import org.jetbrains.org.objectweb.asm.Label;
|
import org.jetbrains.org.objectweb.asm.Label;
|
||||||
import org.jetbrains.org.objectweb.asm.Type;
|
import org.jetbrains.org.objectweb.asm.Type;
|
||||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
|
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
|
||||||
@@ -135,7 +136,7 @@ abstract public class SwitchCodegen {
|
|||||||
|
|
||||||
assert subjectJetType != null : "subject type can't be null (i.e. void)";
|
assert subjectJetType != null : "subject type can't be null (i.e. void)";
|
||||||
|
|
||||||
if (subjectJetType.isNullable()) {
|
if (TypeUtils.isNullableType(subjectJetType)) {
|
||||||
int nullEntryIndex = findNullEntryIndex(expression);
|
int nullEntryIndex = findNullEntryIndex(expression);
|
||||||
Label nullLabel = nullEntryIndex == -1 ? defaultLabel : entryLabels.get(nullEntryIndex);
|
Label nullLabel = nullEntryIndex == -1 ? defaultLabel : entryLabels.get(nullEntryIndex);
|
||||||
Label notNullLabel = new Label();
|
Label notNullLabel = new Label();
|
||||||
|
|||||||
Reference in New Issue
Block a user