Project: clover
Issue CLOV-1399: Java 1.8 compilation fails when lambda is passed to a generic argument
The following piece of code fails to be instrumented {code:java} public class Fails { public final Iterable depthFirstTraversal(Class type) { return (Iterable) depthFirstTraversal(e -> type.isInstance(e)); } public final Iterable depthFirstTraversal(Predicate predicate) { return null; } } {code} Javac gives the following error message: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project cake-util: Compilation failure: Compilation failure: [ERROR] /Users/kasperni/workspace/CAKE/cake-util/cake-util/target/clover/src-instrumented/org/cakeframework/internal/util/tree/Fails.java:[27,67] reference to depthFirstTraversal is ambiguous [ERROR] both method depthFirstTraversal(java.lang.Class) in org.cakeframework.internal.util.tree.Fails and method depthFirstTraversal(java.util.function.Predicate) in org.cakeframework.internal.util.tree.Fails match [ERROR] /Users/kasperni/workspace/CAKE/cake-util/cake-util/target/clover/src-instrumented/org/cakeframework/internal/util/tree/Fails.java:[27,86] incompatible types: cannot infer type-variable(s) I,T [ERROR] (argument mismatch; java.lang.Class is not a functional interface) [ERROR] -> [Help 1]
Story points: 3