Commit graph

340 commits

Author SHA1 Message Date
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
William S Fulton
32e7074d9b Whitespace fixes in STL wrappers 2017-06-03 18:36:59 +01:00
William S Fulton
fdca8e9829 Better variable naming consistency in STL containers 2017-05-26 22:37:29 +01:00
William S Fulton
b51f32a915 Java std::vector tweaks
- Replace javacode typemap with %proxycode to make this typemap available to users
- Make doSize private.
2017-05-26 22:37:22 +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
0bafadea5a Fix potential STL std::vector wrappers <: digraphs problems. 2017-05-26 18:55:52 +01:00
William S Fulton
98e67539dd Director testcase cosmetic fixes 2017-05-22 19:15:39 +01:00
William S Fulton
a271043555 Fix warnings in Java OUTPUT and INOUT typemaps 2017-05-14 00:39:08 +01:00
William S Fulton
07ab80b49e Add raise methods for throwing c++ exceptions in C#, Java, D
The director c++ exceptions are thrown in a helper method instead of in
the director overloaded method. This circumvents compiler warnings about
throwing exceptions when the method has an exception specification or
noexcept. If the exception is thrown, abort will still be called!
In Java, the "director:noexcept" typemap can be used to do something
else. This typemap should be ported to the other languages too.
2017-05-13 17:01:15 +01:00
William S Fulton
ab1e9f5bd9 Consistent whitespace amongst all the shared_ptr and intrusive_ptr typemaps
[skip ci]
2017-04-20 19:21:47 +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
710804c88f WIP: #704 (java directorargout + java/typemaps.i fixes)
- reverted changes in javahead.swg
2017-01-22 13:41:44 +03:00
Andrey Starodubtsev
4ba9de370e Merge branch 'master' into directorargout_and_java_typemaps 2017-01-21 17:41:31 +03:00
William S Fulton
449aa08124 %extend changes and remove default use of javatype, dtype, cstype %typemaps
1) The %extend directive can now optionally support one of the 'class', 'struct' or 'union'.
2) The SWIG library no longer uses the javatype, dtype or cstype typemaps, thereby
   completely freeing them up for users to use without having to replicate the library
   code that they previously added

Tested by changes to test: java_lib_arrays
2017-01-15 16:50:24 +00: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
eba70ed16f Add runtime checks for vector size in Java
It doesn't seem to be possible to have a Java collection with more than 2^31-1
items, but it is perfectly possible to have an std::vector with more elements
than that in C++, so add runtime checks verifying that we don't lose count of
elements in the Java wrappers.
2016-11-29 17:47:01 +01: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
Vadim Zeitlin
7c4109c701 Add helper macro to avoid duplication in Java vector typemaps
No real changes yet, just use a C#-like macro in Java std::vector<> typemaps
too to avoid having to repeat almost exactly the same class declaration for
the general case and for the bool specialization.
2016-11-29 17:45:56 +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
3e449ea05f Merge branch 'master' into directorargout_and_java_typemaps 2016-11-02 18:12:38 +03:00
Tobias Lau
26293546a6 Added LocalRefGuard for wstrings 2016-10-20 13:37:28 +02:00
Andrey Starodubtsev
b9cdc3c5e1 Merge branch 'master' into directorargout_and_java_typemaps 2016-10-13 14:14:59 +03:00
Daniel Vollmer
ce1cb85d86 Add <typeinfo> header for std::bad_cast 2016-09-17 13:24:32 +02:00