Hi,
How can I get SWIG to generate a java class that "implements Comparable"?
Let's say I have a C++ class X and an SWIG interface X that generates a
compareTo(X rhs) method.
If I use the Java class generated by SWIG in a TreeMap then the second put will
throw this exception:
CREATION exception: java.lang.ClassCastException: com.myCompany.project.X
in exception handler got exception: java.lang.NullPointerException
But if I modify the generated X.java file from
public class X {
to
public class X implements Comparable<X> {
then the exception is not thrown and the compareTo function is used as expected.
Can I get SWIG to add "implements Comparable<X> to the class?
FYI: For example of the test code:
X first = new X(1);
X last = new X(9);
TreeMap<X, String>mm = new TreeMap<X, String>();
String old = mm.put(last, "last");
// this next line throws the exeption
old = mm.put(first, "first");
Thanks,
Scott
--
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake