[Wrapping JAVA of VTK] Bug with methods containing character '_'
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
The JNI library replace all "_" substrings in function names by "_1" and the parser of VTK doesn't do this so this error occurs :
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: vtk.vtkSelection.PROCESS_ID_36()J at vtk.vtkSelection.PROCESS_ID_36(Native Method) at vtk.vtkSelection.PROCESS_ID(vtkSelection.java:471) at testvtk.CascadeActorManager.selectOnSurface(CascadeActorManager.java:142) at testvtk.TestRubberBand$RubberBandHelper.doSelectionVisible(TestRubberBand.java:71) at testvtk.TestRubberBand$RubberBandHelper.mouseReleased(TestRubberBand.java:64) at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:273) at java.awt.Component.processMouseEvent(Component.java:6038) at java.awt.Component.processEvent(Component.java:5803) at java.awt.Component.dispatchEventImpl(Component.java:4410) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) at java.awt.EventDispatchThread.run(EventDispatchThread.java:121) BUILD STOPPED (total time: 12 seconds)
Because the real name expected by the JNI is vtk.vtkSelection.PROCESS_1ID_36 and not vtk.vtkSelection.PROCESS_ID_36. This is a program that can cause this :
import vtk.vtkSelection;
public class BugPROPID { static { System.out.println(System.getProperty("java.library.path")); System.loadLibrary("vtkCommonJava"); System.loadLibrary("vtkFilteringJava"); System.loadLibrary("vtkIOJava"); System.loadLibrary("vtkImagingJava"); System.loadLibrary("vtkGraphicsJava"); System.loadLibrary("vtkRenderingJava"); } public static void main(String[] args) { vtkSelection selection = new vtkSelection(); System.out.println("TEST : " + selection.PROP_ID()); } }
I have made a patch to fix it (it add '1' after all '_' in name methods and name classes).