Commit graph

398 commits

Author SHA1 Message Date
William S Fulton
be491506a4 Java std::vector improvements for types that do not have a default constructor.
The std::vector wrappers have been changed to work by default for elements that are
not default insertable, i.e. have no default constructor. This has been achieved by
not wrapping:

  vector(size_type n);

Previously the above had to be ignored via %ignore.

If the above constructor is still required it can be added back in again via %extend:

  %extend std::vector {
    vector(size_type count) { return new std::vector< T >(count); }
  }

Alternatively, the following wrapped constructor could be used as it provides near-enough
equivalent functionality:

  vector(jint count, const value_type& value);

The equivalent change to std::list has also been made (std::list
wrappers were not in the previous release [3.0.12] though).
2019-03-01 18:01:14 +00:00
William S Fulton
613ff08150 Java: more replace Object with java.lang.Object 2019-02-23 16:39:21 +00:00
William S Fulton
a57326aa4f Merge branch 'zphensley42-master'
* zphensley42-master:
  Handle review comments
  Updated java std_map to support Obj derivatives by importing original for use in class
2019-02-23 16:30:04 +00:00
William S Fulton
7fc81f4f85 Merge branch 'gtbX-master'
* gtbX-master:
  Add comment for non-const version
  Don't write-back buffer into Java array when calling const-ptr c function
  Prevent writeback of a const char* array through a director when using the byte[] %typemap.
2019-02-23 16:28:07 +00:00
Zachary Hensley
d812a4291c Handle review comments 2019-02-22 10:55:20 -06:00
William S Fulton
6d8c1c47f3 Merge branch 'java9_finalize_warnings'
* java9_finalize_warnings:
  [Java] Suppress deprecation warning on finalize method
2019-02-21 13:46:59 -08:00
Zachary Hensley
1e571417b6 Updated java std_map to support Obj derivatives by importing original for use in class 2019-02-21 09:24:41 -06:00
William S Fulton
52063a732b Consistent parameter names for std::pair 2019-02-14 22:44:27 +00:00
William S Fulton
a6a50d60e1 Restore original std::map template parameters for Java 2019-02-14 21:41:08 +00:00
William S Fulton
6d27ead9c0 Add STL container copy constructors where missing
Also provide consistent copy constructor declarations.
2019-02-14 18:53:05 +00:00
William S Fulton
dc34c39c53 Cosmetic STL typedef changes 2019-02-14 08:16:16 +00:00
William S Fulton
40d7f4137e typedef declaration corrections for std::array 2019-02-14 07:38:49 +00:00
William S Fulton
440264e479 Add missing typedefs to std::list + typedef corrections
Numerous missing typedefs added.
std::list<T*>::const_reference and std::list<T*>::reference
specialization typedef fixes.
2019-02-14 07:31:21 +00:00
William S Fulton
e26f6bb4e2 Add missing typedefs to std::vector + typedef corrections
Tests for std::vector of pointers added which check
 std::vector<T*>::const_reference and std::vector<T*>::reference
usage which gave compilation errors in Python and Perl which had
specialized these vectors incorrectly.
2019-02-13 22:46:28 +00:00
William S Fulton
a47c2553f5 Add missing typedefs to std::pair 2019-02-13 22:46:28 +00:00
William S Fulton
9dd33e6367 Add missing typedefs to std::map 2019-02-13 22:46:27 +00:00
William S Fulton
6d0c495fd0 Add missing parameter names in STL container wrappers
Mostly in STL copy constructors.

Best to have parameter names as they make their way into the wrappers in
some target languages.
2019-02-13 22:45:47 +00:00
William S Fulton
68e86614ff Create a consistent stl.i library file
Same file now for all languages except R which is still missing std_map.i.
Recent Java changes adding in std_set.i removed.
2019-02-12 18:46:05 +00:00
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
Sylvain Joubert
db34df38f3 [Java] Suppress deprecation warning on finalize method
Java 9 deprecates the finalize method.
For now just suppress the deprecation warning.
Fixes #1237
2018-04-23 13:57:19 +02:00
Andrew Galante
300fc6f669 Add comment for non-const version 2018-02-20 10:45:39 -08:00
Andrew Galante
575b250b24 Don't write-back buffer into Java array when calling const-ptr c function 2018-02-20 10:36:09 -08: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