Commit graph

118 commits

Author SHA1 Message Date
William S Fulton
831fae3c69 Add the parameters typemap attribute to D and Java destructor wrapper typemaps
Added to the javadestruct, javadestruct_derived, ddispose, ddispose_derived
typemaps to mirror enhanced flexibility in the csdisposing and
csdisposing_derived (C#) typemaps. If provided the contents are generated
as the delete/dispose method's parameters declaration.
2019-04-08 19:20:50 +01:00
William S Fulton
613ff08150 Java: more replace Object with java.lang.Object 2019-02-23 16:39:21 +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
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
William S Fulton
dafe2d6949 Add director typemaps for pointer const ref types 2017-10-24 23:47:40 +01:00
Andrew Galante
36b3c56a06 Prevent writeback of a const char* array through a director when using the byte[] %typemap. 2017-07-26 13:59:08 -07: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
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