import java.util.*; class Test { static void foo(List l, Class ec) throws E { } public static void main(String[] s) { foo(new ArrayList(), RuntimeException.class); //IDEA says we have an unhandled exception here } }