private void makePrimitive(@NotNull PrimitiveType primitiveType) { JetType type = getBuiltInTypeByClassName(primitiveType.getTypeName().asString()); JetType arrayType = getBuiltInTypeByClassName(primitiveType.getArrayTypeName().asString()); primitiveTypeToNullableJetType.put(primitiveType, TypeUtils.makeNullable(type)); primitiveTypeToArrayJetType.put(primitiveType, arrayType); primitiveJetTypeToJetArrayType.put(type, arrayType); jetArrayTypeToPrimitiveJetType.put(arrayType, type); }
@NotNull public KotlinType getArrayElementType(@NotNull KotlinType arrayType) { if (isArray(arrayType)) { if (arrayType.getArguments().size() != 1) { throw new IllegalStateException(); } return arrayType.getArguments().get(0).getType(); } KotlinType primitiveType = kotlinArrayTypeToPrimitiveKotlinType.get(TypeUtils.makeNotNullable(arrayType)); if (primitiveType == null) { throw new IllegalStateException("not array: " + arrayType); } return primitiveType; }
@NotNull public KotlinType getNullableAnyType() { return TypeUtils.makeNullable(getAnyType()); }
@NotNull public KotlinType getNullableNothingType() { return TypeUtils.makeNullable(getNothingType()); }