public EclipseInjectorForTopDownAnalyzerForJvm(
      @NotNull Project project,
      @NotNull GlobalContext globalContext,
      @NotNull BindingTrace bindingTrace,
      @NotNull ModuleDescriptor moduleDescriptor,
      @NotNull IJavaProject IJavaProject) {
    this.project = project;
    this.globalContext = globalContext;
    this.storageManager = globalContext.getStorageManager();
    this.bindingTrace = bindingTrace;
    this.moduleDescriptor = moduleDescriptor;
    this.platformToKotlinClassMap = moduleDescriptor.getPlatformToKotlinClassMap();
    this.IJavaProject = IJavaProject;
    this.topDownAnalyzer = new TopDownAnalyzer();
    this.lazyTopDownAnalyzer = new LazyTopDownAnalyzer();
    this.mutablePackageFragmentProvider = new MutablePackageFragmentProvider(getModuleDescriptor());
    this.eclipseJavaClassFinder = new EclipseJavaClassFinder();
    this.virtualFileFinder =
        org.jetbrains.jet.lang.resolve.kotlin.VirtualFileFinder.SERVICE.getInstance(project);
    this.deserializedDescriptorResolver = new DeserializedDescriptorResolver();
    this.eclipseExternalAnnotationResolver = new EclipseExternalAnnotationResolver();
    this.traceBasedExternalSignatureResolver = new TraceBasedExternalSignatureResolver();
    this.traceBasedErrorReporter = new TraceBasedErrorReporter();
    this.eclipseMethodSignatureChecker = new EclipseMethodSignatureChecker();
    this.eclipseTraceBasedJavaResolverCache = new EclipseTraceBasedJavaResolverCache();
    this.eclipseJavaPropertyInitializerEvaluator = new EclipseJavaPropertyInitializerEvaluator();
    this.eclipseJavaSourceElementFactory = new EclipseJavaSourceElementFactory();
    this.singleModuleClassResolver = new SingleModuleClassResolver();
    this.globalJavaResolverContext =
        new GlobalJavaResolverContext(
            storageManager,
            eclipseJavaClassFinder,
            virtualFileFinder,
            deserializedDescriptorResolver,
            eclipseExternalAnnotationResolver,
            traceBasedExternalSignatureResolver,
            traceBasedErrorReporter,
            eclipseMethodSignatureChecker,
            eclipseTraceBasedJavaResolverCache,
            eclipseJavaPropertyInitializerEvaluator,
            eclipseJavaSourceElementFactory,
            singleModuleClassResolver);
    this.lazyJavaPackageFragmentProvider =
        new LazyJavaPackageFragmentProvider(globalJavaResolverContext, getModuleDescriptor());
    this.javaDescriptorResolver =
        new JavaDescriptorResolver(lazyJavaPackageFragmentProvider, getModuleDescriptor());
    this.javaClassDataFinder =
        new JavaClassDataFinder(virtualFileFinder, deserializedDescriptorResolver);
    this.annotationDescriptorLoader = new AnnotationDescriptorLoader();
    this.constantDescriptorLoader = new ConstantDescriptorLoader();
    this.deserializationGlobalContextForJava =
        new DeserializationGlobalContextForJava(
            storageManager,
            getModuleDescriptor(),
            javaClassDataFinder,
            annotationDescriptorLoader,
            constantDescriptorLoader,
            lazyJavaPackageFragmentProvider);
    this.additionalCheckerProvider =
        org.jetbrains.jet.lang.resolve.kotlin.JavaDeclarationCheckerProvider.INSTANCE$;
    this.bodyResolver = new BodyResolver();
    this.annotationResolver = new AnnotationResolver();
    this.callResolver = new CallResolver();
    this.argumentTypeResolver = new ArgumentTypeResolver();
    this.expressionTypingComponents = new ExpressionTypingComponents();
    this.expressionTypingServices = new ExpressionTypingServices(expressionTypingComponents);
    this.controlStructureTypingUtils = new ControlStructureTypingUtils(expressionTypingServices);
    this.expressionTypingUtils = new ExpressionTypingUtils(expressionTypingServices, callResolver);
    this.forLoopConventionsChecker = new ForLoopConventionsChecker();
    this.reflectionTypes = new ReflectionTypes(getModuleDescriptor());
    this.callExpressionResolver = new CallExpressionResolver();
    this.descriptorResolver = new DescriptorResolver();
    this.delegatedPropertyResolver = new DelegatedPropertyResolver();
    this.typeResolver = new TypeResolver();
    this.qualifiedExpressionResolver = new QualifiedExpressionResolver();
    this.callResolverExtensionProvider = new CallResolverExtensionProvider();
    this.candidateResolver = new CandidateResolver();
    this.callCompleter = new CallCompleter(argumentTypeResolver, candidateResolver);
    this.controlFlowAnalyzer = new ControlFlowAnalyzer();
    this.declarationsChecker = new DeclarationsChecker();
    this.functionAnalyzerExtension = new FunctionAnalyzerExtension();
    this.scriptBodyResolver = new ScriptBodyResolver();
    this.declarationResolver = new DeclarationResolver();
    this.importsResolver = new ImportsResolver();
    this.jetImportsFactory = new JetImportsFactory();
    this.overloadResolver = new OverloadResolver();
    this.overrideResolver = new OverrideResolver();
    this.typeHierarchyResolver = new TypeHierarchyResolver();
    this.scriptHeaderResolver = new ScriptHeaderResolver();
    this.descriptorLoadersStorage = new DescriptorLoadersStorage(storageManager);

    this.topDownAnalyzer.setAdditionalCheckerProvider(additionalCheckerProvider);
    this.topDownAnalyzer.setBodyResolver(bodyResolver);
    this.topDownAnalyzer.setDeclarationResolver(declarationResolver);
    this.topDownAnalyzer.setLazyTopDownAnalyzer(lazyTopDownAnalyzer);
    this.topDownAnalyzer.setModuleDescriptor(moduleDescriptor);
    this.topDownAnalyzer.setOverloadResolver(overloadResolver);
    this.topDownAnalyzer.setOverrideResolver(overrideResolver);
    this.topDownAnalyzer.setPackageFragmentProvider(mutablePackageFragmentProvider);
    this.topDownAnalyzer.setProject(project);
    this.topDownAnalyzer.setTrace(bindingTrace);
    this.topDownAnalyzer.setTypeHierarchyResolver(typeHierarchyResolver);

    this.lazyTopDownAnalyzer.setBodyResolver(bodyResolver);
    this.lazyTopDownAnalyzer.setDeclarationResolver(declarationResolver);
    this.lazyTopDownAnalyzer.setModuleDescriptor(moduleDescriptor);
    this.lazyTopDownAnalyzer.setOverloadResolver(overloadResolver);
    this.lazyTopDownAnalyzer.setOverrideResolver(overrideResolver);
    this.lazyTopDownAnalyzer.setTrace(bindingTrace);

    eclipseJavaClassFinder.setProjectScope(IJavaProject);

    traceBasedExternalSignatureResolver.setExternalAnnotationResolver(
        eclipseExternalAnnotationResolver);
    traceBasedExternalSignatureResolver.setProject(project);
    traceBasedExternalSignatureResolver.setTrace(bindingTrace);

    eclipseTraceBasedJavaResolverCache.setTrace(bindingTrace);

    traceBasedErrorReporter.setTrace(bindingTrace);

    singleModuleClassResolver.setResolver(javaDescriptorResolver);

    bodyResolver.setAnnotationResolver(annotationResolver);
    bodyResolver.setCallResolver(callResolver);
    bodyResolver.setControlFlowAnalyzer(controlFlowAnalyzer);
    bodyResolver.setDeclarationsChecker(declarationsChecker);
    bodyResolver.setDelegatedPropertyResolver(delegatedPropertyResolver);
    bodyResolver.setExpressionTypingServices(expressionTypingServices);
    bodyResolver.setFunctionAnalyzerExtension(functionAnalyzerExtension);
    bodyResolver.setScriptBodyResolverResolver(scriptBodyResolver);
    bodyResolver.setTrace(bindingTrace);

    annotationResolver.setCallResolver(callResolver);
    annotationResolver.setStorageManager(storageManager);
    annotationResolver.setTypeResolver(typeResolver);

    callResolver.setArgumentTypeResolver(argumentTypeResolver);
    callResolver.setCallCompleter(callCompleter);
    callResolver.setCandidateResolver(candidateResolver);
    callResolver.setExpressionTypingServices(expressionTypingServices);
    callResolver.setTypeResolver(typeResolver);

    argumentTypeResolver.setExpressionTypingServices(expressionTypingServices);
    argumentTypeResolver.setTypeResolver(typeResolver);

    expressionTypingServices.setAnnotationResolver(annotationResolver);
    expressionTypingServices.setCallExpressionResolver(callExpressionResolver);
    expressionTypingServices.setCallResolver(callResolver);
    expressionTypingServices.setDescriptorResolver(descriptorResolver);
    expressionTypingServices.setExtensionProvider(callResolverExtensionProvider);
    expressionTypingServices.setProject(project);
    expressionTypingServices.setTypeResolver(typeResolver);

    expressionTypingComponents.setAdditionalCheckerProvider(additionalCheckerProvider);
    expressionTypingComponents.setCallResolver(callResolver);
    expressionTypingComponents.setControlStructureTypingUtils(controlStructureTypingUtils);
    expressionTypingComponents.setExpressionTypingServices(expressionTypingServices);
    expressionTypingComponents.setExpressionTypingUtils(expressionTypingUtils);
    expressionTypingComponents.setForLoopConventionsChecker(forLoopConventionsChecker);
    expressionTypingComponents.setGlobalContext(globalContext);
    expressionTypingComponents.setPlatformToKotlinClassMap(platformToKotlinClassMap);
    expressionTypingComponents.setReflectionTypes(reflectionTypes);

    forLoopConventionsChecker.setExpressionTypingServices(expressionTypingServices);
    forLoopConventionsChecker.setExpressionTypingUtils(expressionTypingUtils);
    forLoopConventionsChecker.setProject(project);

    callExpressionResolver.setExpressionTypingServices(expressionTypingServices);

    descriptorResolver.setAnnotationResolver(annotationResolver);
    descriptorResolver.setDelegatedPropertyResolver(delegatedPropertyResolver);
    descriptorResolver.setExpressionTypingServices(expressionTypingServices);
    descriptorResolver.setStorageManager(storageManager);
    descriptorResolver.setTypeResolver(typeResolver);

    delegatedPropertyResolver.setCallResolver(callResolver);
    delegatedPropertyResolver.setExpressionTypingServices(expressionTypingServices);

    typeResolver.setAnnotationResolver(annotationResolver);
    typeResolver.setModuleDescriptor(moduleDescriptor);
    typeResolver.setQualifiedExpressionResolver(qualifiedExpressionResolver);

    candidateResolver.setArgumentTypeResolver(argumentTypeResolver);

    controlFlowAnalyzer.setTrace(bindingTrace);

    declarationsChecker.setAdditionalCheckerProvider(additionalCheckerProvider);
    declarationsChecker.setDescriptorResolver(descriptorResolver);
    declarationsChecker.setTrace(bindingTrace);

    functionAnalyzerExtension.setTrace(bindingTrace);

    scriptBodyResolver.setExpressionTypingServices(expressionTypingServices);

    declarationResolver.setAnnotationResolver(annotationResolver);
    declarationResolver.setDescriptorResolver(descriptorResolver);
    declarationResolver.setImportsResolver(importsResolver);
    declarationResolver.setTrace(bindingTrace);

    importsResolver.setImportsFactory(jetImportsFactory);
    importsResolver.setModuleDescriptor(moduleDescriptor);
    importsResolver.setQualifiedExpressionResolver(qualifiedExpressionResolver);
    importsResolver.setTrace(bindingTrace);

    jetImportsFactory.setProject(project);

    overloadResolver.setTrace(bindingTrace);

    overrideResolver.setTrace(bindingTrace);

    typeHierarchyResolver.setDescriptorResolver(descriptorResolver);
    typeHierarchyResolver.setImportsResolver(importsResolver);
    typeHierarchyResolver.setPackageFragmentProvider(mutablePackageFragmentProvider);
    typeHierarchyResolver.setScriptHeaderResolver(scriptHeaderResolver);
    typeHierarchyResolver.setTrace(bindingTrace);

    scriptHeaderResolver.setPackageFragmentProvider(mutablePackageFragmentProvider);
    scriptHeaderResolver.setTrace(bindingTrace);

    deserializedDescriptorResolver.setContext(deserializationGlobalContextForJava);
    deserializedDescriptorResolver.setErrorReporter(traceBasedErrorReporter);

    annotationDescriptorLoader.setErrorReporter(traceBasedErrorReporter);
    annotationDescriptorLoader.setKotlinClassFinder(virtualFileFinder);
    annotationDescriptorLoader.setModule(moduleDescriptor);
    annotationDescriptorLoader.setStorage(descriptorLoadersStorage);

    descriptorLoadersStorage.setErrorReporter(traceBasedErrorReporter);
    descriptorLoadersStorage.setModule(moduleDescriptor);

    constantDescriptorLoader.setErrorReporter(traceBasedErrorReporter);
    constantDescriptorLoader.setKotlinClassFinder(virtualFileFinder);
    constantDescriptorLoader.setStorage(descriptorLoadersStorage);
  }
