我将org.scalatest.FlatSpec
子类化为FlatTest添加实用工具。但是在我使用这个子类的任何地方,我必须导入scala.language.reflectiveClass
否则我得到
reflective access of structural type member method test should be enabled
by making the implicit value scala.language.reflectiveCalls visible.
相关方法test
相当于标准FlatSpec中的should
:
it should "do some stuff" in { ...}
为什么没有必要导入reflectCalls来使用flatSpec should
,但对于我的test
方法是必要的,我该如何避免?
答案 0 :(得分:3)
您收到此警告的原因是您的new {...}
方法中有结构类型引用或test
调用。
不幸的是,除了明确scala.language.reflectiveClass
导入或重写您的代码之外,无法关闭该警告。