Q:

java incompatible type T cannot converted to Enum

The code is running fine in eclipse but giving following error while trying to compile in intellij IDEA
public class Sample{
   private Map<Class<Enum>, IConverter<? extends Enum<?>>> enumConverter = Maps.newHashMap();

public <T extends Enum<T>> T  getEnumAttribute(String key, final Class<T> ee){
    IConverter<T> e = (IConverter<T>)enumConverters.get(ee);
    if ( e == null ){
        e = new IConverter<T>() {
            @Override
            public String toString(T val) {
                return val.toString();
            }

            @Override
            public Class<T> getType() {
                return ee;
            }

            @Override
            public T fromString(String val) {
                return Enum.valueOf(ee, val);
            }
        };
        enumConverters.put((Class<Enum>) ee, e);
    }
    return getAttribute(key, e);
}

public static interface IConverter<T> extends Serializable{
    public  T fromString(String val);
    public String toString(T val);
    public Class<T> getType();
}     

}

The code is compiling fine in eclipse but throwing an error in 
enumConverters.put((Class<Enum>) ee, e); line as 
Error:(521, 66) java: incompatible types: java.lang.Class<T> cannot be converted to java.lang.Class<java.lang.Enum>
I am not sure what is wrong, any help would be greatly appreciated. 

A:

A Class<T extends Enum<T>> isn't a Class<Enum>, just as a Class<String> isn't a Class<Object>, or List<T> isn't a List<Object>.
Change your map declaration to:
private Map<Class<? extends Enum<?>>, IConverter<? extends Enum<?>>> enumConverter = Maps.newHashMap();

