Two "Organize imports" actions required for annotations
Given a class like this:
If I do "organize imports" as a shortcut then it will do all the imports, bar the MediaType.APPLICATION_JSON, which is a parameter to the annotation (part of javax.ws.rs - Jersey). Then if I do the imports again, it will this time add in the missing one. So I always have to run org imports twice.
@GET
@Produces(Array(MediaType.APPLICATION_JSON))
def posts : ItemWrapper = {
val items = service.posts(3).map(post ⇒ {
val item = new Item()
item.title = post.getTitle
item.description = post.getText
item.created = "Created when?"
item
})
val wrapper = new ItemWrapper
wrapper.items = items
wrapper
}
If I do "organize imports" as a shortcut then it will do all the imports, bar the MediaType.APPLICATION_JSON, which is a parameter to the annotation (part of javax.ws.rs - Jersey). Then if I do the imports again, it will this time add in the missing one. So I always have to run org imports twice.
Leave a comment
on 2015-05-12 15:41 *
By Jerzy.Muller
Version changed from 2.1.0-nightly-210 to 4.0.0
Summary changed from Double import required for annotations to Two "Organize imports" actions required for annotations
on 2015-05-12 16:15 *
By Jerzy.Muller
Repro on 4.1:
Still needs 2 actions to add both "import annotations.MyAnnotation" and "import annotations.Tpe".
package annotations
import scala.annotation.StaticAnnotation
trait Tpe
object Tpe {
object A extends Tpe
object B extends Tpe
}
final class MyAnnotation(val tpe: Tpe) extends StaticAnnotation
package test
@MyAnnotation(Tpe.B)
class AnnotationTest
Still needs 2 actions to add both "import annotations.MyAnnotation" and "import annotations.Tpe".
on 2015-09-02 20:49 *
By Simon Schäfer
Component set to Refactoring
Eclipse version changed from Juno - Eclipse 4.2 to All
Operative system changed from Windows to -none-
Tags added auto-import
Description changed from Given a class like this:
... to Given a class like this:
<...
Status changed from New to Accepted
Did you look into that? In any way, we won't fix that for the next release.
on 2016-02-29 18:04 *
By wpopielarski769697
I think this one is related to #1001582
Move ticket to next milestone.