SpringKotlinAutowiringInspection: workaround for nameless property (EA-104960)

This commit is contained in:
Nicolay Mitropolsky
2017-07-27 19:25:18 +03:00
committed by asedunov
parent f7a1c71b54
commit 1b2e28d467
2 changed files with 34 additions and 8 deletions
@@ -166,6 +166,7 @@ class SpringKotlinAutowiringInspection : AbstractKotlinInspection() {
} }
override fun visitProperty(property: KtProperty) { override fun visitProperty(property: KtProperty) {
if (property.name != null) // It is here because `lightElement.name` returns `<no name provided>` instead of `null` suddenly
for (lightElement in property.toLightElements()) { for (lightElement in property.toLightElements()) {
when (lightElement) { when (lightElement) {
is KtLightMethod -> lightElement.processLightMethod() is KtLightMethod -> lightElement.processLightMethod()
@@ -0,0 +1,25 @@
// WITH_RUNTIME
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
import org.springframework.context.annotation.ComponentScan
import org.springframework.context.annotation.Configuration
import org.springframework.beans.factory.annotation.Qualifier
@Configuration
@ComponentScan
open class InvalidAutowiredByTypeQualifiers
abstract class AbstractBarBean
@Component
open class BarBean1 : AbstractBarBean()
@Component
open class BarBean2 : AbstractBarBean()
@Component
open class IncompleteClassAutowiring() {
@Autowired
lateinit var : String
}