コード例 #2
0
  public InjectorForBodyResolve(
      @NotNull Project project,
      @NotNull GlobalContext globalContext,
      @NotNull BindingTrace bindingTrace,
      @NotNull ModuleDescriptor moduleDescriptor) {
    this.project = project;
    this.globalContext = globalContext;
    this.storageManager = globalContext.getStorageManager();
    this.bindingTrace = bindingTrace;
    this.moduleDescriptor = moduleDescriptor;
    this.platformToKotlinClassMap = moduleDescriptor.getPlatformToKotlinClassMap();
    this.bodyResolver = new BodyResolver();
    this.annotationResolver = new AnnotationResolver();
    this.callResolver = new CallResolver();
    this.argumentTypeResolver = new ArgumentTypeResolver();
    this.expressionTypingComponents = new ExpressionTypingComponents();
    this.expressionTypingServices = new ExpressionTypingServices(expressionTypingComponents);
    this.controlStructureTypingUtils = new ControlStructureTypingUtils(expressionTypingServices);
    this.expressionTypingUtils = new ExpressionTypingUtils(expressionTypingServices, callResolver);
    this.forLoopConventionsChecker = new ForLoopConventionsChecker();
    this.reflectionTypes = new ReflectionTypes(moduleDescriptor);
    this.callExpressionResolver = new CallExpressionResolver();
    this.descriptorResolver = new DescriptorResolver();
    this.delegatedPropertyResolver = new DelegatedPropertyResolver();
    this.typeResolver = new TypeResolver();
    this.qualifiedExpressionResolver = new QualifiedExpressionResolver();
    this.callResolverExtensionProvider = new CallResolverExtensionProvider();
    this.candidateResolver = new CandidateResolver();
    this.callCompleter = new CallCompleter(argumentTypeResolver, candidateResolver);
    this.controlFlowAnalyzer = new ControlFlowAnalyzer();
    this.declarationsChecker = new DeclarationsChecker();
    this.functionAnalyzerExtension = new FunctionAnalyzerExtension();
    this.scriptBodyResolver = new ScriptBodyResolver();

    this.bodyResolver.setAnnotationResolver(annotationResolver);
    this.bodyResolver.setCallResolver(callResolver);
    this.bodyResolver.setControlFlowAnalyzer(controlFlowAnalyzer);
    this.bodyResolver.setDeclarationsChecker(declarationsChecker);
    this.bodyResolver.setDelegatedPropertyResolver(delegatedPropertyResolver);
    this.bodyResolver.setExpressionTypingServices(expressionTypingServices);
    this.bodyResolver.setFunctionAnalyzerExtension(functionAnalyzerExtension);
    this.bodyResolver.setScriptBodyResolverResolver(scriptBodyResolver);
    this.bodyResolver.setTrace(bindingTrace);

    annotationResolver.setCallResolver(callResolver);
    annotationResolver.setStorageManager(storageManager);
    annotationResolver.setTypeResolver(typeResolver);

    callResolver.setArgumentTypeResolver(argumentTypeResolver);
    callResolver.setCallCompleter(callCompleter);
    callResolver.setCandidateResolver(candidateResolver);
    callResolver.setExpressionTypingServices(expressionTypingServices);
    callResolver.setTypeResolver(typeResolver);

    argumentTypeResolver.setExpressionTypingServices(expressionTypingServices);
    argumentTypeResolver.setTypeResolver(typeResolver);

    expressionTypingServices.setAnnotationResolver(annotationResolver);
    expressionTypingServices.setCallExpressionResolver(callExpressionResolver);
    expressionTypingServices.setCallResolver(callResolver);
    expressionTypingServices.setDescriptorResolver(descriptorResolver);
    expressionTypingServices.setExtensionProvider(callResolverExtensionProvider);
    expressionTypingServices.setProject(project);
    expressionTypingServices.setTypeResolver(typeResolver);

    expressionTypingComponents.setCallResolver(callResolver);
    expressionTypingComponents.setControlStructureTypingUtils(controlStructureTypingUtils);
    expressionTypingComponents.setExpressionTypingServices(expressionTypingServices);
    expressionTypingComponents.setExpressionTypingUtils(expressionTypingUtils);
    expressionTypingComponents.setForLoopConventionsChecker(forLoopConventionsChecker);
    expressionTypingComponents.setGlobalContext(globalContext);
    expressionTypingComponents.setPlatformToKotlinClassMap(platformToKotlinClassMap);
    expressionTypingComponents.setReflectionTypes(reflectionTypes);

    forLoopConventionsChecker.setExpressionTypingServices(expressionTypingServices);
    forLoopConventionsChecker.setExpressionTypingUtils(expressionTypingUtils);
    forLoopConventionsChecker.setProject(project);

    callExpressionResolver.setExpressionTypingServices(expressionTypingServices);

    descriptorResolver.setAnnotationResolver(annotationResolver);
    descriptorResolver.setDelegatedPropertyResolver(delegatedPropertyResolver);
    descriptorResolver.setExpressionTypingServices(expressionTypingServices);
    descriptorResolver.setStorageManager(storageManager);
    descriptorResolver.setTypeResolver(typeResolver);

    delegatedPropertyResolver.setCallResolver(callResolver);
    delegatedPropertyResolver.setExpressionTypingServices(expressionTypingServices);

    typeResolver.setAnnotationResolver(annotationResolver);
    typeResolver.setModuleDescriptor(moduleDescriptor);
    typeResolver.setQualifiedExpressionResolver(qualifiedExpressionResolver);

    candidateResolver.setArgumentTypeResolver(argumentTypeResolver);

    controlFlowAnalyzer.setTrace(bindingTrace);

    declarationsChecker.setDescriptorResolver(descriptorResolver);
    declarationsChecker.setTrace(bindingTrace);

    functionAnalyzerExtension.setTrace(bindingTrace);

    scriptBodyResolver.setExpressionTypingServices(expressionTypingServices);
  }