Do not include files that contains only top level classes or objects to LightClassForPackage
This commit is contained in:
+3
-2
@@ -199,10 +199,11 @@ public class CliLightClassGenerationSupport extends LightClassGenerationSupport
|
||||
public Collection<PsiClass> getPackageClasses(@NotNull FqName packageFqName, @NotNull GlobalSearchScope scope) {
|
||||
Collection<JetFile> filesInPackage = findFilesForPackage(packageFqName, scope);
|
||||
|
||||
if (PackagePartClassUtils.getPackageFilesWithCallables(filesInPackage).isEmpty()) return Collections.emptyList();
|
||||
List<JetFile> filesWithCallables = PackagePartClassUtils.getPackageFilesWithCallables(filesInPackage);
|
||||
if (filesWithCallables.isEmpty()) return Collections.emptyList();
|
||||
|
||||
//noinspection RedundantTypeArguments
|
||||
return UtilsPackage.<PsiClass>emptyOrSingletonList(KotlinLightClassForPackage.Factory.create(psiManager, packageFqName, scope, filesInPackage));
|
||||
return UtilsPackage.<PsiClass>emptyOrSingletonList(KotlinLightClassForPackage.Factory.create(psiManager, packageFqName, scope, filesWithCallables));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+3
-4
@@ -270,9 +270,8 @@ public class IDELightClassGenerationSupport extends LightClassGenerationSupport
|
||||
List<PsiClass> result = new ArrayList<PsiClass>();
|
||||
List<KotlinLightPackageClassInfo> packageClassesInfos = findPackageClassesInfos(packageFqName, scope);
|
||||
for (KotlinLightPackageClassInfo info : packageClassesInfos) {
|
||||
Collection<JetFile> files = info.getFiles();
|
||||
List<JetFile> filesWithCallables = PackagePartClassUtils.getPackageFilesWithCallables(files);
|
||||
if (filesWithCallables.isEmpty()) continue;
|
||||
List<JetFile> files = PackagePartClassUtils.getPackageFilesWithCallables(info.getFiles());
|
||||
if (files.isEmpty()) continue;
|
||||
|
||||
IdeaModuleInfo moduleInfo = info.getModuleInfo();
|
||||
if (moduleInfo instanceof ModuleSourceInfo) {
|
||||
@@ -289,7 +288,7 @@ public class IDELightClassGenerationSupport extends LightClassGenerationSupport
|
||||
}
|
||||
}
|
||||
else {
|
||||
PsiClass clsClass = getLightClassForDecompiledPackage(packageFqName, filesWithCallables);
|
||||
PsiClass clsClass = getLightClassForDecompiledPackage(packageFqName, files);
|
||||
if (clsClass != null) {
|
||||
result.add(clsClass);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user