1

I'm working with GATK, a java tool for bioinformatics. It use org.reflections.Reflections under the hood to load some plugins.

My plugin compiled but wasn't found/loaded by GATK while it was in the classpath and a similar tool was working without any problem. By removing some part of the code, I've narrowed the problem to the following line which was the cause of my problem (see filter ) :

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

My plugin is loaded if I change the line above to :

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

It's also loaded if the line is:

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();};
    });

why ?

Holger
  • 285,553
  • 42
  • 434
  • 765
Pierre
  • 34,472
  • 31
  • 113
  • 192
  • 1
    Most likely, because that tool is incompatible with Java 8, indicated by the fact that it stops working as soon as you are using a lambda expression. – Holger Jan 17 '17 at 17:33
  • 2
    Incompatibilities between Reflections and Java 8 were already reported [back in May 2015](http://stackoverflow.com/q/30313255/2711488), but looking at the [open issues on GitHub](https://github.com/ronmamo/reflections/issues), it seems, they still haven’t resolved. Note especially [this one](https://github.com/ronmamo/reflections/issues/150) from Oct 2016, confirmed in Dec 2016… – Holger Jan 17 '17 at 17:42

0 Answers0