Commit graph

365 commits

Author SHA1 Message Date
William S Fulton
5a388863fa director_thread test fixes for MacOS
Add extra debugging and correctly detect MacOS using __APPLE__ macro
2018-12-21 19:08:15 +00:00
William S Fulton
d835c69d65 Merge branch 'java-director-thread-name'
* java-director-thread-name:
  Add changes entry for setting Java thread name
  Increased Java thread name size.
  Java directors - more generic thread name setting
  Use prctl method to get thread names, which is available on all NDK versions
  Actually, pthread_getname_np is only available in recent versions of Android (API level >= 26).
  Set thread name when attaching to Android JVM in SWIG Java director
2018-12-20 21:23:29 +00:00
William S Fulton
f948a756bb Increased Java thread name size.
MacOS thread_info.h can handle thread names up to 64 characters.
See issue #1334.
2018-12-20 21:21:54 +00:00
William S Fulton
ca287ae13b Add support for non-default compare template argument in std::map wrappers 2018-10-09 19:44:00 +01:00
William S Fulton
8ddf24881a Merge branch 'vadz-java-map-comp'
* vadz-java-map-comp:
  Add support for std::map<> comparator template argument for Java

Conflicts:
	CHANGES.current
2018-10-09 07:09:06 +01:00
William S Fulton
3195c3e4da Java directors - more generic thread name setting
Activated if a user sets SWIG_JAVA_USE_THREAD_NAME.
Implementations provided for linux/android/macos/unix.
A user's implementation will be used if SWIG_JAVA_GET_THREAD_NAME is
defined. It must implement the function:
  namespace Swig {
    SWIGINTERN int GetThreadName(char *name, size_t len);
  }
2018-10-08 21:38:41 +01:00
Sam Hasinoff
989f4289c1 Use prctl method to get thread names, which is available on all NDK versions 2018-10-08 21:24:34 +01:00
Sam Hasinoff
8dd8634420 Actually, pthread_getname_np is only available in recent versions of Android (API level >= 26). 2018-10-08 21:24:34 +01:00
Sam Hasinoff
07268b8da6 Set thread name when attaching to Android JVM in SWIG Java director
Otherwise the native thread name gets clobbered with "Thread-XX", which
makes debugging hard. This issue seems to be specific to the Android JVM.
Someone proposed a similar fix to SWIG:
https://github.com/swig/swig/pull/831
but abandoned it.
2018-10-08 21:24:34 +01:00
William S Fulton
61d9dd40a0 Fix crash Java directors
Further crash fixes when using OUTPUT and INOUT typemaps in typemaps.i and
passing NULL pointers in C++ to director method overloaded and implemented
in Java.

Don't create the one element array in these directorin typemaps if the
input is a NULL pointer, that is, translate a NULL C++ pointer into a
null Java object.

Also add some missing JNI error checks in these typemaps.
2018-08-12 13:45:43 +01:00
Bryan Atwood
7eeffe698c Fix Java directorargout typemap crash when argument pointer is null 2018-08-10 17:12:34 -07:00
Vadim Zeitlin
369be6fac4 Add support for std::map<> comparator template argument for Java
Allow exporting maps using non-default comparison function, similar to
what was done for C# back in 9efaf954c7
2018-06-09 18:11:48 +02:00
luz.paz
6f69830321 follow-up typos 2018-05-17 10:26:00 -04:00
William S Fulton
6551d0fead Java vector wrappers cast correction
64 bit windows, fixes:
  warning C4267: 'initializing': conversion from 'size_t' to 'jint'
2018-05-06 09:46:37 +01:00
William S Fulton
e86c881a70 Fix directorout typemaps which were causing undefined behaviour when returning pointers by reference.
Closes #1167
2017-12-14 07:00:42 +00:00
William S Fulton
901f8357b0 Replace DirectorException::raiseJavaException with DirectorException::throwException
This is part of a plan to provide a common DirectorException api for
throwing the target language exception raised during a director method call.
2017-11-29 20:32:15 +00:00
William S Fulton
406c7a732a Add Swig::DirectorException directorthrows typemap for Java
For use with a global %catches(Swig::DirectorException)
2017-11-29 20:32:15 +00:00
William S Fulton
923091da13 Changes to use common DirectorException class
Add director.swg for Go as was completely absent.
This is just the start of a common exception handling approach to directors.
An exception thrown in a Java director method will be propogated back to
Java via a C++ DirectorException.
DirectorException throws typemap for Java is fully working, all other languages need work.
DirectorException throws typemap for Perl added just to fix compilation errors.
Add director_exception_catches test.
2017-11-29 20:31:55 +00:00
William S Fulton
077bb0b04f Improved Java director exceptions documentation 2017-11-16 20:03:58 +00:00
William S Fulton
7aa28e37ec Java director exception handling improvements
When a director method throws an exception and it is caught by DirectorException
and passed back to Java using DirectorException::raiseJavaException, the Java
stack trace now contains the original source line that threw the exception.

