I use spray json in my application and for models I need to write JsonProtocol
companions.
Because in the service I have more models, I have two options to use these JsonProtocols
:
a) make TableauErrorResponseJsonProtocol
a trait
and extend it by my service
b) make TableauErrorResponseJsonProtocol
an object
and import it where I need in my service (as in picture)
I try to avoid using option a)
because I already have some extends for my service, so I don't want to use with x, with y, with z,
....
But, for option b)
, when I want to rearrange the code (CTRL + ALT + SHIFT + L
), IntelliJ will remove all these imports, because are "unused". In reallity, these both are used by the next line (response.data.parseJson.convertTo[MyClass]
).
How I can avoid it? thanks
Alt + Enter
on the import . And you will see an option like Mark import as always used in this project