Spring Support: Support "Autowired members defined in invalid Spring bean" inspection on Kotlin declarations

#KT-12079 Fixed
This commit is contained in:
Alexey Sedunov
2016-04-27 12:59:05 +03:00
parent d4aa179336
commit 44f565e600
11 changed files with 105 additions and 1 deletions
@@ -0,0 +1,10 @@
<problems>
<problem>
<file>test.kt</file>
<line>9</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Autowired members defined in invalid Spring bean (Kotlin)</problem_class>
<description>Autowired members must be defined in valid Spring bean (@Component|@Service|...)</description>
</problem>
</problems>
@@ -0,0 +1,2 @@
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.spring.inspections.SpringKotlinAutowiredMembersInspection
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
@@ -0,0 +1,19 @@
// WITH_RUNTIME
import org.springframework.stereotype.Component
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.context.support.SpringBeanAutowiringSupport
open class KtBean1 {
@Autowired var foo: Int = 1
}
@Component
open class KtBean2 {
@Autowired var foo: Int = 1
}
open class KtBean3 : SpringBeanAutowiringSupport() {
@Autowired var foo: Int = 1
}