コード例 #1
0
  public InjectorForJavaSemanticServices(@NotNull Project project) {
    this.javaSemanticServices = new JavaSemanticServices();
    this.javaDescriptorResolver = new JavaDescriptorResolver();
    this.bindingTrace = new org.jetbrains.jet.lang.resolve.BindingTraceContext();
    this.javaBridgeConfiguration = new JavaBridgeConfiguration();
    this.psiClassFinder = new PsiClassFinderImpl();
    this.moduleDescriptor =
        new org.jetbrains.jet.lang.descriptors.ModuleDescriptorImpl(
            org.jetbrains.jet.lang.resolve.name.Name.special("<dummy>"),
            org.jetbrains.jet.lang.resolve.java.JavaBridgeConfiguration.ALL_JAVA_IMPORTS,
            org.jetbrains.jet.lang.resolve.java.JavaToKotlinClassMap.getInstance());
    this.project = project;
    this.psiDeclarationProviderFactory = new PsiDeclarationProviderFactory(getPsiClassFinder());
    this.javaTypeTransformer = new JavaTypeTransformer();
    this.javaClassResolver = new JavaClassResolver();
    this.javaAnnotationResolver = new JavaAnnotationResolver();
    this.javaCompileTimeConstResolver = new JavaCompileTimeConstResolver();
    this.javaClassObjectResolver = new JavaClassObjectResolver();
    this.javaSupertypeResolver = new JavaSupertypeResolver();
    this.javaFunctionResolver = new JavaFunctionResolver();
    this.javaValueParameterResolver = new JavaValueParameterResolver();
    this.javaSignatureResolver = new JavaSignatureResolver();
    this.javaNamespaceResolver = new JavaNamespaceResolver();
    this.javaConstructorResolver = new JavaConstructorResolver();
    this.javaInnerClassResolver = new JavaInnerClassResolver();
    this.javaPropertyResolver = new JavaPropertyResolver();

    this.javaSemanticServices.setDescriptorResolver(javaDescriptorResolver);
    this.javaSemanticServices.setPsiClassFinder(psiClassFinder);
    this.javaSemanticServices.setPsiDeclarationProviderFactory(psiDeclarationProviderFactory);
    this.javaSemanticServices.setTrace(bindingTrace);
    this.javaSemanticServices.setTypeTransformer(javaTypeTransformer);

    this.javaDescriptorResolver.setClassResolver(javaClassResolver);
    this.javaDescriptorResolver.setConstructorResolver(javaConstructorResolver);
    this.javaDescriptorResolver.setFunctionResolver(javaFunctionResolver);
    this.javaDescriptorResolver.setInnerClassResolver(javaInnerClassResolver);
    this.javaDescriptorResolver.setNamespaceResolver(javaNamespaceResolver);
    this.javaDescriptorResolver.setPropertiesResolver(javaPropertyResolver);

    javaBridgeConfiguration.setJavaSemanticServices(javaSemanticServices);

    this.psiClassFinder.setProject(project);

    moduleDescriptor.setModuleConfiguration(javaBridgeConfiguration);

    javaTypeTransformer.setJavaSemanticServices(javaSemanticServices);
    javaTypeTransformer.setResolver(javaDescriptorResolver);

    javaClassResolver.setAnnotationResolver(javaAnnotationResolver);
    javaClassResolver.setClassObjectResolver(javaClassObjectResolver);
    javaClassResolver.setFunctionResolver(javaFunctionResolver);
    javaClassResolver.setNamespaceResolver(javaNamespaceResolver);
    javaClassResolver.setPsiClassFinder(psiClassFinder);
    javaClassResolver.setSemanticServices(javaSemanticServices);
    javaClassResolver.setSignatureResolver(javaSignatureResolver);
    javaClassResolver.setSupertypesResolver(javaSupertypeResolver);
    javaClassResolver.setTrace(bindingTrace);

    javaAnnotationResolver.setClassResolver(javaClassResolver);
    javaAnnotationResolver.setCompileTimeConstResolver(javaCompileTimeConstResolver);

    javaCompileTimeConstResolver.setAnnotationResolver(javaAnnotationResolver);
    javaCompileTimeConstResolver.setClassResolver(javaClassResolver);

    javaClassObjectResolver.setSemanticServices(javaSemanticServices);
    javaClassObjectResolver.setSupertypesResolver(javaSupertypeResolver);
    javaClassObjectResolver.setTrace(bindingTrace);

    javaSupertypeResolver.setClassResolver(javaClassResolver);
    javaSupertypeResolver.setSemanticServices(javaSemanticServices);
    javaSupertypeResolver.setTrace(bindingTrace);
    javaSupertypeResolver.setTypeTransformer(javaTypeTransformer);

    javaFunctionResolver.setAnnotationResolver(javaAnnotationResolver);
    javaFunctionResolver.setParameterResolver(javaValueParameterResolver);
    javaFunctionResolver.setSignatureResolver(javaSignatureResolver);
    javaFunctionResolver.setTrace(bindingTrace);
    javaFunctionResolver.setTypeTransformer(javaTypeTransformer);

    javaValueParameterResolver.setTypeTransformer(javaTypeTransformer);

    javaSignatureResolver.setJavaSemanticServices(javaSemanticServices);

    javaNamespaceResolver.setJavaSemanticServices(javaSemanticServices);
    javaNamespaceResolver.setPsiClassFinder(psiClassFinder);
    javaNamespaceResolver.setTrace(bindingTrace);

    javaConstructorResolver.setTrace(bindingTrace);
    javaConstructorResolver.setTypeTransformer(javaTypeTransformer);
    javaConstructorResolver.setValueParameterResolver(javaValueParameterResolver);

    javaInnerClassResolver.setClassResolver(javaClassResolver);

    javaPropertyResolver.setAnnotationResolver(javaAnnotationResolver);
    javaPropertyResolver.setJavaSignatureResolver(javaSignatureResolver);
    javaPropertyResolver.setSemanticServices(javaSemanticServices);
    javaPropertyResolver.setTrace(bindingTrace);

    psiClassFinder.initialize();
  }
