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.sam.SamConversionResolverImpl;
039    import org.jetbrains.jet.lang.resolve.java.resolver.JavaSourceElementFactoryImpl;
040    import org.jetbrains.jet.lang.resolve.java.JavaFlexibleTypeCapabilitiesProvider;
041    import org.jetbrains.jet.context.LazyResolveToken;
042    import org.jetbrains.jet.lang.resolve.AdditionalCheckerProvider;
043    import org.jetbrains.jet.lang.resolve.AnnotationResolver;
044    import org.jetbrains.jet.lang.resolve.calls.CallResolver;
045    import org.jetbrains.jet.lang.resolve.calls.ArgumentTypeResolver;
046    import org.jetbrains.jet.lang.types.expressions.ExpressionTypingServices;
047    import org.jetbrains.jet.lang.types.expressions.ExpressionTypingComponents;
048    import org.jetbrains.jet.lang.types.expressions.ControlStructureTypingUtils;
049    import org.jetbrains.jet.lang.types.expressions.ExpressionTypingUtils;
050    import org.jetbrains.jet.lang.types.expressions.ForLoopConventionsChecker;
051    import org.jetbrains.jet.lang.reflect.ReflectionTypes;
052    import org.jetbrains.jet.lang.resolve.calls.CallExpressionResolver;
053    import org.jetbrains.jet.lang.resolve.DescriptorResolver;
054    import org.jetbrains.jet.lang.resolve.DelegatedPropertyResolver;
055    import org.jetbrains.jet.lang.resolve.TypeResolver;
056    import org.jetbrains.jet.lang.resolve.QualifiedExpressionResolver;
057    import org.jetbrains.jet.lang.resolve.calls.CallResolverExtensionProvider;
058    import org.jetbrains.jet.lang.resolve.PartialBodyResolveProvider;
059    import org.jetbrains.jet.lang.resolve.calls.CallCompleter;
060    import org.jetbrains.jet.lang.resolve.calls.CandidateResolver;
061    import org.jetbrains.jet.lang.resolve.calls.tasks.TaskPrioritizer;
062    import org.jetbrains.jet.lang.psi.JetImportsFactory;
063    import org.jetbrains.jet.lang.resolve.lazy.ScopeProvider;
064    import org.jetbrains.jet.lang.resolve.ScriptBodyResolver;
065    import org.jetbrains.jet.lang.resolve.java.lazy.LazyJavaPackageFragmentProvider;
066    import org.jetbrains.jet.lang.resolve.java.lazy.GlobalJavaResolverContext;
067    import org.jetbrains.jet.lang.resolve.kotlin.DeserializedDescriptorResolver;
068    import org.jetbrains.jet.lang.resolve.kotlin.DeserializationComponentsForJava;
069    import org.jetbrains.jet.lang.resolve.kotlin.JavaClassDataFinder;
070    import org.jetbrains.jet.lang.resolve.kotlin.AnnotationDescriptorLoader;
071    import org.jetbrains.jet.lang.resolve.kotlin.DescriptorLoadersStorage;
072    import org.jetbrains.jet.lang.resolve.kotlin.ConstantDescriptorLoader;
073    import org.jetbrains.annotations.NotNull;
074    import javax.annotation.PreDestroy;
075    
076    /* This file is generated by org.jetbrains.jet.generators.injectors.InjectorsPackage. DO NOT EDIT! */
077    @SuppressWarnings("all")
078    public class InjectorForLazyResolveWithJava {
079    
080        private final Project project;
081        private final GlobalContext globalContext;
082        private final StorageManager storageManager;
083        private final ModuleDescriptorImpl module;
084        private final PlatformToKotlinClassMap platformToKotlinClassMap;
085        private final GlobalSearchScope moduleContentScope;
086        private final BindingTrace bindingTrace;
087        private final DeclarationProviderFactory declarationProviderFactory;
088        private final ModuleClassResolver moduleClassResolver;
089        private final ResolveSession resolveSession;
090        private final JavaDescriptorResolver javaDescriptorResolver;
091        private final VirtualFileFinder virtualFileFinder;
092        private final JavaClassFinderImpl javaClassFinder;
093        private final TraceBasedExternalSignatureResolver traceBasedExternalSignatureResolver;
094        private final LazyResolveBasedCache lazyResolveBasedCache;
095        private final TraceBasedErrorReporter traceBasedErrorReporter;
096        private final PsiBasedMethodSignatureChecker psiBasedMethodSignatureChecker;
097        private final PsiBasedExternalAnnotationResolver psiBasedExternalAnnotationResolver;
098        private final JavaPropertyInitializerEvaluatorImpl javaPropertyInitializerEvaluator;
099        private final SamConversionResolverImpl samConversionResolver;
100        private final JavaSourceElementFactoryImpl javaSourceElementFactory;
101        private final JavaFlexibleTypeCapabilitiesProvider javaFlexibleTypeCapabilitiesProvider;
102        private final LazyResolveToken lazyResolveToken;
103        private final AdditionalCheckerProvider additionalCheckerProvider;
104        private final AnnotationResolver annotationResolver;
105        private final CallResolver callResolver;
106        private final ArgumentTypeResolver argumentTypeResolver;
107        private final ExpressionTypingServices expressionTypingServices;
108        private final ExpressionTypingComponents expressionTypingComponents;
109        private final ControlStructureTypingUtils controlStructureTypingUtils;
110        private final ExpressionTypingUtils expressionTypingUtils;
111        private final ForLoopConventionsChecker forLoopConventionsChecker;
112        private final ReflectionTypes reflectionTypes;
113        private final CallExpressionResolver callExpressionResolver;
114        private final DescriptorResolver descriptorResolver;
115        private final DelegatedPropertyResolver delegatedPropertyResolver;
116        private final TypeResolver typeResolver;
117        private final QualifiedExpressionResolver qualifiedExpressionResolver;
118        private final CallResolverExtensionProvider callResolverExtensionProvider;
119        private final PartialBodyResolveProvider partialBodyResolveProvider;
120        private final CallCompleter callCompleter;
121        private final CandidateResolver candidateResolver;
122        private final TaskPrioritizer taskPrioritizer;
123        private final JetImportsFactory jetImportsFactory;
124        private final ScopeProvider scopeProvider;
125        private final ScriptBodyResolver scriptBodyResolver;
126        private final LazyJavaPackageFragmentProvider lazyJavaPackageFragmentProvider;
127        private final GlobalJavaResolverContext globalJavaResolverContext;
128        private final DeserializedDescriptorResolver deserializedDescriptorResolver;
129        private final DeserializationComponentsForJava deserializationComponentsForJava;
130        private final JavaClassDataFinder javaClassDataFinder;
131        private final AnnotationDescriptorLoader annotationDescriptorLoader;
132        private final DescriptorLoadersStorage descriptorLoadersStorage;
133        private final ConstantDescriptorLoader constantDescriptorLoader;
134    
135        public InjectorForLazyResolveWithJava(
136            @NotNull Project project,
137            @NotNull GlobalContext globalContext,
138            @NotNull ModuleDescriptorImpl module,
139            @NotNull GlobalSearchScope moduleContentScope,
140            @NotNull BindingTrace bindingTrace,
141            @NotNull DeclarationProviderFactory declarationProviderFactory,
142            @NotNull ModuleClassResolver moduleClassResolver
143        ) {
144            this.project = project;
145            this.globalContext = globalContext;
146            this.storageManager = globalContext.getStorageManager();
147            this.module = module;
148            this.platformToKotlinClassMap = module.getPlatformToKotlinClassMap();
149            this.moduleContentScope = moduleContentScope;
150            this.bindingTrace = bindingTrace;
151            this.declarationProviderFactory = declarationProviderFactory;
152            this.moduleClassResolver = moduleClassResolver;
153            this.resolveSession = new ResolveSession(project, globalContext, module, declarationProviderFactory, bindingTrace);
154            this.javaClassFinder = new JavaClassFinderImpl();
155            this.virtualFileFinder = org.jetbrains.jet.lang.resolve.kotlin.VirtualFileFinderFactory.SERVICE.getInstance(project).create(moduleContentScope);
156            this.traceBasedErrorReporter = new TraceBasedErrorReporter();
157            this.deserializedDescriptorResolver = new DeserializedDescriptorResolver(traceBasedErrorReporter);
158            this.psiBasedExternalAnnotationResolver = new PsiBasedExternalAnnotationResolver();
159            this.traceBasedExternalSignatureResolver = new TraceBasedExternalSignatureResolver();
160            this.psiBasedMethodSignatureChecker = new PsiBasedMethodSignatureChecker();
161            this.lazyResolveBasedCache = new LazyResolveBasedCache();
162            this.javaPropertyInitializerEvaluator = new JavaPropertyInitializerEvaluatorImpl();
163            this.samConversionResolver = SamConversionResolverImpl.INSTANCE$;
164            this.javaSourceElementFactory = new JavaSourceElementFactoryImpl();
165            this.globalJavaResolverContext = new GlobalJavaResolverContext(storageManager, javaClassFinder, virtualFileFinder, deserializedDescriptorResolver, psiBasedExternalAnnotationResolver, traceBasedExternalSignatureResolver, traceBasedErrorReporter, psiBasedMethodSignatureChecker, lazyResolveBasedCache, javaPropertyInitializerEvaluator, samConversionResolver, javaSourceElementFactory, moduleClassResolver);
166            this.lazyJavaPackageFragmentProvider = new LazyJavaPackageFragmentProvider(globalJavaResolverContext, module);
167            this.javaDescriptorResolver = new JavaDescriptorResolver(lazyJavaPackageFragmentProvider, module);
168            this.javaFlexibleTypeCapabilitiesProvider = new JavaFlexibleTypeCapabilitiesProvider();
169            this.lazyResolveToken = new LazyResolveToken();
170            this.additionalCheckerProvider = org.jetbrains.jet.lang.resolve.kotlin.JavaDeclarationCheckerProvider.INSTANCE$;
171            this.annotationResolver = new AnnotationResolver();
172            this.callResolver = new CallResolver();
173            this.argumentTypeResolver = new ArgumentTypeResolver();
174            this.expressionTypingComponents = new ExpressionTypingComponents();
175            this.expressionTypingServices = new ExpressionTypingServices(expressionTypingComponents);
176            this.controlStructureTypingUtils = new ControlStructureTypingUtils(expressionTypingServices);
177            this.expressionTypingUtils = new ExpressionTypingUtils(expressionTypingServices, callResolver);
178            this.forLoopConventionsChecker = new ForLoopConventionsChecker();
179            this.reflectionTypes = new ReflectionTypes(module);
180            this.callExpressionResolver = new CallExpressionResolver();
181            this.descriptorResolver = new DescriptorResolver();
182            this.delegatedPropertyResolver = new DelegatedPropertyResolver();
183            this.qualifiedExpressionResolver = new QualifiedExpressionResolver();
184            this.typeResolver = new TypeResolver(annotationResolver, qualifiedExpressionResolver, module, javaFlexibleTypeCapabilitiesProvider, storageManager, lazyResolveToken);
185            this.callResolverExtensionProvider = new CallResolverExtensionProvider();
186            this.partialBodyResolveProvider = new PartialBodyResolveProvider();
187            this.candidateResolver = new CandidateResolver();
188            this.callCompleter = new CallCompleter(argumentTypeResolver, candidateResolver);
189            this.taskPrioritizer = new TaskPrioritizer(storageManager);
190            this.jetImportsFactory = new JetImportsFactory();
191            this.scopeProvider = new ScopeProvider(getResolveSession());
192            this.scriptBodyResolver = new ScriptBodyResolver();
193            this.javaClassDataFinder = new JavaClassDataFinder(virtualFileFinder, deserializedDescriptorResolver);
194            this.descriptorLoadersStorage = new DescriptorLoadersStorage(storageManager, module);
195            this.annotationDescriptorLoader = new AnnotationDescriptorLoader(module, descriptorLoadersStorage, virtualFileFinder, traceBasedErrorReporter);
196            this.constantDescriptorLoader = new ConstantDescriptorLoader(descriptorLoadersStorage, virtualFileFinder, traceBasedErrorReporter);
197            this.deserializationComponentsForJava = new DeserializationComponentsForJava(storageManager, module, javaClassDataFinder, annotationDescriptorLoader, constantDescriptorLoader, lazyJavaPackageFragmentProvider);
198    
199            this.resolveSession.setAnnotationResolve(annotationResolver);
200            this.resolveSession.setDescriptorResolver(descriptorResolver);
201            this.resolveSession.setJetImportFactory(jetImportsFactory);
202            this.resolveSession.setQualifiedExpressionResolver(qualifiedExpressionResolver);
203            this.resolveSession.setScopeProvider(scopeProvider);
204            this.resolveSession.setScriptBodyResolver(scriptBodyResolver);
205            this.resolveSession.setTypeResolver(typeResolver);
206    
207            javaClassFinder.setProject(project);
208            javaClassFinder.setScope(moduleContentScope);
209    
210            traceBasedExternalSignatureResolver.setExternalAnnotationResolver(psiBasedExternalAnnotationResolver);
211            traceBasedExternalSignatureResolver.setProject(project);
212            traceBasedExternalSignatureResolver.setTrace(bindingTrace);
213    
214            lazyResolveBasedCache.setSession(resolveSession);
215    
216            traceBasedErrorReporter.setTrace(bindingTrace);
217    
218            psiBasedMethodSignatureChecker.setExternalAnnotationResolver(psiBasedExternalAnnotationResolver);
219            psiBasedMethodSignatureChecker.setExternalSignatureResolver(traceBasedExternalSignatureResolver);
220    
221            annotationResolver.setCallResolver(callResolver);
222            annotationResolver.setStorageManager(storageManager);
223            annotationResolver.setTypeResolver(typeResolver);
224    
225            callResolver.setArgumentTypeResolver(argumentTypeResolver);
226            callResolver.setCallCompleter(callCompleter);
227            callResolver.setCandidateResolver(candidateResolver);
228            callResolver.setExpressionTypingServices(expressionTypingServices);
229            callResolver.setTaskPrioritizer(taskPrioritizer);
230            callResolver.setTypeResolver(typeResolver);
231    
232            argumentTypeResolver.setExpressionTypingServices(expressionTypingServices);
233            argumentTypeResolver.setTypeResolver(typeResolver);
234    
235            expressionTypingServices.setAnnotationResolver(annotationResolver);
236            expressionTypingServices.setCallExpressionResolver(callExpressionResolver);
237            expressionTypingServices.setCallResolver(callResolver);
238            expressionTypingServices.setDescriptorResolver(descriptorResolver);
239            expressionTypingServices.setExtensionProvider(callResolverExtensionProvider);
240            expressionTypingServices.setPartialBodyResolveProvider(partialBodyResolveProvider);
241            expressionTypingServices.setProject(project);
242            expressionTypingServices.setTypeResolver(typeResolver);
243    
244            expressionTypingComponents.setAdditionalCheckerProvider(additionalCheckerProvider);
245            expressionTypingComponents.setCallResolver(callResolver);
246            expressionTypingComponents.setControlStructureTypingUtils(controlStructureTypingUtils);
247            expressionTypingComponents.setExpressionTypingServices(expressionTypingServices);
248            expressionTypingComponents.setExpressionTypingUtils(expressionTypingUtils);
249            expressionTypingComponents.setForLoopConventionsChecker(forLoopConventionsChecker);
250            expressionTypingComponents.setGlobalContext(globalContext);
251            expressionTypingComponents.setPlatformToKotlinClassMap(platformToKotlinClassMap);
252            expressionTypingComponents.setReflectionTypes(reflectionTypes);
253    
254            forLoopConventionsChecker.setExpressionTypingServices(expressionTypingServices);
255            forLoopConventionsChecker.setExpressionTypingUtils(expressionTypingUtils);
256            forLoopConventionsChecker.setProject(project);
257    
258            callExpressionResolver.setExpressionTypingServices(expressionTypingServices);
259    
260            descriptorResolver.setAnnotationResolver(annotationResolver);
261            descriptorResolver.setDelegatedPropertyResolver(delegatedPropertyResolver);
262            descriptorResolver.setExpressionTypingServices(expressionTypingServices);
263            descriptorResolver.setStorageManager(storageManager);
264            descriptorResolver.setTypeResolver(typeResolver);
265    
266            delegatedPropertyResolver.setCallResolver(callResolver);
267            delegatedPropertyResolver.setExpressionTypingServices(expressionTypingServices);
268    
269            candidateResolver.setArgumentTypeResolver(argumentTypeResolver);
270    
271            jetImportsFactory.setProject(project);
272    
273            scriptBodyResolver.setExpressionTypingServices(expressionTypingServices);
274    
275            deserializedDescriptorResolver.setComponents(deserializationComponentsForJava);
276    
277            javaClassFinder.initialize();
278    
279        }
280    
281        @PreDestroy
282        public void destroy() {
283        }
284    
285        public ResolveSession getResolveSession() {
286            return this.resolveSession;
287        }
288    
289        public JavaDescriptorResolver getJavaDescriptorResolver() {
290            return this.javaDescriptorResolver;
291        }
292    
293    }