IntelliJ Idea changes pasted code

136 views Asked by At

When pasting Kotlin code from another class with "static" imports, e.g.:

@SpringBootTest(webEnvironment = RANDOM_PORT)

I would like IDE to add import like this

import org.springframework.boot.test.context.SpringBootTest.WebEnvironment.*

But instead of that IntelliJ Idea (version 2018.1.1) changes the pasted code to

@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)

and adds

import org.springframework.boot.test.context.SpringBootTest

Is that bug or feature and can I change it?

1

There are 1 answers

0
yole On BEST ANSWER

This is a shortcoming of the current version of the Kotlin plugin. I've filed an issue to improve the behavior in future versions.