[CMake] implements Comparable
EXT-Harris, Scott H
Scott.H.Harris at boeing.com
Sat Oct 8 20:13:39 EDT 2011
Darn - sorry, I posted this to the wrong mail list.
From: EXT-Harris, Scott H
Sent: Saturday, October 08, 2011 5:04 PM
To: cmake at cmake.org
Cc: EXT-Harris, Scott H
Subject: implements Comparable
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111008/11841940/attachment-0001.htm>
More information about the CMake
mailing list