【发布时间】:2013-06-11 11:17:06
【问题描述】:
在我们的一个项目中,我偶然发现了以下代码行(它使用 hamcrest 匹配器 1.3):
assertThat(someReport.getSomeException(), Matchers.<SomeException>notNullValue())
两个问题:
有人能给我解释一下这个语法吗?我从未见过在这种情况下使用 。
Eclipse 将该行的后半部分突出显示为 en 错误:
The method notNullValue() of type Matchers is not generic; it cannot be parameterized with arguments <SomeException>。但是,在命令行上使用 maven 项目构建没有问题。那么为什么会出现错误呢?
【问题讨论】:
标签: java eclipse generics junit hamcrest