我\xe2\x80\x99m 尝试开发一个codegen IDEA-Plugin。这个插件应该分析KtClass继承并获取所有继承类的全名(例如 com.example.config.TestConfig)
我尝试通过查看 PsiViewer 来查找任何有用的信息。我发现KtClass的所有继承信息都存储在 中KtSuperTypeEntry,并且我尽力获取继承类的全名。
上课Dest:
data class Dest(\n val stringValue: String = "123",\n override val stringConfig: String = "123",\n override val iConfigStr: String = "123",\n val b: B = B(),\n val c: List<List<Set<Map<String, out Any?>>>> = listOf(),\n val config: Config? = Config()\n) : Config()\nRun Code Online (Sandbox Code Playgroud)\n"Config"null看起来SuperTypeListEntry只包含继承类的简单名称信息。
\n我还尝试通过 KtFile 查找继承类全名,但不知道继承类何时作为通配符在此 KtFile 中导入:
\nfun KtSuperTypeListEntry.getType(ktFile: KtFile): String …Run Code Online (Sandbox Code Playgroud) compiler-construction intellij-plugin kotlin intellij-platform-psi