javac error: inconvertible types with generics?

后端 未结 4 1919
醉梦人生
醉梦人生 2020-12-24 02:33

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

4条回答
  •  心在旅途
    2020-12-24 02:59

    I don't know why it's happening, but a workaround is easy:

    @Override public > void postEvent(
        Context context, E code, Object additionalData) 
    {
        Object tmp = code;
        if (tmp instanceof LogEvent.Type)
        {
            LogEvent.Type scode = (LogEvent.Type)tmp;
        ...
    

    It's ugly, but it works...

提交回复
热议问题