I'm trying to deserialize a SetOfMembers list,and I want to take each Member object individually after deserializing in order to match the member name with a given String.
"Incompatible types librarby.Member cannot be converted to Member where Member is a type-variable. Member extends Object declared in class SetOfMembers"
The above error keeps appearing and I cannot make out the problem in my code.If you could explain to me what's wrong my code that'll be great. I used the @SuppressWarnings("unchecked") but that's not helpful either.Please help. Thankyou
My first guess would be that
Member
class such as java.lang.reflect.Member
instead of your library.Member
and thus you have this error.So to fix this - check your imports section in the first tile.
If you really need both Member
classes in the same file, you can still use fully qualified names. I bet following code would work anyway.
for(library.Member mem : Serialization.deserializeMembers())