Ejemplo n.º 1
0
 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");
 }
Ejemplo n.º 2
0
 public Map<String, ClassDescriptor> getPrimitiveWrappersClassDescriptorMap() {
   if (classDescriptorMap == null) {
     classDescriptorMap = new HashMap<String, ClassDescriptor>();
     for (JvmPrimitiveType jvmPrimitiveType : JvmPrimitiveType.values()) {
       PrimitiveType primitiveType = jvmPrimitiveType.getPrimitiveType();
       classDescriptorMap.put(
           jvmPrimitiveType.getWrapper().getFqName(),
           standardLibrary.getPrimitiveClassDescriptor(primitiveType));
     }
     classDescriptorMap.put("java.lang.String", standardLibrary.getString());
     classDescriptorMap.put("java.lang.CharSequence", standardLibrary.getCharSequence());
     classDescriptorMap.put("java.lang.Throwable", standardLibrary.getThrowable());
   }
   return classDescriptorMap;
 }
Ejemplo n.º 3
0
 public Map<String, JetType> getClassTypesMap() {
   if (classTypesMap == null) {
     classTypesMap = new HashMap<String, JetType>();
     for (JvmPrimitiveType jvmPrimitiveType : JvmPrimitiveType.values()) {
       PrimitiveType primitiveType = jvmPrimitiveType.getPrimitiveType();
       classTypesMap.put(
           jvmPrimitiveType.getWrapper().getFqName(),
           standardLibrary.getNullablePrimitiveJetType(primitiveType));
     }
     classTypesMap.put("java.lang.Object", JetStandardClasses.getNullableAnyType());
     classTypesMap.put("java.lang.String", standardLibrary.getNullableStringType());
     classTypesMap.put("java.lang.CharSequence", standardLibrary.getNullableCharSequenceType());
     classTypesMap.put("java.lang.Throwable", standardLibrary.getThrowableType());
   }
   return classTypesMap;
 }
Ejemplo n.º 4
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;
 }