@NotNull
  @Override
  public LightClassConstructionContext getContextForPackage(@NotNull Collection<JetFile> files) {
    assert !files.isEmpty() : "No files in package";

    List<JetFile> sortedFiles = new ArrayList<JetFile>(files);
    Collections.sort(sortedFiles, scopeFileComparator);

    JetFile file = sortedFiles.get(0);
    ResolveSessionForBodies session =
        KotlinCacheService.getInstance(file.getProject()).getLazyResolveSession(file);
    forceResolvePackageDeclarations(files, session);
    return new LightClassConstructionContext(
        session.getBindingContext(), session.getModuleDescriptor());
  }
 private static BodyResolver createBodyResolver(
     DelegatingBindingTrace trace,
     JetFile file,
     BodyResolveContextForLazy bodyResolveContext,
     ModuleConfiguration moduleConfiguration) {
   TopDownAnalysisParameters parameters =
       new TopDownAnalysisParameters(
           Predicates.<PsiFile>alwaysTrue(),
           false,
           true,
           Collections.<AnalyzerScriptParameter>emptyList());
   InjectorForBodyResolve bodyResolve =
       new InjectorForBodyResolve(
           file.getProject(), parameters, trace, bodyResolveContext, moduleConfiguration);
   return bodyResolve.getBodyResolver();
 }
  @Nullable
  private static ClsClassImpl createClsJavaClassFromVirtualFile(
      @NotNull final JetFile decompiledKotlinFile,
      @NotNull VirtualFile virtualFile,
      @Nullable final JetClassOrObject decompiledClassOrObject) {
    final PsiJavaFileStubImpl javaFileStub = getOrCreateJavaFileStub(virtualFile);
    if (javaFileStub == null) {
      return null;
    }
    PsiManager manager = PsiManager.getInstance(decompiledKotlinFile.getProject());
    ClsFileImpl fakeFile =
        new ClsFileImpl((PsiManagerImpl) manager, new ClassFileViewProvider(manager, virtualFile)) {
          @NotNull
          @Override
          public PsiElement getNavigationElement() {
            if (decompiledClassOrObject != null) {
              return decompiledClassOrObject.getNavigationElement().getContainingFile();
            }
            return super.getNavigationElement();
          }

          @NotNull
          @Override
          public PsiClassHolderFileStub getStub() {
            return javaFileStub;
          }

          @Override
          public PsiElement getMirror() {
            return decompiledKotlinFile;
          }
        };
    fakeFile.setPhysical(false);
    javaFileStub.setPsi(fakeFile);
    return (ClsClassImpl) single(fakeFile.getClasses());
  }