[RESTORED] Spring Support: Inspection for final Spring-annotated classes/functions

#KT-11098 Fixed
This commit is contained in:
Alexey Sedunov
2016-02-21 00:01:27 +03:00
parent e4a64e7980
commit 196b484cd7
30 changed files with 582 additions and 12 deletions
@@ -0,0 +1,74 @@
<problems>
<problem>
<file>test.kt</file>
<line>18</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Final Kotlin class or function with Spring annotation</problem_class>
<description>@Configuration class should be declared open</description>
</problem>
<problem>
<file>test.kt</file>
<line>21</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Final Kotlin class or function with Spring annotation</problem_class>
<description>@Configuration class should be declared open</description>
</problem>
<problem>
<file>test.kt</file>
<line>32</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Final Kotlin class or function with Spring annotation</problem_class>
<description>@Component class should be declared open</description>
</problem>
<problem>
<file>test.kt</file>
<line>41</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Final Kotlin class or function with Spring annotation</problem_class>
<description>@Bean function should be declared open</description>
</problem>
<problem>
<file>test.kt</file>
<line>44</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Final Kotlin class or function with Spring annotation</problem_class>
<description>@Bean function should be declared open</description>
</problem>
<problem>
<file>test.kt</file>
<line>47</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Final Kotlin class or function with Spring annotation</problem_class>
<description>@Bean function should be declared open</description>
</problem>
<problem>
<file>test.kt</file>
<line>50</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Final Kotlin class or function with Spring annotation</problem_class>
<description>@Bean function should be declared open</description>
</problem>
<problem>
<file>test.kt</file>
<line>55</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Final Kotlin class or function with Spring annotation</problem_class>
<description>@Bean function should be declared open</description>
</problem>
<problem>
<file>test.kt</file>
<line>58</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Final Kotlin class or function with Spring annotation</problem_class>
<description>@Bean function should be declared open</description>
</problem>
</problems>
@@ -0,0 +1,2 @@
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.spring.inspections.KotlinFinalClassOrFunSpringInspection
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
@@ -0,0 +1,65 @@
// WITH_RUNTIME
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.ComponentScan
import org.springframework.context.annotation.Configuration
import org.springframework.stereotype.Component
@Configuration
annotation class MyConfiguration
@Bean
annotation class MyBean
// @Configuration
@Configuration
class Application1
@MyConfiguration
class Application2
@Configuration
open class Application3
@MyConfiguration
open class Application4
// @Component
@Component
class Component1
@Component
open class Component2
// @Bean
class Utils1 {
@Bean
fun foo1() = Component1()
@MyBean
fun foo2() = Component2()
@Bean
open fun foo3() = Component3()
@MyBean
open fun foo4() = Component4()
}
open class Utils2 {
@Bean
fun foo1() = Component1()
@MyBean
fun foo2() = Component2()
@Bean
open fun foo3() = Component3()
@MyBean
open fun foo4() = Component4()
}
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.spring.inspections.KotlinFinalClassOrFunSpringInspection
@@ -0,0 +1,7 @@
// "Make class Bean open" "true"
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
// DISABLE-ERRORS
import org.springframework.stereotype.Component
@Component
class <caret>Bean
@@ -0,0 +1,7 @@
// "Make class Bean open" "true"
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
// DISABLE-ERRORS
import org.springframework.stereotype.Component
@Component
open class <caret>Bean
@@ -0,0 +1,7 @@
// "Make class Application open" "true"
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
// DISABLE-ERRORS
import org.springframework.context.annotation.Configuration
@Configuration
class <caret>Application
@@ -0,0 +1,7 @@
// "Make class Application open" "true"
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
// DISABLE-ERRORS
import org.springframework.context.annotation.Configuration
@Configuration
open class <caret>Application
@@ -0,0 +1,10 @@
// "Make class Application open" "true"
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
// DISABLE-ERRORS
import org.springframework.context.annotation.Configuration
@Configuration
annotation class MyConfiguration
@MyConfiguration
class <caret>Application
@@ -0,0 +1,10 @@
// "Make class Application open" "true"
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
// DISABLE-ERRORS
import org.springframework.context.annotation.Configuration
@Configuration
annotation class MyConfiguration
@MyConfiguration
open class <caret>Application
@@ -0,0 +1,9 @@
// "Make function foo open" "true"
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
// DISABLE-ERRORS
import org.springframework.context.annotation.Bean
class Foo {
@Bean
fun <caret>foo() = ""
}
@@ -0,0 +1,9 @@
// "Make function foo open" "true"
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
// DISABLE-ERRORS
import org.springframework.context.annotation.Bean
open class Foo {
@Bean
open fun <caret>foo() = ""
}
@@ -0,0 +1,9 @@
// "Make function foo open" "true"
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
// DISABLE-ERRORS
import org.springframework.context.annotation.Bean
open class Foo {
@Bean
fun <caret>foo() = ""
}
@@ -0,0 +1,9 @@
// "Make function foo open" "true"
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
// DISABLE-ERRORS
import org.springframework.context.annotation.Bean
open class Foo {
@Bean
open fun <caret>foo() = ""
}
@@ -0,0 +1,12 @@
// "Make function foo open" "true"
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
// DISABLE-ERRORS
import org.springframework.context.annotation.Bean
@Bean
annotation class MyBean
class Foo {
@MyBean
fun <caret>foo() = ""
}
@@ -0,0 +1,12 @@
// "Make function foo open" "true"
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
// DISABLE-ERRORS
import org.springframework.context.annotation.Bean
@Bean
annotation class MyBean
open class Foo {
@MyBean
open fun <caret>foo() = ""
}
@@ -0,0 +1,12 @@
// "Make function foo open" "true"
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
// DISABLE-ERRORS
import org.springframework.context.annotation.Bean
@Bean
annotation class MyBean
open class Foo {
@MyBean
fun <caret>foo() = ""
}
@@ -0,0 +1,12 @@
// "Make function foo open" "true"
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
// DISABLE-ERRORS
import org.springframework.context.annotation.Bean
@Bean
annotation class MyBean
open class Foo {
@MyBean
open fun <caret>foo() = ""
}