Пример #1
0
 @NotNull
 private List<AnnotationDescriptor> resolveAnnotations() {
   JetClassLikeInfo classInfo = declarationProvider.getOwnerInfo();
   JetModifierList modifierList = classInfo.getModifierList();
   if (modifierList != null) {
     AnnotationResolver annotationResolver = resolveSession.getInjector().getAnnotationResolver();
     JetScope scopeForDeclaration =
         getScopeProvider().getResolutionScopeForDeclaration(classInfo.getScopeAnchor());
     return annotationResolver.resolveAnnotationsWithArguments(
         scopeForDeclaration, modifierList, resolveSession.getTrace());
   } else {
     return Collections.emptyList();
   }
 }
Пример #2
0
 @Override
 public List<AnnotationDescriptor> getAnnotations() {
   if (annotations == null) {
     JetClassLikeInfo classInfo = declarationProvider.getOwnerInfo();
     JetModifierList modifierList = classInfo.getModifierList();
     if (modifierList != null) {
       AnnotationResolver annotationResolver =
           resolveSession.getInjector().getAnnotationResolver();
       annotations =
           annotationResolver.resolveAnnotations(
               resolveSession.getResolutionScope(classInfo.getScopeAnchor()),
               modifierList,
               resolveSession.getTrace());
     } else {
       annotations = Collections.emptyList();
     }
   }
   return annotations;
 }
  public InjectorForTopDownAnalyzerForJs(
      @NotNull Project project,
      @NotNull TopDownAnalysisParameters topDownAnalysisParameters,
      @NotNull BindingTrace bindingTrace,
      @NotNull ModuleDescriptorImpl moduleDescriptor) {
    this.topDownAnalyzer = new TopDownAnalyzer();
    this.topDownAnalysisContext = new TopDownAnalysisContext();
    this.bodyResolver = new BodyResolver();
    this.controlFlowAnalyzer = new ControlFlowAnalyzer();
    this.declarationsChecker = new DeclarationsChecker();
    this.descriptorResolver = new DescriptorResolver();
    this.callResolverExtensionProvider = new CallResolverExtensionProvider();
    this.project = project;
    this.topDownAnalysisParameters = topDownAnalysisParameters;
    this.bindingTrace = bindingTrace;
    this.moduleDescriptor = moduleDescriptor;
    this.dependencyClassByQualifiedNameResolverDummy =
        new DependencyClassByQualifiedNameResolverDummyImpl();
    this.namespaceFactory = new NamespaceFactoryImpl();
    this.platformToKotlinClassMap = org.jetbrains.jet.lang.PlatformToKotlinClassMap.EMPTY;
    this.declarationResolver = new DeclarationResolver();
    this.annotationResolver = new AnnotationResolver();
    this.callResolver = new CallResolver();
    this.argumentTypeResolver = new ArgumentTypeResolver();
    this.expressionTypingServices = new ExpressionTypingServices();
    this.callExpressionResolver = new CallExpressionResolver();
    this.typeResolver = new TypeResolver();
    this.qualifiedExpressionResolver = new QualifiedExpressionResolver();
    this.candidateResolver = new CandidateResolver();
    this.importsResolver = new ImportsResolver();
    this.jetImportsFactory = new JetImportsFactory();
    this.scriptHeaderResolver = new ScriptHeaderResolver();
    this.overloadResolver = new OverloadResolver();
    this.overrideResolver = new OverrideResolver();
    this.typeHierarchyResolver = new TypeHierarchyResolver();
    this.delegatedPropertyResolver = new DelegatedPropertyResolver();
    this.functionAnalyzerExtension = new FunctionAnalyzerExtension();
    this.scriptBodyResolver = new ScriptBodyResolver();

    this.topDownAnalyzer.setBodyResolver(bodyResolver);
    this.topDownAnalyzer.setContext(topDownAnalysisContext);
    this.topDownAnalyzer.setDeclarationResolver(declarationResolver);
    this.topDownAnalyzer.setModuleDescriptor(moduleDescriptor);
    this.topDownAnalyzer.setNamespaceFactory(namespaceFactory);
    this.topDownAnalyzer.setOverloadResolver(overloadResolver);
    this.topDownAnalyzer.setOverrideResolver(overrideResolver);
    this.topDownAnalyzer.setTopDownAnalysisParameters(topDownAnalysisParameters);
    this.topDownAnalyzer.setTrace(bindingTrace);
    this.topDownAnalyzer.setTypeHierarchyResolver(typeHierarchyResolver);

    this.topDownAnalysisContext.setTopDownAnalysisParameters(topDownAnalysisParameters);

    this.bodyResolver.setAnnotationResolver(annotationResolver);
    this.bodyResolver.setCallResolver(callResolver);
    this.bodyResolver.setContext(topDownAnalysisContext);
    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.setTopDownAnalysisParameters(topDownAnalysisParameters);
    this.bodyResolver.setTrace(bindingTrace);

    this.controlFlowAnalyzer.setTopDownAnalysisParameters(topDownAnalysisParameters);
    this.controlFlowAnalyzer.setTrace(bindingTrace);

    this.declarationsChecker.setTrace(bindingTrace);

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

    namespaceFactory.setModuleDescriptor(moduleDescriptor);
    namespaceFactory.setTrace(bindingTrace);

    declarationResolver.setAnnotationResolver(annotationResolver);
    declarationResolver.setContext(topDownAnalysisContext);
    declarationResolver.setDescriptorResolver(descriptorResolver);
    declarationResolver.setImportsResolver(importsResolver);
    declarationResolver.setScriptHeaderResolver(scriptHeaderResolver);
    declarationResolver.setTrace(bindingTrace);

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

    callResolver.setArgumentTypeResolver(argumentTypeResolver);
    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.setPlatformToKotlinClassMap(platformToKotlinClassMap);
    expressionTypingServices.setProject(project);
    expressionTypingServices.setTypeResolver(typeResolver);

    callExpressionResolver.setExpressionTypingServices(expressionTypingServices);

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

    candidateResolver.setArgumentTypeResolver(argumentTypeResolver);

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

    jetImportsFactory.setProject(project);

    scriptHeaderResolver.setContext(topDownAnalysisContext);
    scriptHeaderResolver.setDependencyClassByQualifiedNameResolver(
        dependencyClassByQualifiedNameResolverDummy);
    scriptHeaderResolver.setNamespaceFactory(namespaceFactory);
    scriptHeaderResolver.setTopDownAnalysisParameters(topDownAnalysisParameters);
    scriptHeaderResolver.setTrace(bindingTrace);

    overloadResolver.setContext(topDownAnalysisContext);
    overloadResolver.setTrace(bindingTrace);

    overrideResolver.setContext(topDownAnalysisContext);
    overrideResolver.setTopDownAnalysisParameters(topDownAnalysisParameters);
    overrideResolver.setTrace(bindingTrace);

    typeHierarchyResolver.setContext(topDownAnalysisContext);
    typeHierarchyResolver.setDescriptorResolver(descriptorResolver);
    typeHierarchyResolver.setImportsResolver(importsResolver);
    typeHierarchyResolver.setNamespaceFactory(namespaceFactory);
    typeHierarchyResolver.setScriptHeaderResolver(scriptHeaderResolver);
    typeHierarchyResolver.setTrace(bindingTrace);

    delegatedPropertyResolver.setExpressionTypingServices(expressionTypingServices);

    functionAnalyzerExtension.setTrace(bindingTrace);

    scriptBodyResolver.setContext(topDownAnalysisContext);
    scriptBodyResolver.setExpressionTypingServices(expressionTypingServices);
    scriptBodyResolver.setTrace(bindingTrace);
  }
  public InjectorForTopDownAnalyzerForJvm(
      @NotNull Project project,
      @NotNull TopDownAnalysisParameters topDownAnalysisParameters,
      @NotNull BindingTrace bindingTrace,
      @NotNull ModuleDescriptorImpl moduleDescriptor) {
    this.topDownAnalyzer = new TopDownAnalyzer();
    this.topDownAnalysisContext = new TopDownAnalysisContext();
    this.bodyResolver = new BodyResolver();
    this.controlFlowAnalyzer = new ControlFlowAnalyzer();
    this.declarationsChecker = new DeclarationsChecker();
    this.descriptorResolver = new DescriptorResolver();
    this.project = project;
    this.topDownAnalysisParameters = topDownAnalysisParameters;
    this.bindingTrace = bindingTrace;
    this.moduleDescriptor = moduleDescriptor;
    this.javaBridgeConfiguration = new JavaBridgeConfiguration();
    this.javaDescriptorResolver = new JavaDescriptorResolver();
    this.psiClassFinder = new PsiClassFinderImpl();
    this.namespaceFactory = new NamespaceFactoryImpl();
    this.declarationResolver = new DeclarationResolver();
    this.annotationResolver = new AnnotationResolver();
    this.callResolver = new CallResolver();
    this.argumentTypeResolver = new ArgumentTypeResolver();
    this.expressionTypingServices = new ExpressionTypingServices();
    this.callExpressionResolver = new CallExpressionResolver();
    this.typeResolver = new TypeResolver();
    this.qualifiedExpressionResolver = new QualifiedExpressionResolver();
    this.candidateResolver = new CandidateResolver();
    this.importsResolver = new ImportsResolver();
    this.jetImportsFactory = new JetImportsFactory();
    this.scriptHeaderResolver = new ScriptHeaderResolver();
    this.overloadResolver = new OverloadResolver();
    this.overrideResolver = new OverrideResolver();
    this.typeHierarchyResolver = new TypeHierarchyResolver();
    this.scriptBodyResolver = new ScriptBodyResolver();
    this.javaSemanticServices = new JavaSemanticServices();
    this.psiDeclarationProviderFactory = new PsiDeclarationProviderFactory(psiClassFinder);
    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();

    this.topDownAnalyzer.setBodyResolver(bodyResolver);
    this.topDownAnalyzer.setContext(topDownAnalysisContext);
    this.topDownAnalyzer.setDeclarationResolver(declarationResolver);
    this.topDownAnalyzer.setModuleDescriptor(moduleDescriptor);
    this.topDownAnalyzer.setNamespaceFactory(namespaceFactory);
    this.topDownAnalyzer.setOverloadResolver(overloadResolver);
    this.topDownAnalyzer.setOverrideResolver(overrideResolver);
    this.topDownAnalyzer.setTopDownAnalysisParameters(topDownAnalysisParameters);
    this.topDownAnalyzer.setTrace(bindingTrace);
    this.topDownAnalyzer.setTypeHierarchyResolver(typeHierarchyResolver);

    this.topDownAnalysisContext.setTopDownAnalysisParameters(topDownAnalysisParameters);

    this.bodyResolver.setCallResolver(callResolver);
    this.bodyResolver.setContext(topDownAnalysisContext);
    this.bodyResolver.setControlFlowAnalyzer(controlFlowAnalyzer);
    this.bodyResolver.setDeclarationsChecker(declarationsChecker);
    this.bodyResolver.setDescriptorResolver(descriptorResolver);
    this.bodyResolver.setExpressionTypingServices(expressionTypingServices);
    this.bodyResolver.setScriptBodyResolverResolver(scriptBodyResolver);
    this.bodyResolver.setTopDownAnalysisParameters(topDownAnalysisParameters);
    this.bodyResolver.setTrace(bindingTrace);

    this.controlFlowAnalyzer.setTopDownAnalysisParameters(topDownAnalysisParameters);
    this.controlFlowAnalyzer.setTrace(bindingTrace);

    this.declarationsChecker.setTrace(bindingTrace);

    this.descriptorResolver.setAnnotationResolver(annotationResolver);
    this.descriptorResolver.setExpressionTypingServices(expressionTypingServices);
    this.descriptorResolver.setTypeResolver(typeResolver);

    this.javaBridgeConfiguration.setJavaSemanticServices(javaSemanticServices);

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

    psiClassFinder.setProject(project);

    this.namespaceFactory.setModuleDescriptor(moduleDescriptor);
    this.namespaceFactory.setTrace(bindingTrace);

    declarationResolver.setAnnotationResolver(annotationResolver);
    declarationResolver.setContext(topDownAnalysisContext);
    declarationResolver.setDescriptorResolver(descriptorResolver);
    declarationResolver.setImportsResolver(importsResolver);
    declarationResolver.setScriptHeaderResolver(scriptHeaderResolver);
    declarationResolver.setTrace(bindingTrace);

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

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

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

    expressionTypingServices.setCallExpressionResolver(callExpressionResolver);
    expressionTypingServices.setCallResolver(callResolver);
    expressionTypingServices.setDescriptorResolver(descriptorResolver);
    expressionTypingServices.setProject(project);
    expressionTypingServices.setTypeResolver(typeResolver);

    callExpressionResolver.setExpressionTypingServices(expressionTypingServices);

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

    candidateResolver.setArgumentTypeResolver(argumentTypeResolver);

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

    jetImportsFactory.setProject(project);

    scriptHeaderResolver.setContext(topDownAnalysisContext);
    scriptHeaderResolver.setDependencyClassByQualifiedNameResolver(javaDescriptorResolver);
    scriptHeaderResolver.setNamespaceFactory(namespaceFactory);
    scriptHeaderResolver.setTopDownAnalysisParameters(topDownAnalysisParameters);
    scriptHeaderResolver.setTrace(bindingTrace);

    overloadResolver.setContext(topDownAnalysisContext);
    overloadResolver.setTrace(bindingTrace);

    overrideResolver.setContext(topDownAnalysisContext);
    overrideResolver.setTopDownAnalysisParameters(topDownAnalysisParameters);
    overrideResolver.setTrace(bindingTrace);

    typeHierarchyResolver.setContext(topDownAnalysisContext);
    typeHierarchyResolver.setDescriptorResolver(descriptorResolver);
    typeHierarchyResolver.setImportsResolver(importsResolver);
    typeHierarchyResolver.setNamespaceFactory(namespaceFactory);
    typeHierarchyResolver.setScriptHeaderResolver(scriptHeaderResolver);
    typeHierarchyResolver.setTrace(bindingTrace);

    scriptBodyResolver.setContext(topDownAnalysisContext);
    scriptBodyResolver.setExpressionTypingServices(expressionTypingServices);
    scriptBodyResolver.setTrace(bindingTrace);

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

    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);

    psiClassFinder.initialize();
  }
  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);
  }
