fix invalid inferred types for X,M; inferred type does not conform to declared bound(s) error in Java 1.7

This change adds tests around Expect and fixes the invalid inferred types error in Java 1.7