Spring Support: Fixed computation of values in Java annotations referred by Kotlin annotation entries
#KT-11702 Fixed
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
// NUMBER: 1
|
||||
// EXIST: { lookupString:"buildBar" }
|
||||
|
||||
package a
|
||||
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
|
||||
class FooBean
|
||||
class BarBean
|
||||
|
||||
@Configuration
|
||||
open class KotlinAnnotated {
|
||||
@Bean(name=arrayOf("annFooBean")) open fun buildFoo(): FooBean = FooBean()
|
||||
@Bean open fun buildBar(): BarBean = BarBean()
|
||||
}
|
||||
|
||||
class Test {
|
||||
fun test() {
|
||||
val context = AnnotationConfigApplicationContext("a");
|
||||
context.getBean("build<caret>")
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// NUMBER: 2
|
||||
// EXIST: { lookupString:"annFooBean" }
|
||||
// EXIST: { lookupString:"kotlinAnnotated" }
|
||||
|
||||
package a
|
||||
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
|
||||
class FooBean
|
||||
class BarBean
|
||||
|
||||
@Configuration
|
||||
open class KotlinAnnotated {
|
||||
@Bean(name=arrayOf("annFooBean")) open fun buildFoo(): FooBean = FooBean()
|
||||
@Bean open fun buildBar(): BarBean = BarBean()
|
||||
}
|
||||
|
||||
class Test {
|
||||
fun test() {
|
||||
val context = AnnotationConfigApplicationContext("a");
|
||||
context.getBean("ann<caret>")
|
||||
}
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<beans>
|
||||
<bean id="fooBean" class="java.lang.String"/>
|
||||
<bean id="fooBean2" class="java.lang.String"/>
|
||||
<bean id="barBean" class="java.lang.String"/>
|
||||
<bean id="scopedBean" class="test.ScopedBean"/>
|
||||
</beans>
|
||||
+7
-4
@@ -16,19 +16,22 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.spring.tests.references
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.util.PathUtil
|
||||
import org.jetbrains.kotlin.idea.completion.test.AbstractJvmBasicCompletionTest
|
||||
import org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
|
||||
import org.jetbrains.kotlin.idea.test.TestFixtureExtension
|
||||
import java.io.File
|
||||
|
||||
abstract class AbstractSpringReferenceCompletionTest : AbstractJvmBasicCompletionTest() {
|
||||
override fun setUpFixture(testPath: String) {
|
||||
super.setUpFixture(testPath)
|
||||
|
||||
val mainFileName = PathUtil.getFileName(testPath)
|
||||
val baseName = FileUtil.getNameWithoutExtension(mainFileName)
|
||||
val configFileName = if (baseName.endsWith("Xml")) "$baseName-config.xml" else mainFileName
|
||||
TestFixtureExtension
|
||||
.loadFixture<SpringTestFixtureExtension>(myModule)
|
||||
.configureFileSet(myFixture, listOf(PathUtil.toSystemIndependentName(File(testPath).parent + "/spring-config.xml")))
|
||||
.configureFileSet(myFixture, listOf(PathUtil.toSystemIndependentName("${PathUtil.getParentPath(testPath)}/$configFileName")))
|
||||
|
||||
super.setUpFixture(testPath)
|
||||
}
|
||||
|
||||
override fun tearDownFixture() {
|
||||
|
||||
+18
-6
@@ -35,15 +35,27 @@ public class SpringReferenceCompletionTestGenerated extends AbstractSpringRefere
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("ultimate/testData/spring/core/references/completion/variants"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("scopeReference.kt")
|
||||
public void testScopeReference() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/references/completion/variants/scopeReference.kt");
|
||||
@TestMetadata("beanWithDefaultName.kt")
|
||||
public void testBeanWithDefaultName() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/references/completion/variants/beanWithDefaultName.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("springBeanReference.kt")
|
||||
public void testSpringBeanReference() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/references/completion/variants/springBeanReference.kt");
|
||||
@TestMetadata("beanWithExplicitName.kt")
|
||||
public void testBeanWithExplicitName() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/references/completion/variants/beanWithExplicitName.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("scopeReferenceXml.kt")
|
||||
public void testScopeReferenceXml() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/references/completion/variants/scopeReferenceXml.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("springBeanReferenceXml.kt")
|
||||
public void testSpringBeanReferenceXml() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/references/completion/variants/springBeanReferenceXml.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user