File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -271,7 +271,7 @@ object UtTestsDialogProcessor {
271271 val name = qualifiedName
272272 ?.substringAfter(" $packageName ." )
273273 ?.replace(" ." , " $" )
274- ? : " "
274+ ? : error( " Unable to get canonical name for $this " )
275275 " $packageName .$name "
276276 }
277277 }
Original file line number Diff line number Diff line change @@ -17,8 +17,9 @@ import com.intellij.openapi.projectRoots.JavaSdkVersion
1717import com.intellij.openapi.vfs.VirtualFile
1818import com.intellij.openapi.vfs.newvfs.impl.FakeVirtualFile
1919import com.intellij.psi.PsiClass
20+ import com.intellij.psi.PsiJavaFile
2021import com.intellij.refactoring.util.classMembers.MemberInfo
21- import org.jetbrains.kotlin.idea.core.getPackage
22+ import org.jetbrains.kotlin.psi.KtFile
2223import org.utbot.framework.plugin.api.JavaDocCommentStyle
2324import org.utbot.framework.util.ConflictTriggers
2425import org.utbot.intellij.plugin.ui.utils.jdkVersion
@@ -84,4 +85,11 @@ data class GenerateTestsModel(
8485 }
8586}
8687
87- val PsiClass .packageName: String get() = this .containingFile.containingDirectory.getPackage()?.qualifiedName ? : " "
88+ val PsiClass .packageName: String
89+ get() {
90+ return when (val currentFile = containingFile) {
91+ is PsiJavaFile -> currentFile.packageName
92+ is KtFile -> currentFile.packageFqName.asString()
93+ else -> error(" Can't find package name for $this : it should be located either in Java or Kt file" )
94+ }
95+ }
You can’t perform that action at this time.
0 commit comments