There are several other SO questions talking about generics compiling OK w/ Eclipse\'s compiler but not javac (i.e. Java: Generics handled differenlty in Eclipse and javac a
In order to use instanceof both operands have to inherit/implement the same class/interface.
E just can't be cast to LogEvent.Type
I don't know what your full method looks like, but this should solve your issue by using interfaces and not Generics.
public interface EventType { }
public class LogEvent {
public enum Type implements EventType {}
}
public void postEvent(Context context, EventType code, Object additionalData) {
if(code instanceof LogEvent.Type) {
}
}