Suspicious operation with container

Description:

Attempt to cast the object extracted from the container to the type which is not compatible with types of any object previously placed in this container. Incompatible here means that two target classes are not related: i.e. none of them is derived from the other.

If parameter OnlyNewContainers is set then this message will be reported only for newly created containers. By default, this audit will issue message on any container if get type is not compatible with put type.

Example:

class A { 
    ...
}
class B { 
    ...
}
void foo(A a) { 
   ArrayList list = new ArrayList();
   list.add(a);
   B b = ((B)list.get(0); // member of type B was not placed in the list
}