File tree Expand file tree Collapse file tree 3 files changed +18
-13
lines changed
utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin
utbot-ui-commons/src/main/kotlin/org/utbot/intellij/plugin/util Expand file tree Collapse file tree 3 files changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -177,11 +177,9 @@ object UtTestsDialogProcessor {
177177 val springConfigClass =
178178 when (val config = model.springSettings?.configuration) {
179179 is JavaConfiguration -> {
180- // Converting binary name to fqn name
181- val fqnName = config.classBinaryName.replace(" $" , " ." )
182180 PsiClassHelper
183- .findClass(fqnName , project)
184- ? : error(" Cannot find configuration class $fqnName ." )
181+ .findClass(config.classBinaryName , project)
182+ ? : error(" Cannot find configuration class ${config.classBinaryName} ." )
185183 }
186184
187185 else -> null
@@ -479,14 +477,12 @@ object UtTestsDialogProcessor {
479477 val beanType = runReadAction {
480478 val additionalData = bean.additionalData ? : return @runReadAction null
481479
482- // Converting binary name to fqn name
483- val fqnName = additionalData.configClassName.replace(" $" , " ." )
484480 val configPsiClass =
485481 PsiClassHelper
486- .findClass(fqnName , project)
482+ .findClass(additionalData.configClassName , project)
487483 ? : return @runReadAction null
488484 .also {
489- logger.warn(" Cannot find configuration class ${additionalData.configClassName} with $fqnName name ." )
485+ logger.warn(" Cannot find configuration class ${additionalData.configClassName} ." )
490486 }
491487
492488 val beanPsiMethod =
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ class SpringConfigurationsHelper(val configType: SpringConfigurationType) {
4242 .values
4343 .singleOrNull { it.shortenedName == shortenedName }
4444 ?.fullName
45- ? : error(" Full name of configuration file cannot be restored with shortened name $shortenedName " )
45+ ? : error(" Full name of configuration file cannot be restored from shortened name $shortenedName " )
4646
4747 fun shortenSpringConfigNames (fullNames : Set <String >): Map <String , String > {
4848 fullNames.forEach { nameToInfo[it] = NameInfo (it) }
@@ -92,12 +92,13 @@ class SpringConfigurationsHelper(val configType: SpringConfigurationType) {
9292
9393}
9494
95+ @Deprecated(" To be deleted" )
9596enum class SpringConfigurationType (
9697 val separatorsToSplitBy : Array <String >,
9798 val separatorToConcatenateBy : String ,
9899) {
99100 ClassConfiguration (
100- separatorsToSplitBy = arrayOf(" ." , " $ " ),
101+ separatorsToSplitBy = arrayOf(" ." ),
101102 separatorToConcatenateBy = " ." ,
102103 ),
103104
Original file line number Diff line number Diff line change @@ -109,8 +109,16 @@ val PsiClass.isVisible: Boolean
109109 get() = generateSequence(this ) { it.containingClass }.none { it.isPrivateOrProtected }
110110
111111object PsiClassHelper {
112- fun findClass (name : String , project : Project ): PsiClass ? =
113- JavaPsiFacade
112+ /* *
113+ * Finds [PsiClass].
114+ *
115+ * @param name binary name which is converted to canonical name.
116+ */
117+ fun findClass (name : String , project : Project ): PsiClass ? {
118+ // Converting name to canonical name
119+ val canonicalName = name.replace(" $" , " ." )
120+ return JavaPsiFacade
114121 .getInstance(project)
115- .findClass(name, GlobalSearchScope .projectScope(project))
122+ .findClass(canonicalName, GlobalSearchScope .projectScope(project))
123+ }
116124}
You can’t perform that action at this time.
0 commit comments