Everybody knows that before doing any cast we have to check the object type with instanceof, however, with generics the compiler doesn't allow us to check it with generics like this.
if(object instanceof List<Message>)
I was investigating its solution and some people say that we have to check with List only, however, this is not valid for me.
I also checked that some developers recommend using isAssignableFrom, but it requires object to have an instance.
So how can I check that object is a List of Message (and not a just a list) without creating a trick object?
 
     
    