Director exception handling code improved slightly to add some missing
ExceptionClear calls before calling JNI code.
2017-11-10 19:50:22 +00:00
William S Fulton
dafe2d6949 Add director typemaps for pointer const ref types 2017-10-24 23:47:40 +01:00
William S Fulton
e8ebadcded Add director shared_ptr typemaps for Java
Correct testcase to test T*const& rather than T*& typemaps
2017-10-16 18:21:31 +01:00
William S Fulton
ed4b84f4d3 Fix overloading of shared_ptr method overloading
Add 'equivalent' attribute to typecheck typemap.
Closes #1098.
2017-09-23 15:19:34 +01:00
William S Fulton
b41fdba9ef Cosmetic changes for Java std::array wrappers 2017-09-12 08:36:53 +01:00
William S Fulton
06c275935b Add readme info for Java container wrappers 2017-07-18 07:17:03 +01:00
William S Fulton
abe53e39a9 Java std::vector minor improvement 2017-06-29 20:19:59 +01:00
William S Fulton
44cd658a53 Add in missing Java std::list listIterator index range checking 2017-06-29 19:32:34 +01:00
William S Fulton
fccf5c29b4 Minor correction in C# std::list doNextIndex 2017-06-29 15:34:05 +01:00
William S Fulton
f4aa8b3321 Add missing typedefs to Java std::vector 2017-06-26 15:28:43 +01:00
William S Fulton
d04eb88742 Consistent destructor declarations 2017-06-26 13:53:49 +01:00
William S Fulton
d92faa7f7f Remove Java std::list::max_size
Not in any Java equivalent containers nor std::vector wrapper.
2017-06-26 13:43:57 +01:00
William S Fulton
3af40e7423 Handle length_error exceptions in Java std::vector::reserve 2017-06-26 12:46:22 +01:00
William S Fulton
6daed2cea1 Remove Java std::list::assign
This doesn't exist in equivalent Java containers. If we put it back, the
full set of overloaded assign wrappers ought to be added.
2017-06-26 12:28:02 +01:00
William S Fulton
ecebbdd0df Additional add/remove methods added to Java std::list wrappers
Add functions similar to java.util.LinkedList<E>:
  addFirst
  addLast
  removeFirst
  removeLast
2017-06-25 00:10:06 +01:00
William S Fulton
c686045f55 More efficient add implementation for Java std::list
The default implementation in AbstractSequentialList<E>
calls add(size(), e) and size() might be expensive.
2017-06-24 23:33:31 +01:00
William S Fulton
a8e948e96d Java std::vector std::list: add missing exception handling 2017-06-24 22:53:11 +01:00
William S Fulton
ea55c5bba0 Java std::vector std::list enhancements
- Add missing vector copy constructor
- Add constructor to initialize the containers. Note that Java's
  equivalent constructor for ArrayList just sets the capacity, whereas
  the wrappers behave like the C++ constructor and set the size. I've
  done this mainly because there has been a vector(size_type) constructor
  in the Java wrappers for many years, so best to keep this unchanged.
2017-06-24 14:30:03 +01:00
William S Fulton
b40b9aee83 Modify std::list declarations to match the C++ standard 2017-06-23 20:10:26 +01:00
William S Fulton
2d99027935 Fix removing elements from std::list Java wrapper
Add missing remove method on Java side (without it elements aren't
removed).
2017-06-23 16:17:00 +01:00
William S Fulton
428b332e68 Improve Java std::list std::vector runtime tests and wrap std::list::clear 2017-06-23 15:42:59 +01:00
William S Fulton
990c597365 Wrap std::list::empty as isEmpty in Java 2017-06-23 15:26:53 +01:00
William S Fulton
109a60add6 javabase typemap improvement for std::list 2017-06-22 22:17:59 +01:00
William S Fulton
430376e115 Java std::list - fully qualifiy Java class name to avoid potential name ambiguity 2017-06-22 22:11:02 +01:00
William S Fulton
7b7f921ccb cosmetics 2017-06-22 20:38:19 +01:00
William S Fulton
02a00db9f5 Remove redundant code 2017-06-22 20:33:16 +01:00
William S Fulton
dd25f5b722 Java std::list rework to be consistent with std::vector wrappers 2017-06-22 20:33:09 +01:00
Alan Woodland
0083d451db Switched from autobox to jboxtype per #842 2017-06-05 21:58:58 +01:00
Alan Woodland
4db1300622 Merge branch 'master' into javalist 2017-06-05 21:55:12 +01:00
William S Fulton
10e73a5bfb Java jboxtype typemap documentation and tidy up 2017-06-05 20:47:49 +01:00
William S Fulton
5eb9f735da Add generic approach in fragments for converting size_t to Java int 2017-06-05 18:49:54 +01:00