org.reflections.Reflections无法找到我的课程(与我编写lambda的方式有关)

时间:2017-01-16 14:13:29

标签: java reflection lambda java-8 google-reflections

我正在使用GATK,一个用于生物信息学的java工具。它使用引擎盖下的org.reflections.Reflections来加载一些插件。

我的插件已经编译但是GATK没有找到/加载它在类路径中,并且类似的工具没有任何问题。通过删除代码的某些部分,我已将问题缩小到以下行,这是我的问题的原因(请参阅过滤器):

(...)
ctx.getAlleles().stream().filter(T->!(T.isSymbolic() || T.isNoCall())).mapToInt(new ToIntFunction<Allele>() {
    public int applyAsInt(Allele value) {return value.length();};
    });
(...)

我的插件已加载,如果我将上面的行更改为:

(...)
ctx.getAlleles().stream().mapToInt(new ToIntFunction<Allele>() {
        public int applyAsInt(Allele value) {return value.length();};
    });
(...)

如果该行是:,它还会加载

final Predicate<Allele> afilter = new Predicate<Allele>() {
    @Override
    public boolean test(Allele a) {
        return !(a.isNoCall() || a.isSymbolic());
    }
};
ctx.getAlleles().stream().filter(afilter).mapToInt(new ToIntFunction<Allele>() {
        public int applyAsInt(Allele value) {return value.length();};
    });

为什么?

0 个答案:

没有答案