mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java] Use navigationElement instead of originalFile to retrieve the file for JPMS module resolution
The problem arises with Kotlin light classes created by `DecompiledLightClassesFactory`. The resulting class isn't physical, and its `originalFile` doesn't point to the physical file as well. Thus, module info isn't found which, e.g., leads to some symbols not being recommended in the "Add dependency" family of quick fixes. `navigationElement`, however, is set properly in such classes so it can be used to find a PSI element which resides next to the potential module-info. As `TargetModuleInfo.module` can resolve JPMS module both via sources and via class files, it seems alright to provide any of such. GitOrigin-RevId: cec0309959a56e1976b4da5ca1f69b4041278e2a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
91183afb04
commit
7acb1c3ced
@@ -70,7 +70,7 @@ sealed interface JpmsModuleInfo {
|
||||
*/
|
||||
@JvmStatic
|
||||
fun findTargetModuleInfos(targetPackageName: String, targetFile: PsiFile?, place: PsiFile): List<TargetModuleInfo>? {
|
||||
val originalTargetFile = targetFile?.originalFile
|
||||
val originalTargetFile = targetFile?.navigationElement
|
||||
if (!PsiUtil.isAvailable(JavaFeature.MODULES, place)) return null
|
||||
|
||||
val useVFile = place.virtualFile
|
||||
|
||||
Reference in New Issue
Block a user