org.jetbrains.jet.cli.jvm.compiler
Class CliLightClassGenerationSupport

java.lang.Object
  extended by org.jetbrains.jet.asJava.LightClassGenerationSupport
      extended by org.jetbrains.jet.cli.jvm.compiler.CliLightClassGenerationSupport

public class CliLightClassGenerationSupport
extends LightClassGenerationSupport

This class solves the problem of interdependency between analyzing Kotlin code and generating JetLightClasses Consider the following example: KClass.kt refers to JClass.java and vice versa To analyze KClass.kt we need to load descriptors from JClass.java, and to do that we need a JetLightClass instance for KClass, which can only be constructed when the structure of KClass is known. To mitigate this, CliLightClassGenerationSupport hold a trace that is shared between the analyzer and JetLightClasses


Nested Class Summary
static class CliLightClassGenerationSupport.CliBindingTrace
           
static class CliLightClassGenerationSupport.NoScopeRecordCliBindingTrace
           
 
Constructor Summary
CliLightClassGenerationSupport(com.intellij.openapi.project.Project project)
           
 
Method Summary
 BindingTraceContext createTrace()
           
 java.util.Collection<JetClassOrObject> findClassOrObjectDeclarations(FqName fqName, com.intellij.psi.search.GlobalSearchScope searchScope)
           
 java.util.Collection<JetClassOrObject> findClassOrObjectDeclarationsInPackage(FqName packageFqName, com.intellij.psi.search.GlobalSearchScope searchScope)
           
 java.util.Collection<JetFile> findFilesForPackage(FqName fqName, com.intellij.psi.search.GlobalSearchScope searchScope)
           
 LightClassConstructionContext getContextForClassOrObject(JetClassOrObject classOrObject)
           
 LightClassConstructionContext getContextForPackage(java.util.Collection<JetFile> files)
           
static CliLightClassGenerationSupport getInstanceForCli(com.intellij.openapi.project.Project project)
           
 java.util.Collection<com.intellij.psi.PsiClass> getPackageClasses(FqName packageFqName, com.intellij.psi.search.GlobalSearchScope scope)
           
 com.intellij.psi.PsiClass getPsiClass(JetClassOrObject classOrObject)
           
 java.util.Collection<FqName> getSubPackages(FqName fqn, com.intellij.psi.search.GlobalSearchScope scope)
           
 void initialize(BindingTrace trace, ModuleDescriptor module, KotlinCodeAnalyzer analyzer)
           
 boolean packageExists(FqName fqName, com.intellij.psi.search.GlobalSearchScope scope)
           
 
Methods inherited from class org.jetbrains.jet.asJava.LightClassGenerationSupport
getInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CliLightClassGenerationSupport

public CliLightClassGenerationSupport(@NotNull
                                      com.intellij.openapi.project.Project project)
Method Detail

getInstanceForCli

public static CliLightClassGenerationSupport getInstanceForCli(@NotNull
                                                               com.intellij.openapi.project.Project project)

initialize

public void initialize(@NotNull
                       BindingTrace trace,
                       @NotNull
                       ModuleDescriptor module,
                       @Nullable
                       KotlinCodeAnalyzer analyzer)

getContextForPackage

@NotNull
public LightClassConstructionContext getContextForPackage(@NotNull
                                                                  java.util.Collection<JetFile> files)
Specified by:
getContextForPackage in class LightClassGenerationSupport

getContextForClassOrObject

@NotNull
public LightClassConstructionContext getContextForClassOrObject(@NotNull
                                                                        JetClassOrObject classOrObject)
Specified by:
getContextForClassOrObject in class LightClassGenerationSupport

findClassOrObjectDeclarations

@NotNull
public java.util.Collection<JetClassOrObject> findClassOrObjectDeclarations(@NotNull
                                                                                    FqName fqName,
                                                                                    @NotNull
                                                                                    com.intellij.psi.search.GlobalSearchScope searchScope)
Specified by:
findClassOrObjectDeclarations in class LightClassGenerationSupport

findFilesForPackage

@NotNull
public java.util.Collection<JetFile> findFilesForPackage(@NotNull
                                                                 FqName fqName,
                                                                 @NotNull
                                                                 com.intellij.psi.search.GlobalSearchScope searchScope)
Specified by:
findFilesForPackage in class LightClassGenerationSupport

findClassOrObjectDeclarationsInPackage

@NotNull
public java.util.Collection<JetClassOrObject> findClassOrObjectDeclarationsInPackage(@NotNull
                                                                                             FqName packageFqName,
                                                                                             @NotNull
                                                                                             com.intellij.psi.search.GlobalSearchScope searchScope)
Specified by:
findClassOrObjectDeclarationsInPackage in class LightClassGenerationSupport

packageExists

public boolean packageExists(@NotNull
                             FqName fqName,
                             @NotNull
                             com.intellij.psi.search.GlobalSearchScope scope)
Specified by:
packageExists in class LightClassGenerationSupport

getSubPackages

@NotNull
public java.util.Collection<FqName> getSubPackages(@NotNull
                                                           FqName fqn,
                                                           @NotNull
                                                           com.intellij.psi.search.GlobalSearchScope scope)
Specified by:
getSubPackages in class LightClassGenerationSupport

getPsiClass

@Nullable
public com.intellij.psi.PsiClass getPsiClass(@NotNull
                                                      JetClassOrObject classOrObject)
Specified by:
getPsiClass in class LightClassGenerationSupport

getPackageClasses

@NotNull
public java.util.Collection<com.intellij.psi.PsiClass> getPackageClasses(@NotNull
                                                                                 FqName packageFqName,
                                                                                 @NotNull
                                                                                 com.intellij.psi.search.GlobalSearchScope scope)
Specified by:
getPackageClasses in class LightClassGenerationSupport

createTrace

@NotNull
public BindingTraceContext createTrace()