Convert to Kotlin KotlinLightClassForPackage: fixes for j2k converter

This commit is contained in:
Nikolay Krasko
2015-02-06 15:30:49 +03:00
parent a4e2c3b6fa
commit 8dd910bd36
4 changed files with 91 additions and 186 deletions
@@ -282,7 +282,7 @@ public class IDELightClassGenerationSupport extends LightClassGenerationSupport
IdeaModuleInfo moduleInfo = info.getModuleInfo();
if (moduleInfo instanceof ModuleSourceInfo) {
KotlinLightClassForPackage lightClass =
KotlinLightClassForPackage.create(psiManager, packageFqName, moduleInfo.contentScope(), files);
KotlinLightClassForPackage.OBJECT$.create(psiManager, packageFqName, moduleInfo.contentScope(), files);
if (lightClass == null) continue;
result.add(lightClass);
@@ -113,7 +113,7 @@ private fun KotlinLightElement<*, *>.getModuleInfoForLightElement(): IdeaModuleI
}
val element = getOrigin() ?: when (this) {
is FakeLightClassForFileOfPackage -> this.getContainingFile()!!
is KotlinLightClassForPackage -> this.getFiles().first()
is KotlinLightClassForPackage -> this.files.first()
else -> throw IllegalStateException("Unknown light class without origin is referenced by IDE lazy resolve: $javaClass")
}
return element.getModuleInfo()