Пример #6
0
  public InjectorForTests(@NotNull Project project, @NotNull ModuleDescriptor moduleDescriptor) {
    this.project = project;
    this.moduleDescriptor = moduleDescriptor;
    this.platformToKotlinClassMap = moduleDescriptor.getPlatformToKotlinClassMap();
    this.descriptorResolver = new DescriptorResolver();
    this.expressionTypingComponents = new ExpressionTypingComponents();
    this.expressionTypingServices = new ExpressionTypingServices(expressionTypingComponents);
    this.callResolver = new CallResolver();
    this.expressionTypingUtils =
        new ExpressionTypingUtils(getExpressionTypingServices(), callResolver);
    this.typeResolver = new TypeResolver();
    this.globalContext = org.jetbrains.jet.context.ContextPackage.GlobalContext();
    this.storageManager = globalContext.getStorageManager();
    this.annotationResolver = new AnnotationResolver();
    this.argumentTypeResolver = new ArgumentTypeResolver();
    this.candidateResolver = new CandidateResolver();
    this.delegatedPropertyResolver = new DelegatedPropertyResolver();
    this.controlStructureTypingUtils =
        new ControlStructureTypingUtils(getExpressionTypingServices());
    this.forLoopConventionsChecker = new ForLoopConventionsChecker();
    this.reflectionTypes = new ReflectionTypes(moduleDescriptor);
    this.callExpressionResolver = new CallExpressionResolver();
    this.callResolverExtensionProvider = new CallResolverExtensionProvider();
    this.qualifiedExpressionResolver = new QualifiedExpressionResolver();

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

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

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

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

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

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

    candidateResolver.setArgumentTypeResolver(argumentTypeResolver);

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

    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);
  }
  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);
  }