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