Migrating form Eclipse generates Error: Object cannot be converted to Enum<?>
I have just imported an Android project from Eclipse and IntelliJ generates the following error:
error: incompatible types: Object cannot be converted to Enum<?>
The following code generates the error:
EnumSet<?>[] cars = new EnumSet[8];
// cars is filled with Enums
for (Enum<?> n : cars[0]) desc += n.toString();
The error is removed if the redundant cast is included:
for (Enum<?> n : (EnumSet<?>) cars[0]) desc += n.toString();
Any suggestions or is this an error with the compiler? I am a new user of IntelliJ and Android Studio.
Thanks
请先登录再写评论。