I have a part of my program that continuously monitors the topics on DDS. I have it able to determine when a topic comes online with a different type code than what it previously had. What I'm trying to do to deal with this is:
// Delete the existing data reader:
participant.delete_datareader((DynamicDataReader) ddrw);
// Delete the topic:
participant.delete_topic(participant.find_topic(topic, new Duration_t(1000, 0)));
// Unregister the type:
typeSupports.get(topic).unregister_type(participant, topic);