diff --git a/plugins/allopen/allopen-cli/src/AllOpenPlugin.kt b/plugins/allopen/allopen-cli/src/AllOpenPlugin.kt index 616f724c85e..df1f76148d7 100644 --- a/plugins/allopen/allopen-cli/src/AllOpenPlugin.kt +++ b/plugins/allopen/allopen-cli/src/AllOpenPlugin.kt @@ -41,7 +41,8 @@ class AllOpenCommandLineProcessor : CommandLineProcessor { "org.springframework.stereotype.Component", "org.springframework.transaction.annotation.Transactional", "org.springframework.scheduling.annotation.Async", - "org.springframework.cache.annotation.Cacheable")) + "org.springframework.cache.annotation.Cacheable", + "org.springframework.boot.test.context.SpringBootTest")) val ANNOTATION_OPTION = CliOption("annotation", "", "Annotation qualified names", required = false, allowMultipleOccurrences = true) diff --git a/plugins/allopen/allopen-cli/testData/bytecodeListing/springAnnotations.kt b/plugins/allopen/allopen-cli/testData/bytecodeListing/springAnnotations.kt new file mode 100644 index 00000000000..406931e8509 --- /dev/null +++ b/plugins/allopen/allopen-cli/testData/bytecodeListing/springAnnotations.kt @@ -0,0 +1,45 @@ +// FILE: component.kt +package org.springframework.stereotype +annotation class Component + +// FILE: transactional.kt +package org.springframework.transaction.annotation +annotation class Transactional + +// FILE: async.kt +package org.springframework.scheduling.annotation +annotation class Async + +// FILE: cacheable.kt +package org.springframework.cache.annotation +annotation class Cacheable + +// FILE: springBootTest.kt +package org.springframework.boot.test.context +annotation class SpringBootTest + +// FILE: main.kt +package test + +import org.springframework.stereotype.* +import org.springframework.transaction.annotation.* +import org.springframework.scheduling.annotation.* +import org.springframework.cache.annotation.* +import org.springframework.boot.test.context.* + +@Component +class TestComponent + +@Transactional +class TestTransactional + +@Async +class TestAsync + +@Cacheable +class TestCacheable + +@SpringBootTest +class TestSpringBootTest + +class NoAnno \ No newline at end of file diff --git a/plugins/allopen/allopen-cli/testData/bytecodeListing/springAnnotations.txt b/plugins/allopen/allopen-cli/testData/bytecodeListing/springAnnotations.txt new file mode 100644 index 00000000000..1014af5101c --- /dev/null +++ b/plugins/allopen/allopen-cli/testData/bytecodeListing/springAnnotations.txt @@ -0,0 +1,54 @@ +@java.lang.annotation.Retention +@kotlin.Metadata +public annotation class org/springframework/boot/test/context/SpringBootTest + +@java.lang.annotation.Retention +@kotlin.Metadata +public annotation class org/springframework/cache/annotation/Cacheable + +@java.lang.annotation.Retention +@kotlin.Metadata +public annotation class org/springframework/scheduling/annotation/Async + +@java.lang.annotation.Retention +@kotlin.Metadata +public annotation class org/springframework/stereotype/Component + +@java.lang.annotation.Retention +@kotlin.Metadata +public annotation class org/springframework/transaction/annotation/Transactional + +@kotlin.Metadata +public final class test/NoAnno { + public method (): void +} + +@org.springframework.scheduling.annotation.Async +@kotlin.Metadata +public class test/TestAsync { + public method (): void +} + +@org.springframework.cache.annotation.Cacheable +@kotlin.Metadata +public class test/TestCacheable { + public method (): void +} + +@org.springframework.stereotype.Component +@kotlin.Metadata +public class test/TestComponent { + public method (): void +} + +@org.springframework.boot.test.context.SpringBootTest +@kotlin.Metadata +public class test/TestSpringBootTest { + public method (): void +} + +@org.springframework.transaction.annotation.Transactional +@kotlin.Metadata +public class test/TestTransactional { + public method (): void +} diff --git a/plugins/plugins-tests/tests/org/jetbrains/kotlin/allopen/AbstractBytecodeListingTestForAllOpen.kt b/plugins/plugins-tests/tests/org/jetbrains/kotlin/allopen/AbstractBytecodeListingTestForAllOpen.kt index ead367c4916..1a32c417983 100644 --- a/plugins/plugins-tests/tests/org/jetbrains/kotlin/allopen/AbstractBytecodeListingTestForAllOpen.kt +++ b/plugins/plugins-tests/tests/org/jetbrains/kotlin/allopen/AbstractBytecodeListingTestForAllOpen.kt @@ -22,8 +22,11 @@ import org.jetbrains.kotlin.extensions.DeclarationAttributeAltererExtension abstract class AbstractBytecodeListingTestForAllOpen : AbstractBytecodeListingTest() { override fun setupEnvironment(environment: KotlinCoreEnvironment) { + val annotations = AbstractAllOpenDeclarationAttributeAltererExtension.ANNOTATIONS_FOR_TESTS + + AllOpenCommandLineProcessor.SUPPORTED_PRESETS.flatMap { it.value } + DeclarationAttributeAltererExtension.registerExtension( - environment.project, CliAllOpenDeclarationAttributeAltererExtension( - AbstractAllOpenDeclarationAttributeAltererExtension.ANNOTATIONS_FOR_TESTS)) + environment.project, + CliAllOpenDeclarationAttributeAltererExtension(annotations)) } } \ No newline at end of file diff --git a/plugins/plugins-tests/tests/org/jetbrains/kotlin/allopen/BytecodeListingTestForAllOpenGenerated.java b/plugins/plugins-tests/tests/org/jetbrains/kotlin/allopen/BytecodeListingTestForAllOpenGenerated.java index ca197c4c6a5..6968b9d65a5 100644 --- a/plugins/plugins-tests/tests/org/jetbrains/kotlin/allopen/BytecodeListingTestForAllOpenGenerated.java +++ b/plugins/plugins-tests/tests/org/jetbrains/kotlin/allopen/BytecodeListingTestForAllOpenGenerated.java @@ -102,6 +102,12 @@ public class BytecodeListingTestForAllOpenGenerated extends AbstractBytecodeList doTest(fileName); } + @TestMetadata("springAnnotations.kt") + public void testSpringAnnotations() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("plugins/allopen/allopen-cli/testData/bytecodeListing/springAnnotations.kt"); + doTest(fileName); + } + @TestMetadata("superClassAnnotation.kt") public void testSuperClassAnnotation() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("plugins/allopen/allopen-cli/testData/bytecodeListing/superClassAnnotation.kt");