001 /* 002 * Copyright 2010-2014 JetBrains s.r.o. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017 package org.jetbrains.jet.di; 018 019 import com.intellij.openapi.project.Project; 020 import org.jetbrains.jet.context.GlobalContext; 021 import org.jetbrains.jet.storage.StorageManager; 022 import org.jetbrains.jet.lang.descriptors.impl.ModuleDescriptorImpl; 023 import org.jetbrains.jet.lang.PlatformToKotlinClassMap; 024 import com.intellij.psi.search.GlobalSearchScope; 025 import org.jetbrains.jet.lang.resolve.BindingTrace; 026 import org.jetbrains.jet.lang.resolve.lazy.declarations.DeclarationProviderFactory; 027 import org.jetbrains.jet.lang.resolve.java.lazy.ModuleClassResolver; 028 import org.jetbrains.jet.lang.resolve.lazy.ResolveSession; 029 import org.jetbrains.jet.lang.resolve.java.JavaDescriptorResolver; 030 import org.jetbrains.jet.lang.resolve.kotlin.VirtualFileFinder; 031 import org.jetbrains.jet.lang.resolve.java.JavaClassFinderImpl; 032 import org.jetbrains.jet.lang.resolve.java.resolver.TraceBasedExternalSignatureResolver; 033 import org.jetbrains.jet.lang.resolve.java.resolver.LazyResolveBasedCache; 034 import org.jetbrains.jet.lang.resolve.java.resolver.TraceBasedErrorReporter; 035 import org.jetbrains.jet.lang.resolve.java.resolver.PsiBasedMethodSignatureChecker; 036 import org.jetbrains.jet.lang.resolve.java.resolver.PsiBasedExternalAnnotationResolver; 037 import org.jetbrains.jet.lang.resolve.java.structure.impl.JavaPropertyInitializerEvaluatorImpl; 038 import org.jetbrains.jet.lang.resolve.java.resolver.JavaSourceElementFactoryImpl; 039 import org.jetbrains.jet.lang.resolve.java.JavaFlexibleTypeCapabilitiesProvider; 040 import org.jetbrains.jet.lang.resolve.AdditionalCheckerProvider; 041 import org.jetbrains.jet.lang.resolve.AnnotationResolver; 042 import org.jetbrains.jet.lang.resolve.calls.CallResolver; 043 import org.jetbrains.jet.lang.resolve.calls.ArgumentTypeResolver; 044 import org.jetbrains.jet.lang.types.expressions.ExpressionTypingServices; 045 import org.jetbrains.jet.lang.types.expressions.ExpressionTypingComponents; 046 import org.jetbrains.jet.lang.types.expressions.ControlStructureTypingUtils; 047 import org.jetbrains.jet.lang.types.expressions.ExpressionTypingUtils; 048 import org.jetbrains.jet.lang.types.expressions.ForLoopConventionsChecker; 049 import org.jetbrains.jet.lang.reflect.ReflectionTypes; 050 import org.jetbrains.jet.lang.resolve.calls.CallExpressionResolver; 051 import org.jetbrains.jet.lang.resolve.DescriptorResolver; 052 import org.jetbrains.jet.lang.resolve.DelegatedPropertyResolver; 053 import org.jetbrains.jet.lang.resolve.TypeResolver; 054 import org.jetbrains.jet.lang.resolve.QualifiedExpressionResolver; 055 import org.jetbrains.jet.lang.resolve.calls.CallResolverExtensionProvider; 056 import org.jetbrains.jet.lang.resolve.calls.CallCompleter; 057 import org.jetbrains.jet.lang.resolve.calls.CandidateResolver; 058 import org.jetbrains.jet.lang.psi.JetImportsFactory; 059 import org.jetbrains.jet.lang.resolve.lazy.ScopeProvider; 060 import org.jetbrains.jet.lang.resolve.ScriptBodyResolver; 061 import org.jetbrains.jet.lang.resolve.java.lazy.LazyJavaPackageFragmentProvider; 062 import org.jetbrains.jet.lang.resolve.java.lazy.GlobalJavaResolverContext; 063 import org.jetbrains.jet.lang.resolve.kotlin.DeserializedDescriptorResolver; 064 import org.jetbrains.jet.lang.resolve.kotlin.DeserializationGlobalContextForJava; 065 import org.jetbrains.jet.lang.resolve.kotlin.JavaClassDataFinder; 066 import org.jetbrains.jet.lang.resolve.kotlin.AnnotationDescriptorLoader; 067 import org.jetbrains.jet.lang.resolve.kotlin.DescriptorLoadersStorage; 068 import org.jetbrains.jet.lang.resolve.kotlin.ConstantDescriptorLoader; 069 import org.jetbrains.annotations.NotNull; 070 import javax.annotation.PreDestroy; 071 072 /* This file is generated by org.jetbrains.jet.generators.injectors.InjectorsPackage. DO NOT EDIT! */ 073 @SuppressWarnings("all") 074 public class InjectorForLazyResolveWithJava { 075 076 private final Project project; 077 private final GlobalContext globalContext; 078 private final StorageManager storageManager; 079 private final ModuleDescriptorImpl module; 080 private final PlatformToKotlinClassMap platformToKotlinClassMap; 081 private final GlobalSearchScope moduleContentScope; 082 private final BindingTrace bindingTrace; 083 private final DeclarationProviderFactory declarationProviderFactory; 084 private final ModuleClassResolver moduleClassResolver; 085 private final ResolveSession resolveSession; 086 private final JavaDescriptorResolver javaDescriptorResolver; 087 private final VirtualFileFinder virtualFileFinder; 088 private final JavaClassFinderImpl javaClassFinder; 089 private final TraceBasedExternalSignatureResolver traceBasedExternalSignatureResolver; 090 private final LazyResolveBasedCache lazyResolveBasedCache; 091 private final TraceBasedErrorReporter traceBasedErrorReporter; 092 private final PsiBasedMethodSignatureChecker psiBasedMethodSignatureChecker; 093 private final PsiBasedExternalAnnotationResolver psiBasedExternalAnnotationResolver; 094 private final JavaPropertyInitializerEvaluatorImpl javaPropertyInitializerEvaluator; 095 private final JavaSourceElementFactoryImpl javaSourceElementFactory; 096 private final JavaFlexibleTypeCapabilitiesProvider javaFlexibleTypeCapabilitiesProvider; 097 private final AdditionalCheckerProvider additionalCheckerProvider; 098 private final AnnotationResolver annotationResolver; 099 private final CallResolver callResolver; 100 private final ArgumentTypeResolver argumentTypeResolver; 101 private final ExpressionTypingServices expressionTypingServices; 102 private final ExpressionTypingComponents expressionTypingComponents; 103 private final ControlStructureTypingUtils controlStructureTypingUtils; 104 private final ExpressionTypingUtils expressionTypingUtils; 105 private final ForLoopConventionsChecker forLoopConventionsChecker; 106 private final ReflectionTypes reflectionTypes; 107 private final CallExpressionResolver callExpressionResolver; 108 private final DescriptorResolver descriptorResolver; 109 private final DelegatedPropertyResolver delegatedPropertyResolver; 110 private final TypeResolver typeResolver; 111 private final QualifiedExpressionResolver qualifiedExpressionResolver; 112 private final CallResolverExtensionProvider callResolverExtensionProvider; 113 private final CallCompleter callCompleter; 114 private final CandidateResolver candidateResolver; 115 private final JetImportsFactory jetImportsFactory; 116 private final ScopeProvider scopeProvider; 117 private final ScriptBodyResolver scriptBodyResolver; 118 private final LazyJavaPackageFragmentProvider lazyJavaPackageFragmentProvider; 119 private final GlobalJavaResolverContext globalJavaResolverContext; 120 private final DeserializedDescriptorResolver deserializedDescriptorResolver; 121 private final DeserializationGlobalContextForJava deserializationGlobalContextForJava; 122 private final JavaClassDataFinder javaClassDataFinder; 123 private final AnnotationDescriptorLoader annotationDescriptorLoader; 124 private final DescriptorLoadersStorage descriptorLoadersStorage; 125 private final ConstantDescriptorLoader constantDescriptorLoader; 126 127 public InjectorForLazyResolveWithJava( 128 @NotNull Project project, 129 @NotNull GlobalContext globalContext, 130 @NotNull ModuleDescriptorImpl module, 131 @NotNull GlobalSearchScope moduleContentScope, 132 @NotNull BindingTrace bindingTrace, 133 @NotNull DeclarationProviderFactory declarationProviderFactory, 134 @NotNull ModuleClassResolver moduleClassResolver 135 ) { 136 this.project = project; 137 this.globalContext = globalContext; 138 this.storageManager = globalContext.getStorageManager(); 139 this.module = module; 140 this.platformToKotlinClassMap = module.getPlatformToKotlinClassMap(); 141 this.moduleContentScope = moduleContentScope; 142 this.bindingTrace = bindingTrace; 143 this.declarationProviderFactory = declarationProviderFactory; 144 this.moduleClassResolver = moduleClassResolver; 145 this.resolveSession = new ResolveSession(project, globalContext, module, declarationProviderFactory, bindingTrace); 146 this.javaClassFinder = new JavaClassFinderImpl(); 147 this.virtualFileFinder = org.jetbrains.jet.lang.resolve.kotlin.VirtualFileFinderFactory.SERVICE.getInstance(project).create(moduleContentScope); 148 this.deserializedDescriptorResolver = new DeserializedDescriptorResolver(); 149 this.psiBasedExternalAnnotationResolver = new PsiBasedExternalAnnotationResolver(); 150 this.traceBasedExternalSignatureResolver = new TraceBasedExternalSignatureResolver(); 151 this.traceBasedErrorReporter = new TraceBasedErrorReporter(); 152 this.psiBasedMethodSignatureChecker = new PsiBasedMethodSignatureChecker(); 153 this.lazyResolveBasedCache = new LazyResolveBasedCache(); 154 this.javaPropertyInitializerEvaluator = new JavaPropertyInitializerEvaluatorImpl(); 155 this.javaSourceElementFactory = new JavaSourceElementFactoryImpl(); 156 this.globalJavaResolverContext = new GlobalJavaResolverContext(storageManager, javaClassFinder, virtualFileFinder, deserializedDescriptorResolver, psiBasedExternalAnnotationResolver, traceBasedExternalSignatureResolver, traceBasedErrorReporter, psiBasedMethodSignatureChecker, lazyResolveBasedCache, javaPropertyInitializerEvaluator, javaSourceElementFactory, moduleClassResolver); 157 this.lazyJavaPackageFragmentProvider = new LazyJavaPackageFragmentProvider(globalJavaResolverContext, module); 158 this.javaDescriptorResolver = new JavaDescriptorResolver(lazyJavaPackageFragmentProvider, module); 159 this.javaFlexibleTypeCapabilitiesProvider = new JavaFlexibleTypeCapabilitiesProvider(); 160 this.additionalCheckerProvider = org.jetbrains.jet.lang.resolve.kotlin.JavaDeclarationCheckerProvider.INSTANCE$; 161 this.annotationResolver = new AnnotationResolver(); 162 this.callResolver = new CallResolver(); 163 this.argumentTypeResolver = new ArgumentTypeResolver(); 164 this.expressionTypingComponents = new ExpressionTypingComponents(); 165 this.expressionTypingServices = new ExpressionTypingServices(expressionTypingComponents); 166 this.controlStructureTypingUtils = new ControlStructureTypingUtils(expressionTypingServices); 167 this.expressionTypingUtils = new ExpressionTypingUtils(expressionTypingServices, callResolver); 168 this.forLoopConventionsChecker = new ForLoopConventionsChecker(); 169 this.reflectionTypes = new ReflectionTypes(module); 170 this.callExpressionResolver = new CallExpressionResolver(); 171 this.descriptorResolver = new DescriptorResolver(); 172 this.delegatedPropertyResolver = new DelegatedPropertyResolver(); 173 this.typeResolver = new TypeResolver(); 174 this.qualifiedExpressionResolver = new QualifiedExpressionResolver(); 175 this.callResolverExtensionProvider = new CallResolverExtensionProvider(); 176 this.candidateResolver = new CandidateResolver(); 177 this.callCompleter = new CallCompleter(argumentTypeResolver, candidateResolver); 178 this.jetImportsFactory = new JetImportsFactory(); 179 this.scopeProvider = new ScopeProvider(getResolveSession()); 180 this.scriptBodyResolver = new ScriptBodyResolver(); 181 this.javaClassDataFinder = new JavaClassDataFinder(virtualFileFinder, deserializedDescriptorResolver); 182 this.annotationDescriptorLoader = new AnnotationDescriptorLoader(); 183 this.constantDescriptorLoader = new ConstantDescriptorLoader(); 184 this.deserializationGlobalContextForJava = new DeserializationGlobalContextForJava(storageManager, module, javaClassDataFinder, annotationDescriptorLoader, constantDescriptorLoader, lazyJavaPackageFragmentProvider); 185 this.descriptorLoadersStorage = new DescriptorLoadersStorage(storageManager); 186 187 this.resolveSession.setAnnotationResolve(annotationResolver); 188 this.resolveSession.setDescriptorResolver(descriptorResolver); 189 this.resolveSession.setJetImportFactory(jetImportsFactory); 190 this.resolveSession.setQualifiedExpressionResolver(qualifiedExpressionResolver); 191 this.resolveSession.setScopeProvider(scopeProvider); 192 this.resolveSession.setScriptBodyResolver(scriptBodyResolver); 193 this.resolveSession.setTypeResolver(typeResolver); 194 195 javaClassFinder.setProject(project); 196 javaClassFinder.setScope(moduleContentScope); 197 198 traceBasedExternalSignatureResolver.setExternalAnnotationResolver(psiBasedExternalAnnotationResolver); 199 traceBasedExternalSignatureResolver.setProject(project); 200 traceBasedExternalSignatureResolver.setTrace(bindingTrace); 201 202 lazyResolveBasedCache.setSession(resolveSession); 203 204 traceBasedErrorReporter.setTrace(bindingTrace); 205 206 psiBasedMethodSignatureChecker.setExternalAnnotationResolver(psiBasedExternalAnnotationResolver); 207 psiBasedMethodSignatureChecker.setExternalSignatureResolver(traceBasedExternalSignatureResolver); 208 209 annotationResolver.setCallResolver(callResolver); 210 annotationResolver.setStorageManager(storageManager); 211 annotationResolver.setTypeResolver(typeResolver); 212 213 callResolver.setArgumentTypeResolver(argumentTypeResolver); 214 callResolver.setCallCompleter(callCompleter); 215 callResolver.setCandidateResolver(candidateResolver); 216 callResolver.setExpressionTypingServices(expressionTypingServices); 217 callResolver.setTypeResolver(typeResolver); 218 219 argumentTypeResolver.setExpressionTypingServices(expressionTypingServices); 220 argumentTypeResolver.setTypeResolver(typeResolver); 221 222 expressionTypingServices.setAnnotationResolver(annotationResolver); 223 expressionTypingServices.setCallExpressionResolver(callExpressionResolver); 224 expressionTypingServices.setCallResolver(callResolver); 225 expressionTypingServices.setDescriptorResolver(descriptorResolver); 226 expressionTypingServices.setExtensionProvider(callResolverExtensionProvider); 227 expressionTypingServices.setProject(project); 228 expressionTypingServices.setTypeResolver(typeResolver); 229 230 expressionTypingComponents.setAdditionalCheckerProvider(additionalCheckerProvider); 231 expressionTypingComponents.setCallResolver(callResolver); 232 expressionTypingComponents.setControlStructureTypingUtils(controlStructureTypingUtils); 233 expressionTypingComponents.setExpressionTypingServices(expressionTypingServices); 234 expressionTypingComponents.setExpressionTypingUtils(expressionTypingUtils); 235 expressionTypingComponents.setForLoopConventionsChecker(forLoopConventionsChecker); 236 expressionTypingComponents.setGlobalContext(globalContext); 237 expressionTypingComponents.setPlatformToKotlinClassMap(platformToKotlinClassMap); 238 expressionTypingComponents.setReflectionTypes(reflectionTypes); 239 240 forLoopConventionsChecker.setExpressionTypingServices(expressionTypingServices); 241 forLoopConventionsChecker.setExpressionTypingUtils(expressionTypingUtils); 242 forLoopConventionsChecker.setProject(project); 243 244 callExpressionResolver.setExpressionTypingServices(expressionTypingServices); 245 246 descriptorResolver.setAnnotationResolver(annotationResolver); 247 descriptorResolver.setDelegatedPropertyResolver(delegatedPropertyResolver); 248 descriptorResolver.setExpressionTypingServices(expressionTypingServices); 249 descriptorResolver.setStorageManager(storageManager); 250 descriptorResolver.setTypeResolver(typeResolver); 251 252 delegatedPropertyResolver.setCallResolver(callResolver); 253 delegatedPropertyResolver.setExpressionTypingServices(expressionTypingServices); 254 255 typeResolver.setAnnotationResolver(annotationResolver); 256 typeResolver.setFlexibleTypeCapabilitiesProvider(javaFlexibleTypeCapabilitiesProvider); 257 typeResolver.setModuleDescriptor(module); 258 typeResolver.setQualifiedExpressionResolver(qualifiedExpressionResolver); 259 260 candidateResolver.setArgumentTypeResolver(argumentTypeResolver); 261 262 jetImportsFactory.setProject(project); 263 264 scriptBodyResolver.setExpressionTypingServices(expressionTypingServices); 265 266 deserializedDescriptorResolver.setContext(deserializationGlobalContextForJava); 267 deserializedDescriptorResolver.setErrorReporter(traceBasedErrorReporter); 268 269 annotationDescriptorLoader.setErrorReporter(traceBasedErrorReporter); 270 annotationDescriptorLoader.setKotlinClassFinder(virtualFileFinder); 271 annotationDescriptorLoader.setModule(module); 272 annotationDescriptorLoader.setStorage(descriptorLoadersStorage); 273 274 descriptorLoadersStorage.setErrorReporter(traceBasedErrorReporter); 275 descriptorLoadersStorage.setModule(module); 276 277 constantDescriptorLoader.setErrorReporter(traceBasedErrorReporter); 278 constantDescriptorLoader.setKotlinClassFinder(virtualFileFinder); 279 constantDescriptorLoader.setStorage(descriptorLoadersStorage); 280 281 javaClassFinder.initialize(); 282 283 } 284 285 @PreDestroy 286 public void destroy() { 287 } 288 289 public ResolveSession getResolveSession() { 290 return this.resolveSession; 291 } 292 293 public JavaDescriptorResolver getJavaDescriptorResolver() { 294 return this.javaDescriptorResolver; 295 } 296 297 }