Skip to content

Instantly share code, notes, and snippets.

@aeisenberg
Created November 16, 2016 02:50
Show Gist options
  • Save aeisenberg/de558a35d09de0184be2707cfe42c921 to your computer and use it in GitHub Desktop.
Save aeisenberg/de558a35d09de0184be2707cfe42c921 to your computer and use it in GitHub Desktop.
import java.util.Collection;
public class Ambiguity {
public void foo(CriteriaBuilder builder) {
// change Object -> Number (or any other type) and it compiles
Expression<Object> objectExpression = null;
Expression<Collection<Object>> collectionOfObjectExpression = null;
builder.isNotMember(objectExpression, collectionOfObjectExpression);
}
}
class Expression<T> { }
class CriteriaBuilder {
public <E,C extends Collection<E>> void isNotMember(E elem, Expression<C> collection) {}
public <E,C extends Collection<E>> void isNotMember(Expression<E> elem, Expression<C> collection) {}
}
@odrotbohm
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment