summaryrefslogtreecommitdiff
path: root/Lib/java
diff options
context:
space:
mode:
authorVadim Zeitlin <vz-swig@zeitlins.org>2019-07-11 13:07:10 +0200
committerVadim Zeitlin <vz-swig@zeitlins.org>2019-07-11 13:10:23 +0200
commit2be293a647acf2fcab84a6dc20a7cf0a7f94ac90 (patch)
treed99400d9d12e40902c4e9bdd8813436f2d3c64e6 /Lib/java
parent28c6140c56c8a16f9e562370b0b7451a3b760858 (diff)
downloadswig-2be293a647acf2fcab84a6dc20a7cf0a7f94ac90.tar.gz
Fix std::vector<> Java typemaps for primitive types
For such types, the generated proxy class inherited from java.util.AbstractSet<BoxedType<T>> (where BoxedType<T> is "Integer", for example, when T is "int"), but defined an overloaded add() taking T, instead of overriding the base class virtual add() taking BoxedType<T>, resulting in an exception being thrown whenever add() was called during run-time. Extend Java unit test to bring it to parity with C# one added in the previous commit. See #1568.
Diffstat (limited to 'Lib/java')
-rw-r--r--Lib/java/std_set.i6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/java/std_set.i b/Lib/java/std_set.i
index 04658f765..73e0c2cf9 100644
--- a/Lib/java/std_set.i
+++ b/Lib/java/std_set.i
@@ -57,6 +57,10 @@ class set {
return sizeImpl();
}
+ public boolean add($typemap(jboxtype, T) key) {
+ return addImpl(key);
+ }
+
public boolean addAll(java.util.Collection<? extends $typemap(jboxtype, T)> collection) {
boolean didAddElement = false;
for (java.lang.Object object : collection) {
@@ -172,7 +176,7 @@ class set {
%fragment("SWIG_SetSize");
// Returns whether item was inserted.
- bool add(const T& key) {
+ bool addImpl(const T& key) {
return self->insert(key).second;
}