[vtkusers] Bug in vtk java wrapper

Jeff Lee jeff at cdnorthamerica.com
Wed Oct 4 07:02:34 EDT 2006



Ali - wrote:
> David,
>
> Obviously you can make a java class abstract the way that you do it in 
> c++. However, this does not solve the problem, as some other concrete 
> classes derived from this class have the same poblem. Eg, this 
> produces the same error:
>
> vtkPolyData obj = new vtkPolyData();
> obj.GetMTime();
I can't reproduce that problem. If it were broken, almost nothing would 
work. Are you sure that the above 2 lines of code produce a hotspot 
error? Which jdk? Which os?
>
>>
>> Do you have a recommendation about how to fix this?
>> Is there a way to label a java class as abstract so that it cannot be 
>> instantiated? (i.e. - "new vtkAbstractClass();" would be a java 
>> compile failure...)
the "abstract" keyword before the "class" keyword in the class 
declaration statement will do the trick, so
public class vtkPointSet extends vtkDataSet
becomes
public abstract class vtkPointSet extends vtkDataSet

I think that this could be achieved with minor changes to the wrapping code.
-J
>>
>> Thanks,
>> David
>>
>> Ali - wrote:
>>
>>> Hi,
>>>
>>> Running the following java code causes an error detected by hotspot 
>>> virtual machine:
>>>
>>> vtkPointSet obj = new vtkPointSet();
>>> obj.GetMTime();
>>>
>>> The reason is that vtkJavaGetPointerFromObject() in vtkJavaUtil 
>>> returns NULL and the generated JNI wrapper does not validate the 
>>> pointer. This error happens when the class and/or at least one of 
>>> the cuper classes are abstract. I understand that the user does not 
>>> need to create an abstract class, but, this bug is annoying.
>>>
>>> _________________________________________________________________
>>> Windows Live™ Messenger has arrived. Click here to download it for 
>>> free! http://imagine-msn.com/messenger/launch80/?locale=en-gb
>>>
>>> _______________________________________________
>>> This is the private VTK discussion list. Please keep messages 
>>> on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>
> _________________________________________________________________
> Be the first to hear what's new at MSN - sign up to our free 
> newsletters! http://www.msn.co.uk/newsletters
>
> _______________________________________________
> This is the private VTK discussion list. Please keep messages 
> on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>



More information about the vtkusers mailing list