It does work with inner classes but not with anonymous inner classes.
According to the JLS section 15.9:
"It is a compile-time error if a class instance creation expression declares an anonymous class using the "<>" form for the class's type arguments."