vtkWrapJava fails to produce valid c++ wrapper when SuperClasses is a template
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
Trying to build Paraview 4.0.1 on top of vtk 6.0.0 using USE_EXTERNAL_VTK I run into a problem.
vtk 6.0.0 was compiled with Java Wrapper on. I guess this is why it tries to build paraview with Java bindings...
When building the Java bindings to Paraview the Java.cxx files generated in Paraview/Core/ServerImplementation/Core fail to compile:
cd /tmp/buildd/paraview-4.0.1/obj-x86_64-linux-gnu/ParaViewCore/ServerImplementation/Core && /usr/bin/c++ -DMPICH_IGNORE_CXX_SEEK -DvtkPVServerImplementationCoreJava_EXPORTS -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -O3 -DNDEBUG -fPIC -I/tmp/buildd/paraview-4.0.1/obj-x86_64-linux-gnu -I/tmp/buildd/paraview-4.0.1/obj-x86_64-linux-gnu/ParaViewCore/ClientServerCore/Core -I/tmp/buildd/paraview-4.0.1/ParaViewCore/ClientServerCore/Core -I/usr/include/vtk-6.0 -I/tmp/buildd/paraview-4.0.1/obj-x86_64-linux-gnu/ParaViewCore/Common -I/tmp/buildd/paraview-4.0.1/ParaViewCore/Common -I/tmp/buildd/paraview-4.0.1/obj-x86_64-linux-gnu/ParaViewCore/ClientServerStream -I/tmp/buildd/paraview-4.0.1/ParaViewCore/ClientServerStream -I/tmp/buildd/paraview-4.0.1/obj-x86_64-linux-gnu/ParaViewCore/VTKExtensions/Core -I/tmp/buildd/paraview-4.0.1/ParaViewCore/VTKExtensions/Core -I/usr/lib/openmpi/include -I/usr/lib/openmpi/include/openmpi -I/usr/include/python2.7 -I/tmp/buildd/paraview-4.0.1/obj-x86_64-linux-gnu/Utilities/WrapClientServer -I/tmp/buildd/paraview-4.0.1/Utilities/WrapClientServer -I/tmp/buildd/paraview-4.0.1/obj-x86_64-linux-gnu/ThirdParty/mpi4py -I/tmp/buildd/paraview-4.0.1/ThirdParty/mpi4py -I/tmp/buildd/paraview-4.0.1/ThirdParty/protobuf/vtkprotobuf/src -I/tmp/buildd/paraview-4.0.1/obj-x86_64-linux-gnu/ThirdParty/protobuf -I/tmp/buildd/paraview-4.0.1/ThirdParty/protobuf -I/tmp/buildd/paraview-4.0.1/obj-x86_64-linux-gnu/ParaViewCore/ServerImplementation/Core -I/tmp/buildd/paraview-4.0.1/ParaViewCore/ServerImplementation/Core -I/usr/lib/jvm/default-java/include -o CMakeFiles/vtkPVServerImplementationCoreJava.dir/vtkSIDoubleVectorPropertyJava.cxx.o -c /tmp/buildd/paraview-4.0.1/obj-x86_64-linux-gnu/ParaViewCore/ServerImplementation/Core/vtkSIDoubleVectorPropertyJava.cxx /tmp/buildd/paraview-4.0.1/obj-x86_64-linux-gnu/ParaViewCore/ServerImplementation/Core/vtkSIDoubleVectorPropertyJava.cxx:12:63: error: invalid declarator before '_Typecast' extern "C" JNIEXPORT void* vtkSIVectorPropertyTemplate_Typecast(void op,char dType); ^ /tmp/buildd/paraview-4.0.1/obj-x86_64-linux-gnu/ParaViewCore/ServerImplementation/Core/vtkSIDoubleVectorPropertyJava.cxx:12:63: error: expected initializer before '_Typecast' /tmp/buildd/paraview-4.0.1/obj-x86_64-linux-gnu/ParaViewCore/ServerImplementation/Core/vtkSIDoubleVectorPropertyJava.cxx: In function 'void vtkSIDoubleVectorProperty_Typecast(void, char*)': /tmp/buildd/paraview-4.0.1/obj-x86_64-linux-gnu/ParaViewCore/ServerImplementation/Core/vtkSIDoubleVectorPropertyJava.cxx:18:48: error: expected primary-expression before '_Typecast' if ((res= vtkSIVectorPropertyTemplate_Typecast(me,dType)) != NULL) { return res; } ^ /tmp/buildd/paraview-4.0.1/obj-x86_64-linux-gnu/ParaViewCore/ServerImplementation/Core/vtkSIDoubleVectorPropertyJava.cxx:18:48: error: expected ')' before '_Typecast' /tmp/buildd/paraview-4.0.1/obj-x86_64-linux-gnu/ParaViewCore/ServerImplementation/Core/vtkSIDoubleVectorPropertyJava.cxx:19:3: error: expected ')' before 'return' return NULL; ^ make[2]: *** [ParaViewCore/ServerImplementation/Core/CMakeFiles/vtkPVServerImplementationCoreJava.dir/vtkSIDoubleVectorPropertyJava.cxx.o] Error 1
Introducing a simple "typedef" for the template class fixes the issue. The Java.cxx are generated by vtkWrapJava which should take special care when the SuperClasses type is a template class...