Created
November 15, 2016 15:50
-
-
Save odrotbohm/c644327bb89191f2b52e298427ebf201 to your computer and use it in GitHub Desktop.
Compiler ambiguity when compiling with target JDK 8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AmbiguitySample { | |
/** | |
* This compiles when using a JDK 8 with target JDK 6 but fails when the target is JDK 8. | |
*/ | |
public static void main(String[] args) { | |
CriteriaBuilder builder; | |
Expression<Object> objectExpression; | |
Expression<Collection<Object>> collectionOfObjectExpression; | |
// Compiler error: AmbiguitySample.java:[35,24] reference to isNotMember is ambiguous | |
// [ERROR] both method | |
// <E,C>isNotMember(javax.persistence.criteria.Expression<E>,javax.persistence.criteria.Expression<C>) in | |
// javax.persistence.criteria.CriteriaBuilder and method | |
// <E,C>isNotMember(E,javax.persistence.criteria.Expression<C>) in javax.persistence.criteria.CriteriaBuilder match | |
builder.isNotMember(objectExpression, collectionOfObjectExpression); | |
// ^^^^^^^^^^^ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@otrosien — once again, you made my day. Thanks for that!