Commit graph

106 commits

Author SHA1 Message Date
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
William S Fulton
338acfabeb Merge branch 'vadz-java-vector'
* vadz-java-vector:
  Fix potential STL std::vector wrappers <: digraphs problems.
  Add runtime checks for vector size in Java
  Make std::vector<> wrappers conform to List interface in Java
  Add helper macro to avoid duplication in Java vector typemaps

Conflicts:
	CHANGES.current
2017-05-26 19:15:12 +01:00
William S Fulton
98e67539dd Director testcase cosmetic fixes 2017-05-22 19:15:39 +01:00
William S Fulton
72ba741d1c Fix wrapping of references/pointers and qualifiers to member pointers
Also fix Go wrapping of member const function pointers.
2017-03-16 21:04:38 +00:00
William S Fulton
8a4ab380a1 Java director typemaps and test tweak
- Fix java_director_typemaps test name clash ensuring parallel tests work
- Replace assert with code that is guaranteed to run
- Nicer generated code from directorargout typemap
2017-01-24 23:47:30 +00:00
Andrey Starodubtsev
519f296579 WIP: #704 (java directorargout + java/typemaps.i fixes)
- failed tests fixed
2017-01-22 18:14:38 +03:00
Andrey Starodubtsev
7cb2663132 WIP: #704 (java directorargout + java/typemaps.i fixes)
- avoid JCALL calls in generated code
- avoid redundant blocks in generated code
2017-01-22 13:41:53 +03:00
Andrey Starodubtsev
4ba9de370e Merge branch 'master' into directorargout_and_java_typemaps 2017-01-21 17:41:31 +03:00
William S Fulton
3d2e57b0f2 Add %proxycode directive for adding code into proxy classes for C#, D and Java 2017-01-13 20:43:50 +00:00
Vadim Zeitlin
c79dd9d420 Make std::vector<> wrappers conform to List interface in Java
Derive the class wrapping std::vector<> in Java from java.util.AbstractList<>.
This makes it possible to use it with various algorithms working with Java
collections and, maybe even more importantly, makes it possible to iterate
over the wrapped vectors using for-each loops.

This commit is based on the original patch by Volker Diels-Grabsch from
https://sourceforge.net/p/swig/patches/278/
2016-11-29 17:46:38 +01:00
William S Fulton
0a22fa0df1 Missing transient keywords in Java proxy class
Further security exploit refinements to a1771c
2016-11-13 19:55:50 +00:00
Andrey Starodubtsev
3ad041eede a lot of memory leak (local refs) fixed 2016-06-16 19:02:53 +03:00
William S Fulton
98a31ff633 Fix directorin SWIGTYPE typemaps to make a copy as these are used for pass by value.
Closes #434
2016-05-14 21:32:24 +01:00
William S Fulton
a15bbbaee5 Java - unsigned long long marshalling improvements for negative numbers
Affects marshalling of negative numbers from Java to C only.
A cast to signed long long in the C layer will now result in the expected value.

Closes #623.
2016-03-31 18:56:32 +01:00
William S Fulton
8322686e84 Cosmetic java typemap cleanup 2016-03-31 18:56:32 +01:00
Vadim Zeitlin
a1bddd56eb Make (char*, size_t) typemap usable for strings of other types in Java.
Notably it now works for "unsigned char*" strings.

Add a test to check that it now works in Java and also showing that it already
worked for the other languages with support for this typemap.
2015-08-07 19:44:45 +02:00
William S Fulton
a1771cb8a0 Fix potential security exploit in generated Java classes 2015-08-02 11:22:46 +01:00
William S Fulton
c7da8bb06e Warning fixes in generated Java code for 64bit Visual C++ on Windows. 2015-07-03 20:59:24 +01:00
William S Fulton
6c1630b152 Fix Java multi-argument typemaps (char *STRING, size_t LENGTH)
Now they can be applied to a wider range of types.
Closes #385.
2015-05-10 13:35:51 +01:00
William S Fulton
ea1b6e8ed5 Memory leak in java directors when passing byte arrays (char*, size_t)
When passing a byte array from c++ to Java using the director feature, the generated jni code does not release a temporary byte array.

This is the typemap specified in Java.swg:

    %typemap(directorin, descriptor="[B") (char *STRING, size_t LENGTH) {
    jbyteArray jb = (jenv)->NewByteArray($2);
    (jenv)->SetByteArrayRegion(jb, 0, $2, (jbyte *)$1);
    $input = jb;
    }

    %typemap(directorargout) (char *STRING, size_t LENGTH)
    %{(jenv)->GetByteArrayRegion($input, 0, $2, (jbyte *)$1); %}

Notice that the call to NewByteArray doesn't contain a symmetric release logic as the SetByteArrayRegion/GetByteArrayRegion does.

Closes #386
2015-04-23 19:17:35 +01:00
Witold Wolski
70cccf38fd add @SuppressWarnings("unused") to constructors generated using SWIG_JAVABODY_TYPEWRAPPER macro 2015-02-04 10:12:37 +01:00
William S Fulton
f4964f5fb3 Use more conventional naming for generated Java LocalRefGuard variables 2014-09-27 14:32:03 +01:00
Pingan Yi
b79646ce4c Patch of http://sourceforge.net/p/swig/mailman/message/29816385 2014-05-04 19:10:44 +08:00
Curtis Dunham
fe91d6449f Remove register storage class declarations
They're unnecessary, anacronistic, deprecated in modern
standards, generally ignored, useless, and (most importantly)
clang complains about them.
2014-02-19 11:58:27 -06:00
William S Fulton
e805d5f925 Merge branch 'master' into gsoc2009-matevz
parser.y still to be fixed up

