Juh_ Juh_ - 1 year ago 63
Scala Question

How not to require the import of scala.language.relectiveCalls

I subclassed

to add practical tooling to FlatTest. But anywhere I use this subclass, I have to import
otherwise I get

reflective access of structural type member method test should be enabled
by making the implicit value scala.language.reflectiveCalls visible.

The method
in question is the equivalent to
in standard FlatSpec:

it should "do some stuff" in { ...}

Why is it not necessary to import reflectiveCalls to use flatSpec
but is necessary for my
method, and how can I avoid that?

Answer Source

The reason why you are getting this warning is that you have structural type reference or new {...} call somewhere in your test method.

Unfortunately there is no way to turn off that warning other than by explicit scala.language.reflectiveClass import or rewriting your code.