Exemple #1
0
 {
   primitiveTypes = new HashSet<FqNameUnsafe>(0);
   primitiveArrays = new HashSet<FqNameUnsafe>(0);
   for (PrimitiveType primitiveType : PrimitiveType.values()) {
     primitiveTypes.add(fqNameUnsafe(primitiveType.getTypeName().asString()));
     primitiveArrays.add(fqNameUnsafe(primitiveType.getArrayTypeName().asString()));
   }
 }
 {
   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);
   }
 }
  protected KotlinBuiltIns() {
    LockBasedStorageManager storageManager = new LockBasedStorageManager();
    builtInsModule =
        new ModuleDescriptorImpl(
            Name.special("<built-ins module>"),
            storageManager,
            ModuleParameters.Empty.INSTANCE,
            this);

    PackageFragmentProvider packageFragmentProvider =
        BuiltInsPackageFragmentProviderKt.createBuiltInPackageFragmentProvider(
            storageManager,
            builtInsModule,
            BUILT_INS_PACKAGE_FQ_NAMES,
            new BuiltInFictitiousFunctionClassFactory(storageManager, builtInsModule),
            getAdditionalSupertypesProvider(),
            new Function1<String, InputStream>() {
              @Override
              public InputStream invoke(String path) {
                return KotlinBuiltIns.class.getClassLoader().getResourceAsStream(path);
              }
            });

    builtInsModule.initialize(packageFragmentProvider);
    builtInsModule.setDependencies(builtInsModule);

    builtinsPackageFragment =
        (BuiltinsPackageFragment)
            single(packageFragmentProvider.getPackageFragments(BUILT_INS_PACKAGE_FQ_NAME));
    annotationPackageFragment =
        (BuiltinsPackageFragment)
            single(packageFragmentProvider.getPackageFragments(ANNOTATION_PACKAGE_FQ_NAME));

    primitiveTypeToArrayKotlinType = new EnumMap<PrimitiveType, KotlinType>(PrimitiveType.class);
    primitiveKotlinTypeToKotlinArrayType = new HashMap<KotlinType, KotlinType>();
    kotlinArrayTypeToPrimitiveKotlinType = new HashMap<KotlinType, KotlinType>();
    for (PrimitiveType primitive : PrimitiveType.values()) {
      makePrimitive(primitive);
    }
  }
Exemple #4
0
 private void doInitialize() {
   for (PrimitiveType primitive : PrimitiveType.values()) {
     makePrimitive(primitive);
   }
 }