Пример #1
0
  private KotlinBuiltIns() {
    builtInsModule =
        new ModuleDescriptorImpl(
            Name.special("<built-ins lazy module>"),
            Collections.<ImportPath>emptyList(),
            PlatformToKotlinClassMap.EMPTY);
    builtinsPackageFragment =
        new BuiltinsPackageFragment(
            BUILT_INS_PACKAGE_FQ_NAME,
            new LockBasedStorageManager(),
            builtInsModule,
            new Function1<String, InputStream>() {
              @Override
              public InputStream invoke(String path) {
                return KotlinBuiltIns.class.getClassLoader().getResourceAsStream(path);
              }
            });
    builtInsModule.initialize(builtinsPackageFragment.getProvider());
    builtInsModule.addDependencyOnModule(builtInsModule);
    builtInsModule.seal();

    primitiveTypeToNullableJetType = new EnumMap<PrimitiveType, JetType>(PrimitiveType.class);
    primitiveTypeToArrayJetType = new EnumMap<PrimitiveType, JetType>(PrimitiveType.class);
    primitiveJetTypeToJetArrayType = new HashMap<JetType, JetType>();
    jetArrayTypeToPrimitiveJetType = new HashMap<JetType, JetType>();
  }
Пример #2
0
 @NotNull
 public ClassDescriptor getAnnotationClassByName(@NotNull Name simpleName) {
   ClassifierDescriptor classifier =
       annotationPackageFragment
           .getMemberScope()
           .getContributedClassifier(simpleName, NoLookupLocation.FROM_BUILTINS);
   assert classifier instanceof ClassDescriptor
       : "Must be a class descriptor "
           + simpleName
           + ", but was "
           + (classifier == null ? "null" : classifier.toString());
   return (ClassDescriptor) classifier;
 }
Пример #3
0
 @NotNull
 public MemberScope getAnnotationPackageScope() {
   return annotationPackageFragment.getMemberScope();
 }
Пример #4
0
 @NotNull
 public MemberScope getBuiltInsPackageScope() {
   return builtinsPackageFragment.getMemberScope();
 }