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