Why doesn't this code attempting to use Hamcrest's hasItems compile?

前端 未结 9 1840
耶瑟儿~
耶瑟儿~ 2020-12-03 00:49

Why does this not compile, oh, what to do?

import static org.junit.Assert.assertThat;
import static org.junit.matchers.JUnitMatchers.hasItems;

ArrayList<         


        
9条回答
  •  悲哀的现实
    2020-12-03 01:12

    That error message looks like one produced by the javac compiler. I've found in the past that code written using hamcrest just won't compile under javac. The same code will compile fine under, say, the Eclipse compiler.

    I think Hamcrest's generics are exercising corner cases in generics that javac can't deal with.

提交回复
热议问题