summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2013-01-29 06:55:22 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2013-01-29 06:55:22 +0000
commit38f37ef5ae7026dd7c04ac8c39cb2aec4bf90838 (patch)
tree4621027986afdf31e4e7a20ac94624d762acbc8c
parent38d454a1022f65d76e292fd13d699da896c0c2cf (diff)
downloadswig-38f37ef5ae7026dd7c04ac8c39cb2aec4bf90838.tar.gz
Apply patch SF #335 - Truly ignore constructors in directors with %ignore and correct testcase that tests this
-rw-r--r--CHANGES.current3
-rw-r--r--Examples/test-suite/director_ignore.i45
-rw-r--r--Source/Modules/lang.cxx3
3 files changed, 38 insertions, 13 deletions
diff --git a/CHANGES.current b/CHANGES.current
index ad2f1e764..9c014aa82 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -5,6 +5,9 @@ See the RELEASENOTES file for a summary of changes in each release.
Version 2.0.10 (in progress)
============================
+2013-01-28: William
+ [Java] Apply patch SF #335 - Truly ignore constructors in directors with %ignore.
+
2013-01-18: Brant Kyser
[Java] Patch #15 - Allow the use of the nspace feature without the -package commandline option.
This works as long and the new jniclasspackage pragma is used to place the JNI intermediate class
diff --git a/Examples/test-suite/director_ignore.i b/Examples/test-suite/director_ignore.i
index 05ba17ce1..57cbc13d8 100644
--- a/Examples/test-suite/director_ignore.i
+++ b/Examples/test-suite/director_ignore.i
@@ -68,6 +68,24 @@ class DAbstractIgnores
virtual double OverloadedProtectedMethod() = 0;
};
+template <typename T> class DTemplateAbstractIgnores
+{
+ T t;
+ public:
+ virtual ~DTemplateAbstractIgnores() {}
+ virtual double OverloadedMethod(int n, int xoffset = 0, int yoffset = 0) = 0;
+ virtual double OverloadedMethod(bool b) = 0;
+ virtual int Quadruple(int n) { return n*4; }
+ virtual int& References(int& n) { static int nn; nn=n; return nn; }
+ virtual int* Pointers(int* n) { static int nn; nn=*n; return &nn; }
+ protected:
+ virtual double OverloadedProtectedMethod(int n, int xoffset = 0, int yoffset = 0) = 0;
+ virtual double OverloadedProtectedMethod() = 0;
+};
+%}
+
+%template(DTemplateAbstractIgnoresInt) DTemplateAbstractIgnores<int>;
+
class DIgnoreConstructor
{
public:
@@ -83,21 +101,22 @@ class DIgnoreOnlyConstructor
DIgnoreOnlyConstructor(bool b) {}
};
-template <typename T> class DTemplateAbstractIgnores
+%{
+class DIgnoreConstructor
{
- T t;
public:
- virtual ~DTemplateAbstractIgnores() {}
- virtual double OverloadedMethod(int n, int xoffset = 0, int yoffset = 0) = 0;
- virtual double OverloadedMethod(bool b) = 0;
- virtual int Quadruple(int n) { return n*4; }
- virtual int& References(int& n) { static int nn; nn=n; return nn; }
- virtual int* Pointers(int* n) { static int nn; nn=*n; return &nn; }
- protected:
- virtual double OverloadedProtectedMethod(int n, int xoffset = 0, int yoffset = 0) = 0;
- virtual double OverloadedProtectedMethod() = 0;
+ virtual ~DIgnoreConstructor() {}
+ DIgnoreConstructor(std::string s, int i) {}
+ private: // Hide constructor
+ DIgnoreConstructor(bool b) {}
};
-%}
-%template(DTemplateAbstractIgnoresInt) DTemplateAbstractIgnores<int>;
+class DIgnoreOnlyConstructor
+{
+ public:
+ virtual ~DIgnoreOnlyConstructor() {}
+ private: // Hide constructor
+ DIgnoreOnlyConstructor(bool b) {}
+};
+%}
diff --git a/Source/Modules/lang.cxx b/Source/Modules/lang.cxx
index 4f1657825..69df79271 100644
--- a/Source/Modules/lang.cxx
+++ b/Source/Modules/lang.cxx
@@ -1995,6 +1995,9 @@ int Language::classDirectorConstructors(Node *n) {
for (ni = Getattr(n, "firstChild"); ni; ni = nextSibling(ni)) {
nodeType = Getattr(ni, "nodeType");
if (Cmp(nodeType, "constructor") == 0) {
+ if (GetFlag(ni, "feature:ignore"))
+ continue;
+
Parm *parms = Getattr(ni, "parms");
if (is_public(ni)) {
/* emit public constructor */