Example #1
0
 public Map<String, JetType> getPrimitiveTypesMap() {
   if (primitiveTypesMap == null) {
     primitiveTypesMap = new HashMap<String, JetType>();
     for (JvmPrimitiveType jvmPrimitiveType : JvmPrimitiveType.values()) {
       PrimitiveType primitiveType = jvmPrimitiveType.getPrimitiveType();
       primitiveTypesMap.put(
           jvmPrimitiveType.getName(), standardLibrary.getPrimitiveJetType(primitiveType));
       primitiveTypesMap.put(
           "[" + jvmPrimitiveType.getName(),
           standardLibrary.getPrimitiveArrayJetType(primitiveType));
       primitiveTypesMap.put(
           jvmPrimitiveType.getWrapper().getFqName(),
           standardLibrary.getNullablePrimitiveJetType(primitiveType));
     }
     primitiveTypesMap.put("void", JetStandardClasses.getUnitType());
   }
   return primitiveTypesMap;
 }
 private JetType getPrimitiveType(char descriptor, boolean nullable) {
   if (!nullable) {
     for (JvmPrimitiveType jvmPrimitiveType : JvmPrimitiveType.values()) {
       if (jvmPrimitiveType.getJvmLetter() == descriptor) {
         return jetStandardLibrary.getPrimitiveJetType(jvmPrimitiveType.getPrimitiveType());
       }
     }
     if (descriptor == 'V') {
       return JetStandardClasses.getUnitType();
     }
   } else {
     for (JvmPrimitiveType jvmPrimitiveType : JvmPrimitiveType.values()) {
       if (jvmPrimitiveType.getJvmLetter() == descriptor) {
         return jetStandardLibrary.getNullablePrimitiveJetType(
             jvmPrimitiveType.getPrimitiveType());
       }
     }
     if (descriptor == 'V') {
       throw new IllegalStateException("incorrect signature: nullable void");
     }
   }
   throw new IllegalStateException("incorrect signature");
 }