Wrappers don't check OPTIONAL_DEPENDS
When wrapping a module, the wrappers use PRIVATE_DEPENDS to ascertain which modules contain headers that are used by that module (in addition to the DEPENDS modules, which are included implicitly). Code should be added to vtkModuleWrapPython.cmake and vtkModuleWrapJava.cmake so that any OPTIONAL_DEPENDS are also used, for each existing target.
As a work-around, the wrappers are still using the heuristic that classes beginning with "vtk" are derived from vtkObjectBase unless the hierarchy files say otherwise, but this heuristic is not always correct, and when it is wrong the generated method is uncallable.
Note that the circular "dependency" of CommonCore on CommonDataModel is a peculiar situation that the wrappers will have to deal with if the heuristic is removed. The "dependency" exists because vtkInformationDataObjectKey class uses vtkDataObject and the vtkWindow class uses vtkImageData.