コード例 #2
0
  public InjectorForJavaDescriptorResolver(
      @NotNull Project project,
      @NotNull BindingTrace bindingTrace,
      @NotNull ModuleDescriptor moduleDescriptor) {
    this.project = project;
    this.bindingTrace = bindingTrace;
    this.moduleDescriptor = moduleDescriptor;
    this.javaBridgeConfiguration = new JavaBridgeConfiguration();
    this.javaSemanticServices = new JavaSemanticServices();
    this.javaDescriptorResolver = new JavaDescriptorResolver();
    this.psiClassFinder = new PsiClassFinderImpl();
    this.psiDeclarationProviderFactory = new PsiDeclarationProviderFactory(getPsiClassFinder());
    this.javaTypeTransformer = new JavaTypeTransformer();
    this.javaClassResolver = new JavaClassResolver();
    this.javaAnnotationResolver = new JavaAnnotationResolver();
    this.javaCompileTimeConstResolver = new JavaCompileTimeConstResolver();
    this.javaClassObjectResolver = new JavaClassObjectResolver();
    this.javaSupertypeResolver = new JavaSupertypeResolver();
    this.javaNamespaceResolver = new JavaNamespaceResolver();
    this.javaSignatureResolver = new JavaSignatureResolver();
    this.javaConstructorResolver = new JavaConstructorResolver();
    this.javaValueParameterResolver = new JavaValueParameterResolver();
    this.javaFunctionResolver = new JavaFunctionResolver();
    this.javaInnerClassResolver = new JavaInnerClassResolver();
    this.javaPropertyResolver = new JavaPropertyResolver();

    javaBridgeConfiguration.setJavaSemanticServices(javaSemanticServices);
    javaBridgeConfiguration.setProject(project);

    this.javaSemanticServices.setDescriptorResolver(javaDescriptorResolver);
    this.javaSemanticServices.setPsiClassFinder(psiClassFinder);
    this.javaSemanticServices.setPsiDeclarationProviderFactory(psiDeclarationProviderFactory);
    this.javaSemanticServices.setTrace(bindingTrace);
    this.javaSemanticServices.setTypeTransformer(javaTypeTransformer);

    this.javaDescriptorResolver.setClassResolver(javaClassResolver);
    this.javaDescriptorResolver.setConstructorResolver(javaConstructorResolver);
    this.javaDescriptorResolver.setFunctionResolver(javaFunctionResolver);
    this.javaDescriptorResolver.setInnerClassResolver(javaInnerClassResolver);
    this.javaDescriptorResolver.setNamespaceResolver(javaNamespaceResolver);
    this.javaDescriptorResolver.setPropertiesResolver(javaPropertyResolver);

    this.psiClassFinder.setProject(project);

    javaTypeTransformer.setJavaSemanticServices(javaSemanticServices);
    javaTypeTransformer.setResolver(javaDescriptorResolver);

    javaClassResolver.setAnnotationResolver(javaAnnotationResolver);
    javaClassResolver.setClassObjectResolver(javaClassObjectResolver);
    javaClassResolver.setNamespaceResolver(javaNamespaceResolver);
    javaClassResolver.setPsiClassFinder(psiClassFinder);
    javaClassResolver.setSemanticServices(javaSemanticServices);
    javaClassResolver.setSignatureResolver(javaSignatureResolver);
    javaClassResolver.setSupertypesResolver(javaSupertypeResolver);
    javaClassResolver.setTrace(bindingTrace);

    javaAnnotationResolver.setClassResolver(javaClassResolver);
    javaAnnotationResolver.setCompileTimeConstResolver(javaCompileTimeConstResolver);

    javaCompileTimeConstResolver.setAnnotationResolver(javaAnnotationResolver);
    javaCompileTimeConstResolver.setClassResolver(javaClassResolver);

    javaClassObjectResolver.setSemanticServices(javaSemanticServices);
    javaClassObjectResolver.setSupertypesResolver(javaSupertypeResolver);
    javaClassObjectResolver.setTrace(bindingTrace);

    javaSupertypeResolver.setClassResolver(javaClassResolver);
    javaSupertypeResolver.setSemanticServices(javaSemanticServices);
    javaSupertypeResolver.setTrace(bindingTrace);
    javaSupertypeResolver.setTypeTransformer(javaTypeTransformer);

    javaNamespaceResolver.setJavaSemanticServices(javaSemanticServices);
    javaNamespaceResolver.setPsiClassFinder(psiClassFinder);
    javaNamespaceResolver.setTrace(bindingTrace);

    javaSignatureResolver.setJavaSemanticServices(javaSemanticServices);

    javaConstructorResolver.setTrace(bindingTrace);
    javaConstructorResolver.setTypeTransformer(javaTypeTransformer);
    javaConstructorResolver.setValueParameterResolver(javaValueParameterResolver);

    javaValueParameterResolver.setTypeTransformer(javaTypeTransformer);

    javaFunctionResolver.setAnnotationResolver(javaAnnotationResolver);
    javaFunctionResolver.setParameterResolver(javaValueParameterResolver);
    javaFunctionResolver.setSignatureResolver(javaSignatureResolver);
    javaFunctionResolver.setTrace(bindingTrace);
    javaFunctionResolver.setTypeTransformer(javaTypeTransformer);

    javaInnerClassResolver.setClassResolver(javaClassResolver);

    javaPropertyResolver.setAnnotationResolver(javaAnnotationResolver);
    javaPropertyResolver.setJavaSignatureResolver(javaSignatureResolver);
    javaPropertyResolver.setSemanticServices(javaSemanticServices);
    javaPropertyResolver.setTrace(bindingTrace);

    javaBridgeConfiguration.init();

    psiClassFinder.initialize();
  }