Commit graph

376 commits

Author SHA1 Message Date
William S Fulton
136e6cfe2b Merge branch 'bkotzz-add_set_map'
* bkotzz-add_set_map:
  Add missing typedefs to Java STL containers
  Combine duplicate unordered_set unordered_map testcases
  Nicer looking generated Java container code
  Replicate some cosmetic changes from std_map.i
  Legacy macros, protected iterator, typedefs
  Remove c++11 from stl.i
  Add to STL file as well
  Maps both working as java.util impls
  Mostly working for map
  Add set/unordered_set that extend AbstractSet
  Move unordered containers under cpp11_ prefix
  Add test cases to C++11 list
  Add unordered_{set|map} and set to Java
2019-02-12 18:09:38 +00:00
William S Fulton
e83e14a15e Add missing typedefs to Java STL containers 2019-02-12 07:15:51 +00:00
William S Fulton
9849174d93 Nicer looking generated Java container code 2019-02-12 06:20:19 +00:00
William S Fulton
437037a3e6 Replicate some cosmetic changes from std_map.i
into std_set.i, std_unordered_map.i, std_unordered_set.i.
2019-02-12 06:20:10 +00:00
Brad Kotsopoulos
d06ffe1087 Legacy macros, protected iterator, typedefs 2019-02-04 22:23:13 -05:00
Brad Kotsopoulos
945bd7c808
Remove c++11 from stl.i 2018-12-27 11:47:16 -05:00
Brad Kotsopoulos
7e9f1a7972 Add to STL file as well 2018-12-27 01:15:18 -05:00
Brad Kotsopoulos
573ddb061e Maps both working as java.util impls 2018-12-27 01:11:54 -05:00
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
Brad Kotsopoulos
e6d8675513 Mostly working for map 2018-12-04 01:08:47 -05:00
Brad Kotsopoulos
6ccc940a14 Add set/unordered_set that extend AbstractSet 2018-11-30 18:21:02 -05:00
Brad Kotsopoulos
0f18b430fb Add unordered_{set|map} and set to Java
Add test suite

Add to makefile

Revert set change

Fix java map test

Fix some of the tests

Fix unordered map test
2018-11-23 14:35:35 -05: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