Conflicts:
	Doc/Devel/engineering.html
	Examples/Makefile.in
	Lib/allegrocl/allegrocl.swg
	Lib/csharp/csharp.swg
	Lib/csharp/enums.swg
	Lib/csharp/enumsimple.swg
	Lib/csharp/enumtypesafe.swg
	Lib/java/java.swg
	Lib/python/pydocs.swg
	Lib/r/rtype.swg
	Source/Include/swigwarn.h
	Source/Modules/octave.cxx
	Source/Modules/python.cxx
	Source/Modules/ruby.cxx
	Source/Swig/scanner.c
	Source/Swig/stype.c
	Source/Swig/swig.h
	configure.ac
2013-01-28 07:01:37 +00:00
William S Fulton
285198c48f Add rvalue reference typemaps 2013-01-24 20:27:27 +00:00
William S Fulton
593c708a78 Fix (char *STRING, size_t LENGTH) typemaps to accept NULL string
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13736 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-09-07 06:07:20 +00:00
William S Fulton
4c898b023c The 'directorin' typemap now accepts , etc expansions instead of having to use workarounds - _name, _name etc.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12879 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-12-21 07:16:44 +00:00
William S Fulton
468ca084fc Correct special variables in 'directorargout' typemap. This change will break any 'directorargout' typemaps you may have written. Please change: to and to \n Also fix the named 'directorargout' DIRECTOROUT typemaps for these languages which didn't previously compile and add in , etc expansion.\n [C#, Go, Java, D] Add support for the 'directorargout' typemap.\n [Java] Add (char *STRING, size_t LENGTH) director typemaps.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12877 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-12-20 20:50:36 +00:00
William S Fulton
6e56d87471 Fix inconsistencies in Java and C# getCPtr() and pointer constructor visibility - change to protected/internal from public. Add SWIG_JAVABODY_PROXY, SWIG_JAVABODY_TYPEWRAPPER and SWIG_CSBODY_PROXY, SWIG_CSBODY_TYPEWRAPPER for users to easily change when using multiple modules.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12844 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-11-25 21:20:47 +00:00
William S Fulton
6a74028e65 Fix inconsistencies in Java and C# getCPtr() and pointer constructor visibility - change to protected/internal from public. Add SWIG_JAVABODY_PROXY, SWIG_JAVABODY_TYPEWRAPPER and SWIG_CSBODY_PROXY, SWIG_CSBODY_TYPEWRAPPER for users to easily change when using multiple modules.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12843 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-11-25 20:56:56 +00:00
William S Fulton
ef865e06d5 Added some missing multi-argument typemaps: (char *STRING, size_t LENGTH) and (char *STRING, int LENGTH) - Java patch is from Volker Grabsch. Elements of the primitive_types.i testcase for this moved into char_binary.i. Documentation for this enhanced.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12393 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-01-14 19:06:43 +00:00
William S Fulton
9df4479a08 Fix member pointers on 64 bit platforms for Java
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12031 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-05-18 21:18:43 +00:00
William S Fulton
bdb136d611 Change typemap matching rules for the default type (SWIGTYPE) to follow template partial specialization type deduction. Fixes some containers of const pointers. SWIGTYPE*& typemps removed and replaced with SWIGTYPE *const&.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11958 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-04-01 18:26:37 +00:00
William S Fulton
bce282fa0c Minor tweaks
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11931 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-03-10 07:29:16 +00:00
William S Fulton
96f9879511 Fixes for nspace and derived classes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11930 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-03-09 21:15:34 +00:00
William S Fulton
c1cce1bc98 The intermediary JNI class modifiers are now public by default. The proxy class pointer constructor and getCPtr() methods are also now public
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11927 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-03-08 20:48:11 +00:00
William S Fulton
4308dd03cf SWIG license change - The Examples and Lib move to a very permissive license in the LICENSE file, removing the BSD license restrictions as agreed by committers since it was inadvertently introduced. Remove some examples where the impact of the license change is not clear.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11874 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-02-27 23:26:02 +00:00
William S Fulton
be73d28ad7 don't unnecessarily set swigCPtr to zero again if Dispose/delete called multiple times
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11179 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-03-31 12:23:47 +00:00
William S Fulton
e6f5cdac9f Fix #2153773 - %nojavaexception - disabling and clearing Java checked exceptions
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10998 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-12-23 07:44:59 +00:00
William S Fulton
4887e7be7c Fix director typemaps for pointers so that NULL pointers are correctly marshalled to C#/Java null in director methods
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10662 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-07-14 21:09:23 +00:00
William S Fulton
336b50b43d Add the optimal attribute to the out typemap for more optimal code generation when returning objects by value
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10450 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-05-14 22:12:31 +00:00
William S Fulton
2cf3cb3dc9 char *& typemaps added
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10295 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-03-04 21:35:22 +00:00
William S Fulton
24af2d1b11 consistent directout typemaps for all languages - $result used instead of $1 in C# and Java now
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9467 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-10-20 22:54:14 +00:00
William S Fulton
ff75eef478 const size_t& typemaps added
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9457 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-10-17 21:43:40 +00:00
William S Fulton
4ad8d458d2 Avoid potential race conditions on the delete() method
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9443 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-10-12 21:36:06 +00:00
William S Fulton
51662d55f3 Fix #1238798 - Directors using unsigned long long or any other type
marshalled across the JNI boundary using a Java class (where the jni typemap
contains jobject).
Fix variable name clash in unsigned long long directorin typemap


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9436 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-10-11 22:42:25 +00:00
William S Fulton
0d30f52e97 Fix long long typemaps so that they can be applied to __int64 and other equivalents
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9223 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-07-24 20:37:10 +00:00
William S Fulton
6a8d2e97f1 Fix directorout typemap
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9201 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-07-07 10:06:25 +00:00