示例#1
0
  private void makePrimitive(@NotNull PrimitiveType primitiveType) {
    KotlinType type = getBuiltInTypeByClassName(primitiveType.getTypeName().asString());
    KotlinType arrayType = getBuiltInTypeByClassName(primitiveType.getArrayTypeName().asString());

    primitiveTypeToArrayKotlinType.put(primitiveType, arrayType);
    primitiveKotlinTypeToKotlinArrayType.put(type, arrayType);
    kotlinArrayTypeToPrimitiveKotlinType.put(arrayType, type);
  }
示例#2
0
  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);
  }
示例#3
0
 {
   fqNameToPrimitiveType = new HashMap<FqNameUnsafe, PrimitiveType>(0);
   arrayClassFqNameToPrimitiveType = new HashMap<FqNameUnsafe, PrimitiveType>(0);
   for (PrimitiveType primitiveType : PrimitiveType.values()) {
     fqNameToPrimitiveType.put(
         fqNameUnsafe(primitiveType.getTypeName().asString()), primitiveType);
     arrayClassFqNameToPrimitiveType.put(
         fqNameUnsafe(primitiveType.getArrayTypeName().asString()), primitiveType);
   }
 }
示例#4
0
 @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;
 }
示例#5
0
 /** @return {@code null} if not primitive */
 @Nullable
 public KotlinType getPrimitiveArrayKotlinTypeByPrimitiveKotlinType(
     @NotNull KotlinType kotlinType) {
   return primitiveKotlinTypeToKotlinArrayType.get(kotlinType);
 }
示例#6
0
 @NotNull
 public KotlinType getPrimitiveArrayKotlinType(@NotNull PrimitiveType primitiveType) {
   return primitiveTypeToArrayKotlinType.get(primitiveType);
 }
示例#7
0
 /** @return <code>null</code> if not primitive */
 @Nullable
 public JetType getPrimitiveArrayJetTypeByPrimitiveJetType(@NotNull JetType jetType) {
   return primitiveJetTypeToJetArrayType.get(jetType);
 }
示例#8
0
 @NotNull
 public JetType getPrimitiveArrayJetType(@NotNull PrimitiveType primitiveType) {
   return primitiveTypeToArrayJetType.get(primitiveType);
 }
示例#9
0
 @NotNull
 public JetType getNullablePrimitiveJetType(@NotNull PrimitiveType primitiveType) {
   return primitiveTypeToNullableJetType.get(primitiveType);
 }