Merge branch 'doxy/commands'

* doxy/commands:
  Update documentation for doxygen tags
  Fix doxygen translation of \p command for python
  Fix doxygen handling of \em tag for python
  Minor formatting updates to doxygen docs
  Reformat tag lists in doxygen documentation
  Add doxygen_code_blocks_runme.java
  Special handling for python doctest code blocks
  Add new doxygen test doxygen_code_blocks
  Handle doxygen code command with language option
  Improve doxygen parser handling of \code content
  Flag optional arguments in doxygen pydoc output
  Add parameter direction to doxygen pydoc output
  Support doxygen \param[] commands
diff --git a/.travis.yml b/.travis.yml
index c9cbd78..32c6656 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -54,7 +54,12 @@
       dist: xenial
     - compiler: gcc
       os: linux
-      env: SWIGLANG=d
+      env: SWIGLANG=d VER=2.066.0
+      sudo: required
+      dist: xenial
+    - compiler: gcc
+      os: linux
+      env: SWIGLANG=d VER=2.086.1
       sudo: required
       dist: xenial
     - compiler: gcc
@@ -204,6 +209,11 @@
       dist: xenial
     - compiler: gcc
       os: linux
+      env: SWIGLANG=python PY3=3 VER=3.8
+      sudo: required
+      dist: xenial
+    - compiler: gcc
+      os: linux
       env: SWIGLANG=python SWIG_FEATURES=-builtin
       sudo: required
       dist: xenial
@@ -217,7 +227,7 @@
       sudo: required
       dist: xenial
     - os: linux
-      env: SWIGLANG=python SWIG_FEATURES=-builtin GCC=6 CPP11=1 PY3=3 VER=3.7
+      env: SWIGLANG=python SWIG_FEATURES=-builtin GCC=6 CPP11=1 PY3=3 VER=3.8
       sudo: required
       dist: xenial
     - compiler: gcc
@@ -237,12 +247,17 @@
       dist: xenial
     - compiler: gcc
       os: linux
-      env: SWIGLANG=python SWIG_FEATURES="-builtin -O" PY3=3 VER=3.7
+      env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.8
       sudo: required
       dist: xenial
     - compiler: gcc
       os: linux
-      env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.7 SWIGOPTPY3=
+      env: SWIGLANG=python SWIG_FEATURES="-builtin -O" PY3=3 VER=3.8
+      sudo: required
+      dist: xenial
+    - compiler: gcc
+      os: linux
+      env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.8 SWIGOPTPY3=
       sudo: required
       dist: xenial
     - compiler: gcc
@@ -252,7 +267,7 @@
       dist: xenial
     - compiler: gcc
       os: linux
-      env: SWIGLANG=python SWIG_FEATURES=-O PY3=3 VER=3.7
+      env: SWIGLANG=python SWIG_FEATURES=-O PY3=3 VER=3.8
       sudo: required
       dist: xenial
     - compiler: gcc
@@ -302,6 +317,11 @@
       dist: xenial
     - compiler: gcc
       os: linux
+      env: SWIGLANG=ruby VER=2.7
+      sudo: required
+      dist: xenial
+    - compiler: gcc
+      os: linux
       env: SWIGLANG=scilab
       sudo: required
       dist: xenial
@@ -322,11 +342,6 @@
       env: SWIGLANG=java CPP11=1
       sudo: required
       dist: xenial
-    - compiler: gcc
-      os: linux
-      env: SWIGLANG=octave SWIGJOBS=-j2 VER=4.4 CPP11=1
-      sudo: required
-      dist: trusty
     - os: linux
       env: SWIGLANG=python CPP11=1
       sudo: required
@@ -384,7 +399,7 @@
       sudo: required
       dist: xenial
     - os: linux
-      env: SWIGLANG=python GCC=8 CPP17=1 PY3=3 VER=3.7
+      env: SWIGLANG=python GCC=8 CPP17=1 PY3=3 VER=3.8
       sudo: required
       dist: xenial
     - os: linux
@@ -396,7 +411,7 @@
       sudo: required
       dist: xenial
     - os: linux
-      env: SWIGLANG=python GCC=9 CPP17=1 PY3=3 VER=3.7
+      env: SWIGLANG=python GCC=9 CPP17=1 PY3=3 VER=3.8
       sudo: required
       dist: xenial
     - compiler: gcc
@@ -448,6 +463,12 @@
       osx_image: xcode10.2
 
   allow_failures:
+    # Newer version of D not yet working/supported
+    - compiler: gcc
+      os: linux
+      env: SWIGLANG=d VER=2.086.1
+      sudo: required
+      dist: xenial
     # seg fault in director_basic testcase
     - compiler: gcc
       os: linux
diff --git a/ANNOUNCE b/ANNOUNCE
index b83921c..6709f11 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,8 +1,8 @@
-*** ANNOUNCE: SWIG 4.0.1 (in progress) ***
+*** ANNOUNCE: SWIG 4.0.2 (in progress) ***
 
 http://www.swig.org
 
-We're pleased to announce SWIG-4.0.1, the latest SWIG release.
+We're pleased to announce SWIG-4.0.2, the latest SWIG release.
 
 What is SWIG?
 =============
@@ -25,11 +25,11 @@
 ============
 The release is available for download on Sourceforge at
 
-     http://prdownloads.sourceforge.net/swig/swig-4.0.1.tar.gz
+     http://prdownloads.sourceforge.net/swig/swig-4.0.2.tar.gz
 
 A Windows version is also available at
 
-     http://prdownloads.sourceforge.net/swig/swigwin-4.0.1.zip
+     http://prdownloads.sourceforge.net/swig/swigwin-4.0.2.zip
 
 Please report problems with this release to the swig-devel mailing list,
 details at http://www.swig.org/mail.html.
diff --git a/CHANGES b/CHANGES
index 7fd6b6d..fe86967 100644
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,145 @@
 Issue # numbers mentioned below can be found on Github. For more details, add
 the issue number to the end of the URL: https://github.com/swig/swig/issues/
 
+Version 4.0.1 (21 Aug 2019)
+===========================
+
+2019-08-20: TekuConcept
+            [Javascript] #1535 Add %native support to Javascript.
+
+2019-08-20: bkotzz
+            [Java] #1616 Add SWIG_JavaIllegalStateException to support throwing
+            java.lang.IllegalStateException from JNI code.
+
+2019-08-19: sjml
+            [Lua] #1596 tostring output changes to show the underlying C/C++ pointer.
+
+2019-08-08: rokups
+            [C#, Java] #1601 Fix invalid code generated for "%constant enum EnumType.
+
+2019-08-07: wsfulton
+            [Python] Fix method overloading of methods that take STL containers of different
+            types. The following usage (using std::vector) would fail when using -builtin:
+
+              %include <std_string.i>
+              %include <std_vector.i>
+
+              %inline %{
+              struct X {};
+              %}
+
+              %template(VectorX) std::vector<X>;
+              %template(VectorInt) std::vector<int>;
+
+              %inline %{
+              using namespace std;
+              string VectorOverload(vector<X> v);
+              string VectorOverload(vector<int> v);
+              %}
+
+            The following would incorrectly fail:
+
+              s = VectorOverload([1, 2, 3])
+
+            With:
+
+              Traceback (most recent call last):
+                File "runme3.py", line 20, in <module>
+                  ret = VectorOverload([1, 2, 3])
+              TypeError: Wrong number or type of arguments for overloaded function 'VectorOverload'.
+                Possible C/C++ prototypes are:
+                  VectorOverload(std::vector< Number,std::allocator< Number > >)
+                  VectorOverload(std::vector< int,std::allocator< int > >)
+
+            The problem was due to some error handling that was not cleared during typehecking.
+            In this case an error was not cleared when the elements in the list failed the
+            typecheck for converting to X. Only occurs in Python 3+.
+
+            In some combinations of overloaded methods, the following type of error message would
+            occur:
+
+              RuntimeError: in sequence element 0
+
+              The above exception was the direct cause of the following exception:
+
+              Traceback (most recent call last):
+                File "runme3.py", line 23, in <module>
+                  check(VectorOverload(v), "vector<X>")
+              SystemError: <built-in function VectorOverload> returned a result with an error set
+
+2019-08-01: wsfulton
+            #1602 Fix regression in 4.0.0 where a template function containing a parameter
+            with the same name as the function name led to the parameter name used in the
+            target language being incorrectly modified.
+
+2019-07-29: wsfulton
+            Remove all generated files on error. Previously generated files were not removed,
+            potentially breaking Makefiles using file dependencies, especially when -Werror
+            (warnings as errors) was used.
+
+2019-07-23: smithx
+            [C#] #1530 #1532 Fix marshalling of std::wstring to C#.
+
+2019-07-18: gicmo
+            [Python] #1587 Python 3.8 support - remove use of deprecated PyObject_GC_UnTrack.
+
+2019-07-18: cher-nov
+            [Python] #1573 Generated Python code uses consistent string quoting style - double
+            quotes.
+
+2019-07-16: geefr
+            [C#] #616 #1576 Fix C# bool INPUT[], bool OUTPUT[], bool INOUT[] typemaps to marshall
+            as 1-byte.
+
+2019-07-12: vadz
+            [C#, Java] #1568 #1583 Fix std::set<> typemaps for primitive types.
+
+2019-07-12: vadz
+            #1566 #1584 Regression in 4.0.0 - fix missing value for first item of enums with
+            trailing comma.
+
+2019-07-11: mcfarljm
+            #1548 #1578 Fix segfault in Doxygen parser parsing empty lines in some commands like
+            \code.
+
+2019-07-09: IsaacPascual
+            [C#, Java] #1570 Fix name of generated C#/Java classes for %interface macros
+            in swiginterface.i when wrapping nested C++ classes.
+
+2019-07-05: wsfulton
+            [Python] #1547 Whitespace fixes in Doxygen translated comments into pydoc comments
+            for Sphinx compatibility.
+
+2019-06-28: wsfulton
+            [MzScheme, OCaml] #1559 $arg and $input were incorrectly substituted in the
+            argout typemap when two or more arguments were present.
+
+2019-06-24: wsfulton
+            [Python, Ruby] #1538 Remove the UnknownExceptionHandler class in order to be
+            C++17 compliant as it uses std::unexpected_handler which was removed in C++17.
+            This class was intended for director exception handling but was never used by
+            SWIG and was never documented.
+
+            *** POTENTIAL INCOMPATIBILITY ***
+
+2019-06-06: bkotzz
+            [Java] #1552 Improve performance in Java std::vector constructor wrapper that takes
+            a native Java array as input.
+
+2019-06-03: olly
+	    [Python] Fix regression in implicit_conv handling of tuples,
+	    introduced in SWIG 4.0.0.  Fixes #1553, reported by Alexandre
+	    Duret-Lutz.
+
+2019-05-24: wsfulton
+            [Octave] Fix detection of Octave on MacOS.
+
+2019-05-24: opoplawski
+            [Octave] #1522 Adapt OCTAVE_LDFLAGS for Octave 5.1.
+
+2019-05-22: ferdynator
+	    [PHP] #1528 Don't add a closing '?>' PHP tag to generated files.
+	    PSR-2 says it MUST be omitted for files containing only PHP.
 Version 4.0.0 (27 Apr 2019)
 ===========================
 
diff --git a/CHANGES.current b/CHANGES.current
index 6b38059..4180d2c 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -4,79 +4,42 @@
 Issue # numbers mentioned below can be found on Github. For more details, add
 the issue number to the end of the URL: https://github.com/swig/swig/issues/
 
-Version 4.0.1 (in progress)
+Version 4.0.2 (in progress)
 ===========================
 
-2019-08-01: wsfulton
-            #1602 Fix regression in 4.0.0 where a template function containing a parameter
-            with the same name as the function name led to the parameter name used in the
-            target language being incorrectly modified.
+2020-01-13: wsfulton
+            [Python] #1595 Python -builtin constructors silently ignored keyword arguments.
+            Instead of silenty ignoring them, now a "TypeError: f() takes no keyword arguments"
+            exception is thrown if keyword arguments are used. Hence constructors and normal methods/
+            functions behave in the same way. Note, -keyword should be used with -builtin to obtain
+            keyword argument support.
 
-2019-07-29: wsfulton
-            Remove all generated files on error. Previously generated files were not removed,
-            potentially breaking Makefiles using file dependencies, especially when -Werror
-            (warnings as errors) was used.
+2020-01-05: jschueller shadchin
+            [Python] #1670 #1696 Add missing field initializers introduced in python 3.8:
+            tp_vectorcall and tp_print.
 
-2019-07-23: smithx
-            [C#] #1530 #1532 Fix marshalling of std::wstring to C#.
+2020-01-05: friedrichatgc
+            [Octave] #1688 Change swig_this() to use size_t instead of long for compatibility
+            with Windows 64 bit.
 
-2019-07-18: gicmo
-            [Python] #1587 Python 3.8 support - remove use of deprecated PyObject_GC_UnTrack.
+2020-01-05: treitmayr
+            [Ruby] #1692 #1689 Add support for Ruby 2.7
 
-2019-07-18: cher-nov
-            [Python] #1573 Generated Python code uses consistent string quoting style - double
-            quotes.
+2019-12-30: treitmayr
+            [Ruby] #1653 #1668 Fix code generated when using -globalmodule option.
 
-2019-07-16: geefr
-            [C#] #616 #1576 Fix C# bool INPUT[], bool OUTPUT[], bool INOUT[] typemaps to marshall
-            as 1-byte.
+2019-12-29: ZackerySpytz
+            [OCaml] #1686 Fix compilation errors with OCaml 4.09.0.
 
-2019-07-12: vadz
-            [C#, Java] #1568 #1583 Fix std::set<> typemaps for primitive types.
+2019-12-10: wsfulton
+            #1679 Fix parsing of C++11 identifiers with special meaning (final and override) when
+            they are used as part of the scope name of an identifier, such as a namespace name.
 
-2019-07-12: vadz
-            #1566 #1584 Regression in 4.0.0 - fix missing value for first item of enums with
-            trailing comma.
+2019-11-26: wsfulton
+            [C#] #1628 'out' or 'ref' used in a cstype typemap was not always stripped out in parts
+            of director code generation.
 
-2019-07-11: mcfarljm
-            #1548 #1578 Fix segfault in Doxygen parser parsing empty lines in some commands like
-            \code.
-
-2019-07-09: IsaacPascual
-            [C#, Java] #1570 Fix name of generated C#/Java classes for %interface macros
-            in swiginterface.i when wrapping nested C++ classes.
-
-2019-07-05: wsfulton
-            [Python] #1547 Whitespace fixes in Doxygen translated comments into pydoc comments
-            for Sphinx compatibility.
-
-2019-06-28: wsfulton
-            [MzScheme, OCaml] #1559 $arg and $input were incorrectly substituted in the
-            argout typemap when two or more arguments were present.
-
-2019-06-24: wsfulton
-            [Python, Ruby] #1538 Remove the UnknownExceptionHandler class in order to be
-            C++17 compliant as it uses std::unexpected_handler which was removed in C++17.
-            This class was intended for director exception handling but was never used by
-            SWIG and was never documented.
-
-            *** POTENTIAL INCOMPATIBILITY ***
-
-2019-06-06: bkotzz
-            [Java] #1552 Improve performance in Java std::vector constructor wrapper that takes
-            a native Java array as input.
-
-2019-06-03: olly
-	    [Python] Fix regression in implicit_conv handling of tuples,
-	    introduced in SWIG 4.0.0.  Fixes #1553, reported by Alexandre
-	    Duret-Lutz.
-
-2019-05-24: wsfulton
-            [Octave] Fix detection of Octave on MacOS.
-
-2019-05-24: opoplawski
-            [Octave] #1522 Adapt OCTAVE_LDFLAGS for Octave 5.1.
-
-2019-05-22: ferdynator
-	    [PHP] #1528 Don't add a closing '?>' PHP tag to generated files.
-	    PSR-2 says it MUST be omitted for files containing only PHP.
+2019-11-01: wsfulton
+            [Python] #1595 Fix bug in support for keyword arguments (kwargs feature or -keyword)
+            when using -builtin. The fix is in the argument error checking when wrapping zero
+            argument constructors only.
diff --git a/Doc/Manual/CSharp.html b/Doc/Manual/CSharp.html
index 1fc2d21..d041bf5 100644
--- a/Doc/Manual/CSharp.html
+++ b/Doc/Manual/CSharp.html
@@ -66,7 +66,16 @@
 It is also better suited for robust production environments due to the Managed C++ flaw called the
 <a href="https://msdn.microsoft.com/en-us/ie/aa290048(v=vs.94)">Mixed DLL Loading Problem</a>.
 SWIG C# works equally well on non-Microsoft operating systems such as Linux, Solaris and Apple Mac using
-<a href="https://www.mono-project.com/Main_Page/">Mono</a> and <a href="http://www.dotgnu.org/pnet.html">Portable.NET</a>.
+<a href="https://www.mono-project.com/Main_Page/">Mono</a>.
+</p>
+
+<p>
+SWIG 3 and later requires .NET 2.0 at a minimum.
+There are some minor exceptions, where the minimum required is .NET 4.0.
+This is when using the <tt>std::complex</tt> and <tt>std::list</tt> STL containers.
+</p>
+
+<p>
 </p>
 
 <p>
diff --git a/Doc/Manual/Javascript.html b/Doc/Manual/Javascript.html
index 417ee45..0b30137 100644
--- a/Doc/Manual/Javascript.html
+++ b/Doc/Manual/Javascript.html
@@ -163,7 +163,6 @@
     <li><p>Multiple output arguments do not work for JSC</p></li>
     <li><p>C89 incompatibility: the JSC generator might still generate C89 violating code</p></li>
     <li><p><code>long long</code> is not supported</p></li>
-    <li><p><code>%native</code> is not supported</p></li>
     <li><p>Javascript callbacks are not supported</p></li>
     <li><p><code>instanceOf</code> does not work under JSC</p></li>
 </ul>
diff --git a/Doc/Manual/R.html b/Doc/Manual/R.html
index 45e5541..373cd7e 100644
--- a/Doc/Manual/R.html
+++ b/Doc/Manual/R.html
@@ -28,7 +28,9 @@
 R is a GPL'ed open source statistical and plotting environment.
 Information about R can be found at <a
 href="http://www.r-project.org/">www.r-project.org</a>.
+</p>
 
+<p>
 The R bindings are under active development.  They have been used to
 compile and run an R interface to QuantLib running on Mandriva Linux
 with gcc. The R bindings also work on Microsoft Windows using Visual C++.
@@ -113,11 +115,10 @@
 </pre>
 </div>
 
+<p>
 The cacheMetaData(1) will cause R to refresh its object tables.
 Without it, inheritance of wrapped objects may fail.
-
-<p>
-These two files can be loaded in any order
+These two files can be loaded in any order.
 </p>
 
 <p>
@@ -140,18 +141,22 @@
 <H2><a name="R_nn4">33.3 Precompiling large R files</a></H2>
 
 
+<p>
 In cases where the R file is large, one make save a lot of loading
 time by precompiling the R wrapper.  This can be done by creating the
 file makeRData.R which contains the following
+</p>
 
-<pre>
+<div class="code"><pre>
 source('BigFile.R')
 save(list=ls(all=TRUE), file="BigFile.RData", compress=TRUE)
 q(save="no")
-</pre>
+</pre></div>
 
+<p>
 This will generate a compiled R file called BigFile.RData that
 will save a large amount of loading time.
+</p>
 
 
 
@@ -192,21 +197,27 @@
 R doesn't have a native enumeration type. Enumerations are represented
 as character strings in R, with calls to R functions that convert back
 and forth between integers.
+</p>
 
+<p>
 The details of enumeration names and contents are stored in hidden R
 environments, which are named according the the enumeration name - for
 example, an enumeration colour:
+</p>
+
 <div class="code"><pre>
 enum colour { red=-1, blue, green = 10 };
 </pre></div>
 
+<p>
 will be initialized by the following call in R:
+</p>
+
 <div class="code"><pre>
 defineEnumeration("_colour",
  .values=c("red" = .Call('R_swig_colour_red_get',FALSE, PACKAGE='enum_thorough'),
 "blue" = .Call('R_swig_colour_blue_get',FALSE, PACKAGE='enum_thorough'),
 "green" = .Call('R_swig_colour_green_get',FALSE, PACKAGE='enum_thorough')))
-
 </pre></div>
 
 <p>
@@ -216,7 +227,9 @@
 the compiled library to be loaded, so a  <tt>delayedAssign</tt> is employed
 within <tt>defineEnumeration</tt> in order to allow the code to be easily used in R
 packages.
+</p>
 
+<p>
 The user typically does not need to access the enumeration lookup
 functions or know the name of the enumeration type used by
 R. Attributes containing the type information are attached by swig to
@@ -224,14 +237,17 @@
 values, and those attributes are used to identify and access the
 appropriate environments and thus translate between characters
 and integers.
+</p>
 
+<p>
 The relevant functions, for debugging purposes, are <tt>enumToInteger</tt> and
 <tt>enumFromInteger</tt>.
+</p>
 
+<p>
 Anonymous enumerations are ignored by the binding generation process,
 leaving no way of accessing the value of anonymous enumerations from R
 code.
-
 </p>
 
 </body>
diff --git a/Doc/Manual/Ruby.html b/Doc/Manual/Ruby.html
index 3cfd129..6939a8a 100644
--- a/Doc/Manual/Ruby.html
+++ b/Doc/Manual/Ruby.html
@@ -615,6 +615,24 @@
 effect until it is explicitly disabled using <tt>%mutable</tt>.
 </p>
 
+<p>Note: When SWIG is invoked with the <tt>-globalmodule</tt> option in
+effect, the C/C++ global variables will be translated into Ruby global
+variables. Type-checking and the optional read-only characteristic are
+available in the same way as described above. However the example would
+then have to be modified and executed in the following way:
+
+<div class="code targetlang">
+<pre>$ <b>irb</b>
+irb(main):001:0&gt; <b>require 'Example'</b>
+true
+irb(main):002:0&gt; <b>$variable1 = 2</b>
+2
+irb(main):003:0&gt; <b>$Variable2 = 4 * 10.3</b>
+41.2
+irb(main):004:0&gt; <b>$Variable2</b>
+41.2</pre>
+</div>
+
 <H3><a name="Ruby_nn15">34.3.4 Constants</a></H3>
 
 
diff --git a/Doc/Manual/SWIG.html b/Doc/Manual/SWIG.html
index aec48ef..c54d117 100644
--- a/Doc/Manual/SWIG.html
+++ b/Doc/Manual/SWIG.html
@@ -827,6 +827,32 @@
 </div>
 
 <p>
+This logic can lead to false attempts at converting <tt>#define</tt> into <tt>%constant</tt> though.
+For example the following case does not have any undefined symbols within the macro:
+</p>
+
+<div class="code">
+<pre>
+// For indicating pure virtual functions such as: virtual void f() PURE;
+#define PURE = 0
+</pre>
+</div>
+
+<p>
+A warning is issued:
+</p>
+
+<div class="shell">
+<pre>
+pure.h:1: Warning 305: Bad constant value (ignored).
+</pre>
+</div>
+
+<p>
+In such cases simply ignore the warning or suppress it using the normal warning suppression techniques.
+</p>
+
+<p>
 The use of constant expressions is allowed, but SWIG does not evaluate
 them. Rather, it passes them through to the output file and lets the C
 compiler perform the final evaluation (SWIG does perform a limited
diff --git a/Doc/Manual/Sections.html b/Doc/Manual/Sections.html
index 2cb1d2b..9319459 100644
--- a/Doc/Manual/Sections.html
+++ b/Doc/Manual/Sections.html
@@ -8,7 +8,7 @@
 <H1><a name="Sections">SWIG-4.0 Documentation</a></H1>
 
 <p>
-Last update : SWIG-4.0.1 (in progress)
+Last update : SWIG-4.0.2 (in progress)
 </p>
 
 <H2><a name="Sections_Sections">Sections</a></H2>
diff --git a/Examples/Makefile.in b/Examples/Makefile.in
index 98be787..6fbca29 100644
--- a/Examples/Makefile.in
+++ b/Examples/Makefile.in
@@ -1436,34 +1436,20 @@
 GO = @GO@
 GOGCC = @GOGCC@
 GCCGO = @GCCGO@
-GO1 = @GO1@
-GO12 = @GO12@
-GO13 = @GO13@
-GO15 = @GO15@
-GOC = @GOC@
 GOOPT = @GOOPT@
 GCCGOOPT = @GCCGOOPT@
 GOVERSIONOPTION = @GOVERSIONOPTION@
 
 GOSWIGARG = `if $(GOGCC) ; then echo -gccgo; fi`
-GOCOMPILEARG = `if $(GO15); then echo tool compile; elif $(GO1) ; then echo tool $(GOC:c=g) ; fi` `if $(GO13) || $(GO15); then echo -pack ; fi`
 
 GOSRCS = $(INTERFACE:.i=.go)
 GOCSRCS = $(INTERFACE:.i=_gc.c)
 
-GOLD = `if $(GO15); then echo link; else echo $(GOC:c=l); fi`
-GOTOOL = `if $(GO1) ; then echo go tool; fi`
-GOPACK = `if $(GO1) ; then echo go tool pack; else echo gopack; fi`
-
 GOPACKAGE = $(notdir $(INTERFACE:.i=.a))
 
 GOPATHPARENTDIR = gopath/$(GOMOD)/src
 GOPATHDIR = $(GOPATHPARENTDIR)/$(INTERFACE:.i=)
 
-GOOBJEXT = `if $(GO15); then echo o; else echo $(GOC:c=); fi`
-GOGCOBJS = $(GOSRCS:.go=.$(GOOBJEXT))
-GOGCCOBJS = $(GOSRCS:.go=.@OBJEXT@)
-
 # ----------------------------------------------------------------
 # Build a Go module (C)
 # ----------------------------------------------------------------
@@ -1478,49 +1464,13 @@
 	echo "go 1.12" >> $(GOPATHDIR)/go.mod
 	mv -f $(GOPATHDIR)/go.mod $(GOPATHPARENTDIR)/go.mod
 
-go_nocgo: $(SRCDIR_SRCS)
-	$(SWIG) -go -no-cgo $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
-	if $(GO12) || $(GO13) || $(GO15) || $(GOGCC); then \
-	  $(CC) -g -c $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES); \
-	else \
-	  $(CC) -g -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES); \
-	  $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO); \
-	fi
-	if $(GOGCC) ; then \
-	  $(COMPILETOOL) $(GCCGO) -g -c -I . $(GOSRCS); \
-	else \
-	  $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(GOSRCS); \
-	  $(COMPILETOOL) $(GOTOOL) $(GOC) -I $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`} $(GOCSRCS); \
-	  rm -f $(GOPACKAGE); \
-	  if $(GO13) || $(GO15); then \
-	    cp $(GOGCOBJS) $(GOPACKAGE); \
-	    $(COMPILETOOL) $(GOPACK) r $(GOPACKAGE) $(GOCSRCS:.c=.$(GOOBJEXT)) $(OBJS) $(IOBJS); \
-	  elif $(GO12); then \
-	    $(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)) $(OBJS) $(IOBJS); \
-	  else \
-	    $(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)); \
-	  fi; \
-	fi
-	if test -f $(SRCDIR)$(RUNME).go; then \
-	  if $(GOGCC) ; then \
-	    $(COMPILETOOL) $(GCCGO) -g -c $(SRCDIR)$(RUNME).go; \
-	    $(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOGCCOBJS) $(OBJS) $(IOBJS); \
-	  elif $(GO12) || $(GO13) || $(GO15); then \
-	    $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
-	    $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CC)" -extldflags "$(CFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
-	  else \
-	    $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
-	    $(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
-	  fi; \
-	fi
-
 go: $(SRCDIR_SRCS) $(GOPATHPARENTDIR)/go.mod
 	$(SWIG) -go -import-prefix swigtests $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
 	@mkdir gopath 2>/dev/null || true
 	@mkdir gopath/$(GOMOD) 2>/dev/null || true
 	@mkdir gopath/$(GOMOD)/src 2>/dev/null || true
 	@mkdir $(GOPATHDIR) 2>/dev/null || true
-	rm -f $(GOPATHDIR)/*
+	rm -rf $(GOPATHDIR)/*
 	cp $(ISRCS) $(GOPATHDIR)/
 	if test -f $(IWRAP:.i=.h); then \
 	  cp $(IWRAP:.i=.h) $(GOPATHDIR)/; \
@@ -1529,6 +1479,13 @@
 	  cp $(SRCDIR_SRCS) $(GOPATHDIR)/; \
 	fi
 	cp $(GOSRCS) $(GOPATHDIR)/
+	@if test -f $(SRCDIR)$(RUNME).go; then \
+	  mkdir gopath/$(GOMOD)/src/runme 2>/dev/null || true; \
+	  rm -f gopath/$(GOMOD)/src/runme/*; \
+	fi
+	if test -f $(SRCDIR)$(RUNME).go; then \
+	  cp $(SRCDIR)$(RUNME).go gopath/$(GOMOD)/src/runme/; \
+	fi
 	GOPATH=`pwd`/gopath/$(GOMOD); \
 	export GOPATH; \
 	CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
@@ -1537,82 +1494,29 @@
 	export CGO_CFLAGS; \
 	CGO_LDFLAGS="$(LDFLAGS) -lm"; \
 	export CGO_LDFLAGS; \
-	(cd $(GOPATHDIR)/ && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE))
+	(cd $(GOPATHDIR)/ && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE)); \
 	if $(GOGCC); then \
 	  cp $(GOPATHDIR)/$(GOPACKAGE) $(GOPATHDIR)/$(GOPACKAGE:.a=.gox); \
-	fi
+	fi; \
 	if test -f $(SRCDIR)$(RUNME).go; then \
-	  if $(GOGCC) ; then \
-	    $(COMPILETOOL) $(GCCGO) -c -g -I $(GOPATHDIR) $(SRCDIR)$(RUNME).go; \
-	    $(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOPATHDIR)/$(GOPACKAGE); \
-	  elif $(GO12) || $(GO13) || $(GO15); then \
-	    $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I $(GOPATHDIR) -o $(RUNME).$(GOOBJEXT) $(SRCDIR)$(RUNME).go; \
-	    $(COMPILETOOL) $(GOTOOL) $(GOLD) -L $(GOPATHDIR) -linkmode external -extld "$(CC)" -extldflags "$(CFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
-	  else \
-	    $(COMPILETOOL) $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
-	    $(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
-	  fi; \
+	  mkdir gopath/$(GOMOD)/src/swigtests 2>/dev/null || true; \
+	  mkdir gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=) 2>/dev/null || true; \
+	  cp $(GOPATHDIR)/* gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=)/; \
+	  (cd gopath/$(GOMOD)/src/runme && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o runme $(RUNME).go); \
+	  cp gopath/$(GOMOD)/src/runme/runme $(RUNME); \
 	fi
 
 # ----------------------------------------------------------------
 # Build a Go module (C++)
 # ----------------------------------------------------------------
 
-go_cpp_nocgo: $(SRCDIR_SRCS)
-	$(SWIG) -go -c++ -no-cgo $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
-	if $(GO12) || $(GO13) || $(GO15) || $(GOGCC); then \
-	  if test -n "$(SRCDIR_CXXSRCS)$(SRCDIR_SRCS)"; then \
-	    $(CXX) -g -c $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_CXXSRCS) $(SRCDIR_SRCS) $(INCLUDES); \
-	  fi; \
-	  $(foreach f,$(ICXXSRCS), \
-	    $(CXX) -g -c $(CPPFLAGS) $(CXXFLAGS) -o $(addsuffix .@OBJEXT@,$(basename $f)) $f $(INCLUDES); \
-	  ) \
-	else \
-	  $(CXX) -g -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES); \
-	  $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO); \
-	fi
-	if ! $(GOGCC) ; then \
-	  $(foreach f,$(GOSRCS), \
-	    $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . -o $(addsuffix .$(GOOBJEXT),$(basename $f)) $f \
-	  ); \
-	  $(foreach f,$(GOCSRCS), \
-	    $(COMPILETOOL) $(GOTOOL) $(GOC) -I $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`} \
-	    -o $(addsuffix .$(GOOBJEXT),$(basename $f)) $f; \
-	  ) \
-	  rm -f $(GOPACKAGE); \
-	  if $(GO13) || $(GO15); then \
-	    cp $(GOGCOBJS) $(GOPACKAGE); \
-	    $(COMPILETOOL) $(GOPACK) r $(GOPACKAGE) $(GOCSRCS:.c=.$(GOOBJEXT)) $(OBJS) $(IOBJS); \
-	  elif $(GO12); then \
-	    $(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)) $(OBJS) $(IOBJS); \
-	  else \
-	    $(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)); \
-	  fi; \
-	else \
-	  $(foreach f,$(GOSRCS), \
-	    $(COMPILETOOL) $(GCCGO) -g -c -I . -o $(addsuffix .@OBJEXT@,$(basename $f)) $f \
-	  ); \
-	fi
-	if test -f $(SRCDIR)$(RUNME).go; then \
-	  if $(GOGCC) ; then \
-	    $(COMPILETOOL) $(GCCGO) -g -c $(SRCDIR)$(RUNME).go; \
-	    $(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOGCCOBJS) $(OBJS) $(IOBJS) -lstdc++; \
-	  elif $(GO12) || $(GO13) || $(GO15); then \
-	    $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
-	    $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CXX)" -extldflags "$(CXXFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
-	  else \
-	    $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
-	    $(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
-	  fi; \
-	fi
-
 go_cpp: $(SRCDIR_SRCS) $(GOPATHPARENTDIR)/go.mod
 	$(SWIG) -go -c++ -import-prefix swigtests $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
 	@mkdir gopath 2>/dev/null || true
 	@mkdir gopath/$(GOMOD) 2>/dev/null || true
 	@mkdir gopath/$(GOMOD)/src 2>/dev/null || true
 	@mkdir $(GOPATHDIR) 2>/dev/null || true
-	rm -f $(GOPATHDIR)/*
+	rm -rf $(GOPATHDIR)/*
 	cp $(ICXXSRCS) $(GOPATHDIR)/
 	if test -f $(IWRAP:.i=.h); then \
 	  cp $(IWRAP:.i=.h) $(GOPATHDIR)/; \
@@ -1624,6 +1528,13 @@
 	  cp $(SRCDIR_SRCS) $(GOPATHDIR)/; \
 	fi
 	cp $(GOSRCS) $(GOPATHDIR)/
+	@if test -f $(SRCDIR)$(RUNME).go; then \
+	  mkdir gopath/$(GOMOD)/src/runme 2>/dev/null || true; \
+	  rm -f gopath/$(GOMOD)/src/runme/*; \
+	fi
+	if test -f $(SRCDIR)$(RUNME).go; then \
+	  cp $(SRCDIR)$(RUNME).go gopath/$(GOMOD)/src/runme/; \
+	fi
 	GOPATH=`pwd`/gopath/$(GOMOD); \
 	export GOPATH; \
 	CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
@@ -1634,21 +1545,16 @@
 	export CGO_CXXFLAGS; \
 	CGO_LDFLAGS="$(LDFLAGS) -lm"; \
 	export CGO_LDFLAGS; \
-	(cd $(GOPATHDIR) && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE))
+	(cd $(GOPATHDIR) && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE)); \
 	if $(GOGCC); then \
 	  cp $(GOPATHDIR)/$(GOPACKAGE) $(GOPATHDIR)/$(GOPACKAGE:.a=.gox); \
-	fi
+	fi; \
 	if test -f $(SRCDIR)$(RUNME).go; then \
-	  if $(GOGCC) ; then \
-	    $(COMPILETOOL) $(GCCGO) -g -c -I $(GOPATHDIR) $(SRCDIR)$(RUNME).go; \
-	    $(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOPATHDIR)/$(GOPACKAGE) -lstdc++; \
-	  elif $(GO12) || $(GO13) || $(GO15); then \
-	    $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I $(GOPATHDIR) -o $(RUNME).$(GOOBJEXT) $(SRCDIR)$(RUNME).go; \
-	    $(COMPILETOOL) $(GOTOOL) $(GOLD) -L $(GOPATHDIR) -linkmode external -extld "$(CXX)" -extldflags "$(CXXFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
-	  else \
-	    $(COMPILETOOL) $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
-	    $(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
-	  fi; \
+	  mkdir gopath/$(GOMOD)/src/swigtests 2>/dev/null || true; \
+	  mkdir gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=) 2>/dev/null || true; \
+	  cp $(GOPATHDIR)/* gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=)/; \
+	  (cd gopath/$(GOMOD)/src/runme && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o runme $(RUNME).go); \
+	  cp gopath/$(GOMOD)/src/runme/runme $(RUNME); \
 	fi
 
 # -----------------------------------------------------------------
diff --git a/Examples/go/callback/runme.go b/Examples/go/callback/runme.go
index 2c1d813..7c9ffd6 100644
--- a/Examples/go/callback/runme.go
+++ b/Examples/go/callback/runme.go
@@ -3,7 +3,7 @@
 import (
 	"fmt"
 
-	. "example"
+	. "swigtests/example"
 )
 
 func main() {
diff --git a/Examples/go/class/runme.go b/Examples/go/class/runme.go
index d2f292e..a09a182 100644
--- a/Examples/go/class/runme.go
+++ b/Examples/go/class/runme.go
@@ -5,7 +5,7 @@
 import (
 	"fmt"
 
-	. "example"
+	. "swigtests/example"
 )
 
 func main() {
diff --git a/Examples/go/constants/runme.go b/Examples/go/constants/runme.go
index d56fd62..57ef21a 100644
--- a/Examples/go/constants/runme.go
+++ b/Examples/go/constants/runme.go
@@ -3,7 +3,7 @@
 import (
 	"fmt"
 
-	"example"
+	"swigtests/example"
 )
 
 func main() {
diff --git a/Examples/go/director/runme.go b/Examples/go/director/runme.go
index 0e0da07..e28eccb 100644
--- a/Examples/go/director/runme.go
+++ b/Examples/go/director/runme.go
@@ -4,7 +4,7 @@
 	"fmt"
 	"os"
 
-	"example"
+	"swigtests/example"
 )
 
 func Compare(name string, got string, exp string) error {
diff --git a/Examples/go/enum/runme.go b/Examples/go/enum/runme.go
index 5088705..c0642e0 100644
--- a/Examples/go/enum/runme.go
+++ b/Examples/go/enum/runme.go
@@ -3,7 +3,7 @@
 import (
 	"fmt"
 
-	. "example"
+	. "swigtests/example"
 )
 
 func main() {
diff --git a/Examples/go/extend/runme.go b/Examples/go/extend/runme.go
index af64a6e..716af52 100644
--- a/Examples/go/extend/runme.go
+++ b/Examples/go/extend/runme.go
@@ -5,7 +5,7 @@
 import (
 	"fmt"
 
-	. "example"
+	. "swigtests/example"
 )
 
 func main() {
diff --git a/Examples/go/funcptr/runme.go b/Examples/go/funcptr/runme.go
index 4b20db4..87ec7d4 100644
--- a/Examples/go/funcptr/runme.go
+++ b/Examples/go/funcptr/runme.go
@@ -3,7 +3,7 @@
 import (
 	"fmt"
 
-	. "example"
+	. "swigtests/example"
 )
 
 func main() {
diff --git a/Examples/go/multimap/runme.go b/Examples/go/multimap/runme.go
index 571fac7..2f8b205 100644
--- a/Examples/go/multimap/runme.go
+++ b/Examples/go/multimap/runme.go
@@ -3,7 +3,7 @@
 import (
 	"fmt"
 
-	. "example"
+	. "swigtests/example"
 )
 
 func main() {
diff --git a/Examples/go/pointer/runme.go b/Examples/go/pointer/runme.go
index 0cf340f..73c6b2b 100644
--- a/Examples/go/pointer/runme.go
+++ b/Examples/go/pointer/runme.go
@@ -3,7 +3,7 @@
 import (
 	"fmt"
 
-	. "example"
+	. "swigtests/example"
 )
 
 func main() {
diff --git a/Examples/go/reference/runme.go b/Examples/go/reference/runme.go
index 9999733..7391d9c 100644
--- a/Examples/go/reference/runme.go
+++ b/Examples/go/reference/runme.go
@@ -5,7 +5,7 @@
 import (
 	"fmt"
 
-	. "example"
+	. "swigtests/example"
 )
 
 func main() {
diff --git a/Examples/go/simple/runme.go b/Examples/go/simple/runme.go
index 0bd4657..5bc055f 100644
--- a/Examples/go/simple/runme.go
+++ b/Examples/go/simple/runme.go
@@ -3,7 +3,7 @@
 import (
 	"fmt"
 
-	"example"
+	"swigtests/example"
 )
 
 func main() {
diff --git a/Examples/go/template/runme.go b/Examples/go/template/runme.go
index 3477953..e000b15 100644
--- a/Examples/go/template/runme.go
+++ b/Examples/go/template/runme.go
@@ -5,7 +5,7 @@
 import (
 	"fmt"
 
-	. "example"
+	. "swigtests/example"
 )
 
 func main() {
diff --git a/Examples/go/variables/runme.go b/Examples/go/variables/runme.go
index e2dd0c6..85ca8c6 100644
--- a/Examples/go/variables/runme.go
+++ b/Examples/go/variables/runme.go
@@ -5,7 +5,7 @@
 import (
 	"fmt"
 
-	"example"
+	"swigtests/example"
 )
 
 func main() {
diff --git a/Examples/javascript/check.list b/Examples/javascript/check.list
index 9707e77..9778357 100644
--- a/Examples/javascript/check.list
+++ b/Examples/javascript/check.list
@@ -3,6 +3,7 @@
 enum
 exception
 functor
+native
 nspace
 operator
 overload
diff --git a/Examples/javascript/native/Makefile b/Examples/javascript/native/Makefile
new file mode 100644
index 0000000..0402f8d
--- /dev/null
+++ b/Examples/javascript/native/Makefile
@@ -0,0 +1,3 @@
+SRCS =
+
+include $(SRCDIR)../example.mk
diff --git a/Examples/javascript/native/binding.gyp.in b/Examples/javascript/native/binding.gyp.in
new file mode 100644
index 0000000..59779ae
--- /dev/null
+++ b/Examples/javascript/native/binding.gyp.in
@@ -0,0 +1,9 @@
+{
+  "targets": [
+    {
+      "target_name": "example",
+      "sources": [ "example_wrap.cxx" ],
+      "include_dirs": ["$srcdir"]
+    }
+  ]
+}
diff --git a/Examples/javascript/native/example.i b/Examples/javascript/native/example.i
new file mode 100644
index 0000000..8c61600
--- /dev/null
+++ b/Examples/javascript/native/example.i
@@ -0,0 +1,47 @@
+/* File : example.i */
+%module example
+
+// placeholder() used to help SWIG generate "SWIG_From_int" call
+%{
+    int placeholder();
+%}
+int placeholder() { return 0; }
+
+// actual demo code
+%wrapper
+%{
+#ifdef SWIG_V8_VERSION /* Engine: Node || V8 */
+    
+    static SwigV8ReturnValue JavaScript_do_work(const SwigV8Arguments &args) {
+        SWIGV8_HANDLESCOPE();
+        const int MY_MAGIC_NUMBER = 5;
+        v8::Handle<v8::Value> jsresult =
+            SWIG_From_int(static_cast< int >(MY_MAGIC_NUMBER));
+        if (args.Length() != 0)
+            SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments.");
+        SWIGV8_RETURN(jsresult);
+    fail:
+        SWIGV8_RETURN(SWIGV8_UNDEFINED());
+    }
+
+#else /* Engine: JavaScriptCore */
+
+    static JSValueRef JavaScript_do_work(JSContextRef context,
+        JSObjectRef function, JSObjectRef thisObject, size_t argc,
+        const JSValueRef argv[], JSValueRef* exception) {
+        const int MY_MAGIC_NUMBER = 5;
+        JSValueRef jsresult =
+            SWIG_From_int SWIG_JSC_FROM_CALL_ARGS(
+                static_cast< int >(MY_MAGIC_NUMBER));
+        if (argc != 0)
+            SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments.");
+        return jsresult;
+    fail:
+        return JSValueMakeUndefined(context);
+    }
+
+#endif
+%}
+
+
+%native(magicNumber) void JavaScript_do_work();
diff --git a/Examples/javascript/native/example.js b/Examples/javascript/native/example.js
new file mode 100644
index 0000000..2e7f83a
--- /dev/null
+++ b/Examples/javascript/native/example.js
@@ -0,0 +1 @@
+module.exports = require("build/Release/example");
diff --git a/Examples/javascript/native/index.html b/Examples/javascript/native/index.html
new file mode 100644
index 0000000..7c7d6b0
--- /dev/null
+++ b/Examples/javascript/native/index.html
@@ -0,0 +1,31 @@
+<html>
+<head>
+<title>SWIG:Examples:javascript:native</title>
+</head>
+
+<body bgcolor="#ffffff">
+
+
+<tt>SWIG/Examples/javascript/native/</tt>
+<hr>
+
+<H2>Manually wrapped callback function in JavaScript</H2>
+
+<p>
+This example demonstrates how to manually add callback feature support to a SWIG module.
+</p>
+
+<ul>
+<li><a href="example.i">example.i</a>. Interface file containing the API function and async behind-the-scenes functions. 
+<li><a href="runme.java">runme.js</a>. Sample JavaScript program showing the API function being called with a callback function parameter.
+</ul>
+
+<h2>Notes</h2>
+
+The V8 code queues the callback request for processing using the UV interface. An async function callback is invoked when the system is ready to process the next request. When the async function finishes, a completion function callback is invoked to finalize the request. Here the callback function parameter is invoked.
+<br/><br/>
+UV request queueing is only necessary for operations that would take a really long or otherwise unpredictable amount of time (async operations). A callback parameter could also be invoked immediately within the API function.
+
+<hr>
+</body>
+</html>
diff --git a/Examples/javascript/native/runme.js b/Examples/javascript/native/runme.js
new file mode 100644
index 0000000..b5e14d0
--- /dev/null
+++ b/Examples/javascript/native/runme.js
@@ -0,0 +1,3 @@
+var example = require("example");
+
+console.log("My magic number is: ", example.magicNumber());
diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk
index 93128af..3c2ef3b 100644
--- a/Examples/test-suite/common.mk
+++ b/Examples/test-suite/common.mk
@@ -159,6 +159,7 @@
 	cpp_enum \
 	cpp_namespace \
 	cpp_nodefault \
+	cpp_parameters \
 	cpp_static \
 	cpp_typedef \
 	cpp14_binary_integer_literals \
@@ -250,6 +251,7 @@
 	funcptr_cpp \
 	functors \
 	fvirtual \
+	global_immutable_vars_cpp \
 	global_namespace \
 	global_ns_arg \
 	global_scope_types \
@@ -610,11 +612,14 @@
 #	cpp11_reference_wrapper \     # No typemaps
 
 # Doxygen support test cases: can only be used with languages supporting
-# Doxygen comment translation, currently only Python and Java.
+# Doxygen comment translation (currently Python and Java) and only if not
+# disabled by configure via SKIP_DOXYGEN_TEST_CASES.
+ifneq ($(SKIP_DOXYGEN_TEST_CASES),1)
 python_HAS_DOXYGEN := 1
 java_HAS_DOXYGEN := 1
 
 $(eval HAS_DOXYGEN := $($(LANGUAGE)_HAS_DOXYGEN))
+endif
 
 ifdef HAS_DOXYGEN
 DOXYGEN_TEST_CASES += \
@@ -644,6 +649,7 @@
 	director_string \
 	ignore_template_constructor \
 	li_std_combinations \
+	li_std_containers_overload \
 	li_std_deque \
 	li_std_except \
 	li_std_except_as_class \
@@ -689,6 +695,7 @@
 	funcptr \
 	function_typedef \
 	global_functions \
+	global_immutable_vars \
 	immutable_values \
 	inctest \
 	infinity \
diff --git a/Examples/test-suite/constant_directive.i b/Examples/test-suite/constant_directive.i
index b102ffe..3e4775d 100644
--- a/Examples/test-suite/constant_directive.i
+++ b/Examples/test-suite/constant_directive.i
@@ -14,6 +14,11 @@
   Type1(int val = 0) : val(val) {}
   int val;
 };
+enum EnumType
+{
+  EnumValue
+};
+EnumType enumValue = EnumValue;
 /* Typedefs for const Type and its pointer */
 typedef const Type1 Type1Const;
 typedef const Type1* Type1Cptr;
@@ -46,3 +51,4 @@
 %constant Type1Cfptr TYPE1CFPTR1DEF_CONSTANT1 = getType1Instance;
 /* Regular constant */
 %constant int TYPE_INT = 0;
+%constant enum EnumType newValue = enumValue;
diff --git a/Examples/test-suite/cpp11_final_override.i b/Examples/test-suite/cpp11_final_override.i
index 8d275b3..c31ae73 100644
--- a/Examples/test-suite/cpp11_final_override.i
+++ b/Examples/test-suite/cpp11_final_override.i
@@ -138,3 +138,31 @@
 DerivedNoVirtualStruct::~DerivedNoVirtualStruct() {}
 %}
 
+%inline %{
+namespace Outer {
+  namespace final {
+    template <typename T> struct smart_ptr {
+      typedef T type;
+    };
+  }
+  namespace override {
+    template <typename T> struct dumb_ptr {
+      typedef T type;
+    };
+  }
+}
+%}
+
+%template(SmartPtrBaseStruct) Outer::final::smart_ptr<DerivedStruct>;
+
+%inline %{
+class ObjectDB
+{
+public:
+  static void smart1(typename Outer::final::smart_ptr<DerivedStruct>::type *objectT) {}
+  static void smart2(Outer::final::smart_ptr<DerivedStruct>::type *objectT) {}
+  static void dumb1(typename Outer::override::dumb_ptr<DerivedStruct>::type *objectT) {}
+  static void dumb2(Outer::override::dumb_ptr<DerivedStruct>::type *objectT) {}
+  static Outer::final::smart_ptr<DerivedStruct>::type get() { return DerivedStruct(); }
+};
+%}
diff --git a/Examples/test-suite/cpp_parameters.i b/Examples/test-suite/cpp_parameters.i
new file mode 100644
index 0000000..e8a4c94
--- /dev/null
+++ b/Examples/test-suite/cpp_parameters.i
@@ -0,0 +1,46 @@
+%module cpp_parameters
+
+%{
+// For Perl
+#ifdef Zero
+#undef Zero
+#endif
+%}
+%inline %{
+
+// Zero arguments
+struct Zero {
+  Zero() {}
+  int zero() { return 0; }
+  static int stat_zero() { return 0; }
+};
+// One mandatory argument
+struct One {
+  One(int a) {}
+  int one(int a) { return a; }
+  static int stat_one(int a) { return a; }
+};
+// Two mandatory arguments
+struct Two {
+  Two(int a, int b) {}
+  int two(int a, int b) { return a + b; }
+  static int stat_two(int a, int b) { return a + b; }
+};
+// Single optional argument
+struct Single {
+  Single(int a=0) {}
+  int single(int a=0) { return a; }
+  static int stat_single(int a=0) { return a; }
+};
+
+int global_zero() { return 0; }
+int global_one(int a) { return a; }
+int global_two(int a, int b) { return a + b; }
+int global_single(int a=0) { return a; }
+
+#ifdef SWIGPYTHON_BUILTIN
+bool is_python_builtin() { return true; }
+#else
+bool is_python_builtin() { return false; }
+#endif
+%}
diff --git a/Examples/test-suite/csharp/Makefile.in b/Examples/test-suite/csharp/Makefile.in
index 8272864..57a81e3 100644
--- a/Examples/test-suite/csharp/Makefile.in
+++ b/Examples/test-suite/csharp/Makefile.in
@@ -16,6 +16,7 @@
 	complextest \
 	csharp_attributes \
 	csharp_swig2_compatibility \
+	csharp_director_typemaps \
 	csharp_exceptions \
 	csharp_features \
 	csharp_lib_arrays \
diff --git a/Examples/test-suite/csharp/csharp_director_typemaps_runme.cs b/Examples/test-suite/csharp/csharp_director_typemaps_runme.cs
new file mode 100644
index 0000000..6143332
--- /dev/null
+++ b/Examples/test-suite/csharp/csharp_director_typemaps_runme.cs
@@ -0,0 +1,53 @@
+
+using System;
+using System.Reflection;
+using csharp_director_typemapsNamespace;
+
+public class csharp_director_typemaps_runme {
+
+  class CSharpDirectorTypemaps_InStreamDerived : InStream
+  {
+    private int constant;
+    public CSharpDirectorTypemaps_InStreamDerived(int constant) { this.constant = constant; }
+    public override int Read(global::System.IntPtr buf, int len, out int readLen) {
+      readLen = (buf == global::System.IntPtr.Zero) ? -len - constant : len + constant;
+      return readLen;
+    }
+    public override int Write(global::System.IntPtr buf, int len, out int writeLen) {
+      writeLen = (buf == global::System.IntPtr.Zero) ? -len - constant : len + constant;
+      return writeLen;
+    }
+  }
+  public static void Main() {
+    int outLen = -1;
+    int k = 100;
+    int j = 23;
+    InStream instream = new CSharpDirectorTypemaps_InStreamDerived(k);
+
+    {
+      int ret = csharp_director_typemaps.callRead(instream, InStream.getCPtr(instream).Handle, j, out outLen);
+      Assert(outLen, j + k);
+      Assert(ret, j + k);
+    }
+    {
+      int ret = csharp_director_typemaps.callRead(instream, global::System.IntPtr.Zero, j, out outLen);
+      Assert(outLen, -j - k);
+      Assert(ret, -j - k);
+    }
+
+    {
+      int ret = csharp_director_typemaps.callWrite(instream, InStream.getCPtr(instream).Handle, j, out outLen);
+      Assert(outLen, j + k);
+      Assert(ret, j + k);
+    }
+    {
+      int ret = csharp_director_typemaps.callWrite(instream, global::System.IntPtr.Zero, j, out outLen);
+      Assert(outLen, -j - k);
+      Assert(ret, -j - k);
+    }
+  }
+  private static void Assert(int i1, int i2) {
+    if (i1 != i2)
+      throw new Exception("assertion failure. " + i1 + " != " + i2);
+  }
+}
diff --git a/Examples/test-suite/csharp_director_typemaps.i b/Examples/test-suite/csharp_director_typemaps.i
new file mode 100644
index 0000000..614bdbf
--- /dev/null
+++ b/Examples/test-suite/csharp_director_typemaps.i
@@ -0,0 +1,37 @@
+%module (directors="1") csharp_director_typemaps
+
+// This tests that the csout typemap is handled correctly in the director code.
+// The 'out' needs stripping in some parts of the generated director code.
+
+%feature("director") InStream;
+
+%apply void *VOID_INT_PTR { void * }
+
+%typemap(ctype)         int* readLen, int* writeLen "/*ctype*/ int*"
+%typemap(imtype)        int* readLen, int* writeLen "/*imtype*/ out int"
+%typemap(cstype)        int* readLen                "/*cstype*/ out int"
+// Note for below: 'out' used in typemap comment
+%typemap(cstype)                      int* writeLen "/*out cstype out*/ out int"
+%typemap(csin)          int* readLen, int* writeLen "/*csin*/ out $csinput"
+%typemap(in)            int* readLen, int* writeLen %{/*in*/  $1 = ($1_ltype)$input; %}
+%typemap(out)           int* readLen, int* writeLen %{/*out*/ $result = (void *)$1; %}
+%typemap(csdirectorin)  int* readLen, int* writeLen "/*csdirectorin*/ out $iminput"
+%typemap(csdirectorout) int* readLen, int* writeLen "/*csdirectorout*/ $cscall"
+%typemap(directorin)    int* readLen, int* writeLen "/*directorin*/ $input = $1;"
+%typemap(directorout)   int* readLen, int* writeLen %{/*directorout*/  $result = ($1_ltype)$input; %}
+
+%inline %{
+class InStream
+{
+public:
+    virtual int Read(void* buf, int len, int* readLen) = 0;
+    virtual int Write(void* buf, int len, int* writeLen) = 0;
+    virtual ~InStream() {}
+};
+int callRead(InStream* stream, void* buf, int len, int* readLen) {
+  return stream->Read(buf, len, readLen);
+}
+int callWrite(InStream* stream, void* buf, int len, int* writeLen) {
+  return stream->Write(buf, len, writeLen);
+}
+%}
diff --git a/Examples/test-suite/global_immutable_vars.i b/Examples/test-suite/global_immutable_vars.i
new file mode 100644
index 0000000..ab0d4f7
--- /dev/null
+++ b/Examples/test-suite/global_immutable_vars.i
@@ -0,0 +1,33 @@
+%module global_immutable_vars
+
+// Test immutable and mutable global variables,
+// see http://www.swig.org/Doc4.0/SWIGDocumentation.html#SWIG_readonly_variables
+
+%inline %{
+  int default_mutable_var = 40;
+%}
+
+%immutable;
+%feature("immutable", "0") specific_mutable_var;
+
+%inline %{
+  int global_immutable_var = 41;
+  int specific_mutable_var = 42;
+%}
+
+%mutable;
+%immutable specific_immutable_var;
+%inline %{
+  int global_mutable_var = 43;
+  int specific_immutable_var = 44;
+
+  int check_values(int default_mutable, int global_immutable, int specific_mutable, int global_mutable, int specific_immutable) {
+    return
+      default_mutable    == default_mutable_var &&
+      global_immutable   == global_immutable_var &&
+      specific_mutable   == specific_mutable_var &&
+      global_mutable     == global_mutable_var &&
+      specific_immutable == specific_immutable_var;
+  }
+%}
+
diff --git a/Examples/test-suite/global_immutable_vars_cpp.i b/Examples/test-suite/global_immutable_vars_cpp.i
new file mode 100644
index 0000000..40cc08e
--- /dev/null
+++ b/Examples/test-suite/global_immutable_vars_cpp.i
@@ -0,0 +1,33 @@
+%module global_immutable_vars_cpp
+
+// Test immutable and mutable global variables,
+// see http://www.swig.org/Doc4.0/SWIGDocumentation.html#SWIG_readonly_variables
+
+%inline %{
+  int default_mutable_var = 40;
+%}
+
+%immutable;
+%feature("immutable", "0") specific_mutable_var;
+
+%inline %{
+  int global_immutable_var = 41;
+  int specific_mutable_var = 42;
+%}
+
+%mutable;
+%immutable specific_immutable_var;
+%inline %{
+  int global_mutable_var = 43;
+  int specific_immutable_var = 44;
+
+  int check_values(int default_mutable, int global_immutable, int specific_mutable, int global_mutable, int specific_immutable) {
+    return
+      default_mutable    == default_mutable_var &&
+      global_immutable   == global_immutable_var &&
+      specific_mutable   == specific_mutable_var &&
+      global_mutable     == global_mutable_var &&
+      specific_immutable == specific_immutable_var;
+  }
+%}
+
diff --git a/Examples/test-suite/go/Makefile.in b/Examples/test-suite/go/Makefile.in
index d07a56b..8283327 100644
--- a/Examples/test-suite/go/Makefile.in
+++ b/Examples/test-suite/go/Makefile.in
@@ -6,24 +6,10 @@
 GO		= @GO@
 GOGCC		= @GOGCC@
 GCCGO		= @GCCGO@
-GO1		= @GO1@
-GO12		= @GO12@
-GO13		= @GO13@
-GO15		= @GO15@
-GOC		= @GOC@
 GOVERSIONOPTION	= @GOVERSIONOPTION@
 host		= @host@
 SCRIPTSUFFIX	= _runme.go
 
-GOCOMPILEARG = `if $(GO15); then echo tool compile; elif $(GO1); then echo tool $(GOC:c=g); fi`
-GOLD = `if $(GO15); then echo link; else echo $(GOC:c=l); fi`
-GOTOOL = `if $(GO1) ; then echo go tool; fi`
-GOPACK = `if $(GO1) ; then echo go tool pack; else echo gopack; fi`
-
-GOOBJEXT = `if $(GO15); then echo o; else echo $(GOC:c=); fi`
-
-OSXOLDGOLINKFLAGS	= `if [ -n "\`$(GO) $(GOVERSIONOPTION) | grep -E 'go1($|.0|.1|.2|.3)'\`" ] && [ -n "\`echo $(host) | grep darwin\`" ]; then echo "-Wl,-U,__cgo_topofstack"; fi`
-
 SO = @SO@
 
 srcdir         = @srcdir@
@@ -49,27 +35,11 @@
 	$(setup)
 	+$(swig_and_compile_cpp)
 	$(run_testcase_cpp)
-	if ! $(GO15); then \
-	  $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
-	  SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
-	  INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
-	  TARGET='$(TARGETPREFIX)$*$(TARGETSUFFIX)' INTERFACEDIR='$(INTERFACEDIR)' INTERFACE='$*.i' \
-	  $(LANGUAGE)$(VARIANT)_cpp_nocgo && \
-	  $(run_testcase_cpp); \
-	fi
 
 %.ctest:
 	$(setup)
 	+$(swig_and_compile_c)
 	$(run_testcase)
-	if ! $(GO15); then \
-	  $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CSRCS='$(CSRCS)' \
-	  SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
-	  INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
-	  TARGET='$(TARGETPREFIX)$*$(TARGETSUFFIX)' INTERFACEDIR='$(INTERFACEDIR)' INTERFACE='$*.i' \
-	  $(LANGUAGE)$(VARIANT)_nocgo && \
-	  $(run_testcase); \
-	fi
 
 %.multicpptest:
 	$(setup)
@@ -136,54 +106,66 @@
 # Runs the testcase.
 run_testcase = \
 	if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
-	  if $(GOGCC) ; then \
-	    $(COMPILETOOL) $(GCCGO) -c -g -I gopath/src/$* $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
-	    $(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ gopath/src/$*/$*.a; \
-	  elif $(GO12) || $(GO13) || $(GO15); then \
-	    $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I gopath/src/$* $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
-	    $(COMPILETOOL) $(GOTOOL) $(GOLD) -L gopath/src/$* -linkmode external -extld $(CC) -extldflags "$(CFLAGS) $(OSXOLDGOLINKFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
-	  else \
-	    $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
-	    $(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
-	  fi && \
+	  GOPATH=`pwd`/gopath/; \
+	  export GOPATH; \
+	  CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
+	  export CGO_CPPFLAGS; \
+	  CGO_CFLAGS="$(CFLAGS)"; \
+	  export CGO_CFLAGS; \
+	  CGO_CXXFLAGS="$(CXXFLAGS)"; \
+	  export CGO_CXXFLAGS; \
+	  CGO_LDFLAGS="$(LDFLAGS) -lm"; \
+	  export CGO_LDFLAGS; \
+	  mkdir gopath/src/swigtests 2>/dev/null || true; \
+	  mkdir gopath/src/swigtests/$* 2>/dev/null || true; \
+	  cp gopath/src/$*/* gopath/src/swigtests/$*/; \
+	  mkdir gopath/src/$*/runme 2>/dev/null || true; \
+	  cp $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) gopath/src/$*/runme/runme.go; \
+	  (cd gopath/src/$*/runme && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o runme runme.go); \
+	  cp gopath/src/$*/runme/runme $*_runme; \
 	  env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
 	fi
 
 run_testcase_cpp = \
 	if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
-	  if $(GOGCC) ; then \
-	    $(COMPILETOOL) $(GCCGO) -c -g -I gopath/src/$* $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
-	    $(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ gopath/src/$*/$*.a -lstdc++; \
-	  elif $(GO12) || $(GO13) || $(GO15); then \
-	    $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I gopath/src/$* $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
-	    $(COMPILETOOL) $(GOTOOL) $(GOLD) -L gopath/src/$* -linkmode external -extld $(CXX) -extldflags "$(CXXFLAGS) $(OSXOLDGOLINKFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
-	  else \
-	    $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
-	    $(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
-	  fi && \
+	  GOPATH=`pwd`/gopath/; \
+	  export GOPATH; \
+	  CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
+	  export CGO_CPPFLAGS; \
+	  CGO_CFLAGS="$(CFLAGS)"; \
+	  export CGO_CFLAGS; \
+	  CGO_CXXFLAGS="$(CXXFLAGS)"; \
+	  export CGO_CXXFLAGS; \
+	  CGO_LDFLAGS="$(LDFLAGS) -lm"; \
+	  export CGO_LDFLAGS; \
+	  mkdir gopath/src/swigtests 2>/dev/null || true; \
+	  mkdir gopath/src/swigtests/$* 2>/dev/null || true; \
+	  cp gopath/src/$*/* gopath/src/swigtests/$*/; \
+	  mkdir gopath/src/$*/runme 2>/dev/null || true; \
+	  cp $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) gopath/src/$*/runme/runme.go; \
+	  (cd gopath/src/$*/runme && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o runme runme.go); \
+	  cp gopath/src/$*/runme/runme $*_runme; \
 	  env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
 	fi
 
 run_multi_testcase = \
 	if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
-	  if $(GO15) || $(GOGCC); then \
-	    files=`cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list`; \
-	    mkdir gopath/$*/src/$* 2>/dev/null || true; \
-	    cp $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) gopath/$*/src/$*; \
-	    GOPATH="`pwd`/gopath/$*"; \
-	    export GOPATH; \
-	    CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) `for f in $$files; do echo -I ../$$f; done`"; \
-	    export CGO_CPPFLAGS; \
-	    CGO_CFLAGS="$(CFLAGS)"; \
-	    export CGO_CFLAGS; \
-	    CGO_CXXFLAGS="$(CXXFLAGS)"; \
-	    export CGO_CXXFLAGS; \
-	    CGO_LDFLAGS="$(LDFLAGS) -lm"; \
-	    export CGO_LDFLAGS; \
-	    (cd gopath/$*/src/$* && \
-	      $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o ../../../../$*_runme) && \
-	    env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
-	  fi; \
+	  files=`cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list`; \
+	  mkdir gopath/$*/src/$* 2>/dev/null || true; \
+	  cp $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) gopath/$*/src/$*; \
+	  GOPATH="`pwd`/gopath/$*"; \
+	  export GOPATH; \
+	  CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) `for f in $$files; do echo -I ../$$f; done`"; \
+	  export CGO_CPPFLAGS; \
+	  CGO_CFLAGS="$(CFLAGS)"; \
+	  export CGO_CFLAGS; \
+	  CGO_CXXFLAGS="$(CXXFLAGS)"; \
+	  export CGO_CXXFLAGS; \
+	  CGO_LDFLAGS="$(LDFLAGS) -lm"; \
+	  export CGO_LDFLAGS; \
+	  (cd gopath/$*/src/$* && \
+	    $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o ../../../../$*_runme) && \
+	  env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
 	fi
 
 %.clean:
diff --git a/Examples/test-suite/go/abstract_access_runme.go b/Examples/test-suite/go/abstract_access_runme.go
index 5102236..0a0e56f 100644
--- a/Examples/test-suite/go/abstract_access_runme.go
+++ b/Examples/test-suite/go/abstract_access_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "abstract_access"
+import "swigtests/abstract_access"
 
 func main() {
 	d := abstract_access.NewD()
diff --git a/Examples/test-suite/go/abstract_typedef2_runme.go b/Examples/test-suite/go/abstract_typedef2_runme.go
index 76a5fc8..5e2ed1e 100644
--- a/Examples/test-suite/go/abstract_typedef2_runme.go
+++ b/Examples/test-suite/go/abstract_typedef2_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "abstract_typedef2"
+import "swigtests/abstract_typedef2"
 
 func main() {
 	abstract_typedef2.NewA_UF()
diff --git a/Examples/test-suite/go/abstract_typedef_runme.go b/Examples/test-suite/go/abstract_typedef_runme.go
index 56aaa61..1ad49f5 100644
--- a/Examples/test-suite/go/abstract_typedef_runme.go
+++ b/Examples/test-suite/go/abstract_typedef_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "abstract_typedef"
+import "swigtests/abstract_typedef"
 
 func main() {
 	e := abstract_typedef.NewEngine()
diff --git a/Examples/test-suite/go/abstract_virtual_runme.go b/Examples/test-suite/go/abstract_virtual_runme.go
index e19eac2..d333d50 100644
--- a/Examples/test-suite/go/abstract_virtual_runme.go
+++ b/Examples/test-suite/go/abstract_virtual_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "abstract_virtual"
+import "swigtests/abstract_virtual"
 
 func main() {
 	abstract_virtual.NewD()
diff --git a/Examples/test-suite/go/argout_runme.go b/Examples/test-suite/go/argout_runme.go
index bb8ab9e..b2edf54 100644
--- a/Examples/test-suite/go/argout_runme.go
+++ b/Examples/test-suite/go/argout_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import wrap "argout"
+import wrap "swigtests/argout"
 
 func main() {
 	ip := wrap.New_intp()
diff --git a/Examples/test-suite/go/array_member_runme.go b/Examples/test-suite/go/array_member_runme.go
index 4f029db..d8c3896 100644
--- a/Examples/test-suite/go/array_member_runme.go
+++ b/Examples/test-suite/go/array_member_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "array_member"
+import . "swigtests/array_member"
 
 func main() {
 	f := NewFoo()
diff --git a/Examples/test-suite/go/arrays_global_runme.go b/Examples/test-suite/go/arrays_global_runme.go
index 35b049d..9c4a9e5 100644
--- a/Examples/test-suite/go/arrays_global_runme.go
+++ b/Examples/test-suite/go/arrays_global_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "arrays_global"
+import . "swigtests/arrays_global"
 
 func main() {
 	SetArray_i(GetArray_const_i())
diff --git a/Examples/test-suite/go/char_binary_runme.go b/Examples/test-suite/go/char_binary_runme.go
index d47d616..3c8c2d7 100644
--- a/Examples/test-suite/go/char_binary_runme.go
+++ b/Examples/test-suite/go/char_binary_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "char_binary"
+import . "swigtests/char_binary"
 
 func main() {
 	t := NewTest()
diff --git a/Examples/test-suite/go/class_ignore_runme.go b/Examples/test-suite/go/class_ignore_runme.go
index 24261c6..11cf81d 100644
--- a/Examples/test-suite/go/class_ignore_runme.go
+++ b/Examples/test-suite/go/class_ignore_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "class_ignore"
+import "swigtests/class_ignore"
 
 func main() {
 	a := class_ignore.NewBar()
diff --git a/Examples/test-suite/go/class_scope_weird_runme.go b/Examples/test-suite/go/class_scope_weird_runme.go
index a42bdad..4776990 100644
--- a/Examples/test-suite/go/class_scope_weird_runme.go
+++ b/Examples/test-suite/go/class_scope_weird_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "class_scope_weird"
+import "swigtests/class_scope_weird"
 
 func main() {
 	f := class_scope_weird.NewFoo()
diff --git a/Examples/test-suite/go/compactdefaultargs_runme.go b/Examples/test-suite/go/compactdefaultargs_runme.go
index fe6224c..c9e9008 100644
--- a/Examples/test-suite/go/compactdefaultargs_runme.go
+++ b/Examples/test-suite/go/compactdefaultargs_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "compactdefaultargs"
+import . "swigtests/compactdefaultargs"
 
 func main() {
 	defaults1 := NewDefaults1(1000)
diff --git a/Examples/test-suite/go/constover_runme.go b/Examples/test-suite/go/constover_runme.go
index 6c83709..51d965e 100644
--- a/Examples/test-suite/go/constover_runme.go
+++ b/Examples/test-suite/go/constover_runme.go
@@ -4,7 +4,7 @@
 	"fmt"
 	"os"
 
-	"constover"
+	"swigtests/constover"
 )
 
 func main() {
diff --git a/Examples/test-suite/go/constructor_copy_runme.go b/Examples/test-suite/go/constructor_copy_runme.go
index 68c4288..ca47255 100644
--- a/Examples/test-suite/go/constructor_copy_runme.go
+++ b/Examples/test-suite/go/constructor_copy_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "constructor_copy"
+import . "swigtests/constructor_copy"
 
 func main() {
 	f1 := NewFoo1(3)
diff --git a/Examples/test-suite/go/contract_runme.go b/Examples/test-suite/go/contract_runme.go
index b028855..7c9d097 100644
--- a/Examples/test-suite/go/contract_runme.go
+++ b/Examples/test-suite/go/contract_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "contract"
+import "swigtests/contract"
 
 func main() {
 	contract.Test_preassert(1, 2)
diff --git a/Examples/test-suite/go/cpp11_strongly_typed_enumerations_runme.go b/Examples/test-suite/go/cpp11_strongly_typed_enumerations_runme.go
index f9ca74a..926b6f7 100644
--- a/Examples/test-suite/go/cpp11_strongly_typed_enumerations_runme.go
+++ b/Examples/test-suite/go/cpp11_strongly_typed_enumerations_runme.go
@@ -1,7 +1,7 @@
 package main
 
 import "fmt"
-import . "cpp11_strongly_typed_enumerations"
+import . "swigtests/cpp11_strongly_typed_enumerations"
 
 func enumCheck(actual int, expected int) int {
 	if actual != expected {
diff --git a/Examples/test-suite/go/cpp_enum_runme.go b/Examples/test-suite/go/cpp_enum_runme.go
index 8906dd4..9b8930a 100644
--- a/Examples/test-suite/go/cpp_enum_runme.go
+++ b/Examples/test-suite/go/cpp_enum_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "cpp_enum"
+import "swigtests/cpp_enum"
 
 func main() {
 	f := cpp_enum.NewFoo()
diff --git a/Examples/test-suite/go/cpp_namespace_runme.go b/Examples/test-suite/go/cpp_namespace_runme.go
index aecdd95..71affc5 100644
--- a/Examples/test-suite/go/cpp_namespace_runme.go
+++ b/Examples/test-suite/go/cpp_namespace_runme.go
@@ -1,7 +1,7 @@
 // Note: This example assumes that namespaces are flattened
 package main
 
-import "cpp_namespace"
+import "swigtests/cpp_namespace"
 
 func main() {
 	n := cpp_namespace.Fact(4)
diff --git a/Examples/test-suite/go/cpp_static_runme.go b/Examples/test-suite/go/cpp_static_runme.go
index 1ad981a6..d482298 100644
--- a/Examples/test-suite/go/cpp_static_runme.go
+++ b/Examples/test-suite/go/cpp_static_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "cpp_static"
+import . "swigtests/cpp_static"
 
 func main() {
 	StaticFunctionTestStatic_func()
diff --git a/Examples/test-suite/go/default_args_runme.go b/Examples/test-suite/go/default_args_runme.go
index a39f957..5b6f404 100644
--- a/Examples/test-suite/go/default_args_runme.go
+++ b/Examples/test-suite/go/default_args_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "default_args"
+import "swigtests/default_args"
 
 func main() {
 	if default_args.StaticsStaticmethod() != 60 {
diff --git a/Examples/test-suite/go/default_constructor_runme.go b/Examples/test-suite/go/default_constructor_runme.go
index eeac7ea..90d9601 100644
--- a/Examples/test-suite/go/default_constructor_runme.go
+++ b/Examples/test-suite/go/default_constructor_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import dc "default_constructor"
+import dc "swigtests/default_constructor"
 
 func main() {
 	a := dc.NewA()
diff --git a/Examples/test-suite/go/director_alternating_runme.go b/Examples/test-suite/go/director_alternating_runme.go
index b4793aa..2df31db 100644
--- a/Examples/test-suite/go/director_alternating_runme.go
+++ b/Examples/test-suite/go/director_alternating_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "director_alternating"
+import . "swigtests/director_alternating"
 
 func main() {
 	id := GetBar().Id()
diff --git a/Examples/test-suite/go/director_basic_runme.go b/Examples/test-suite/go/director_basic_runme.go
index 360424d..c308f25 100644
--- a/Examples/test-suite/go/director_basic_runme.go
+++ b/Examples/test-suite/go/director_basic_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "director_basic"
+import "swigtests/director_basic"
 
 type GoFoo struct{}
 
diff --git a/Examples/test-suite/go/director_classic_runme.go b/Examples/test-suite/go/director_classic_runme.go
index 230c963..d8acc13 100644
--- a/Examples/test-suite/go/director_classic_runme.go
+++ b/Examples/test-suite/go/director_classic_runme.go
@@ -1,7 +1,7 @@
 package main
 
 import "fmt"
-import . "director_classic"
+import . "swigtests/director_classic"
 
 type TargetLangPerson struct{} // From Person
 func (p *TargetLangPerson) Id() string {
diff --git a/Examples/test-suite/go/director_default_runme.go b/Examples/test-suite/go/director_default_runme.go
index ac2aace..557d5c5 100644
--- a/Examples/test-suite/go/director_default_runme.go
+++ b/Examples/test-suite/go/director_default_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "director_default"
+import . "swigtests/director_default"
 
 func main() {
 	NewFoo()
diff --git a/Examples/test-suite/go/director_detect_runme.go b/Examples/test-suite/go/director_detect_runme.go
index 0c3c95f..f82a0c0 100644
--- a/Examples/test-suite/go/director_detect_runme.go
+++ b/Examples/test-suite/go/director_detect_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "director_detect"
+import "swigtests/director_detect"
 
 type MyBar struct {
 	val int
diff --git a/Examples/test-suite/go/director_enum_runme.go b/Examples/test-suite/go/director_enum_runme.go
index 002d425..3e67417 100644
--- a/Examples/test-suite/go/director_enum_runme.go
+++ b/Examples/test-suite/go/director_enum_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "director_enum"
+import "swigtests/director_enum"
 
 type MyFoo struct{} // From director_enum.Foo
 func (p *MyFoo) Say_hi(val director_enum.EnumDirectorHello) director_enum.EnumDirectorHello {
diff --git a/Examples/test-suite/go/director_exception_runme.go b/Examples/test-suite/go/director_exception_runme.go
index 55231ff..167d751 100644
--- a/Examples/test-suite/go/director_exception_runme.go
+++ b/Examples/test-suite/go/director_exception_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "director_exception"
+import . "swigtests/director_exception"
 
 type Exception struct {
 	msg string
diff --git a/Examples/test-suite/go/director_extend_runme.go b/Examples/test-suite/go/director_extend_runme.go
index 27e55b9..adfb6dd 100644
--- a/Examples/test-suite/go/director_extend_runme.go
+++ b/Examples/test-suite/go/director_extend_runme.go
@@ -5,7 +5,7 @@
 
 package main
 
-import . "director_extend"
+import . "swigtests/director_extend"
 
 func main() {
 	m := NewSpObject()
diff --git a/Examples/test-suite/go/director_finalizer_runme.go b/Examples/test-suite/go/director_finalizer_runme.go
index d36a4ba..5cd9d95 100644
--- a/Examples/test-suite/go/director_finalizer_runme.go
+++ b/Examples/test-suite/go/director_finalizer_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "director_finalizer"
+import . "swigtests/director_finalizer"
 
 type MyFoo struct{} // From Foo
 func DeleteMyFoo(p Foo) {
diff --git a/Examples/test-suite/go/director_frob_runme.go b/Examples/test-suite/go/director_frob_runme.go
index 3985eb1..7354fa7 100644
--- a/Examples/test-suite/go/director_frob_runme.go
+++ b/Examples/test-suite/go/director_frob_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "director_frob"
+import . "swigtests/director_frob"
 
 func main() {
 	foo := NewBravo()
diff --git a/Examples/test-suite/go/director_nested_runme.go b/Examples/test-suite/go/director_nested_runme.go
index a1193ad..b048935 100644
--- a/Examples/test-suite/go/director_nested_runme.go
+++ b/Examples/test-suite/go/director_nested_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "director_nested"
+import . "swigtests/director_nested"
 
 type A struct{} // From FooBar_int
 func (p *A) Do_step() string {
diff --git a/Examples/test-suite/go/director_profile_runme.go b/Examples/test-suite/go/director_profile_runme.go
index a9bc793..da0ea21 100644
--- a/Examples/test-suite/go/director_profile_runme.go
+++ b/Examples/test-suite/go/director_profile_runme.go
@@ -1,7 +1,7 @@
 package main
 
 import "fmt"
-import "director_profile"
+import "swigtests/director_profile"
 
 type MyB struct{} // From director_profile.B
 func (p *MyB) Vfi(a int) int {
diff --git a/Examples/test-suite/go/director_protected_runme.go b/Examples/test-suite/go/director_protected_runme.go
index bfd50c6..0012ccd 100644
--- a/Examples/test-suite/go/director_protected_runme.go
+++ b/Examples/test-suite/go/director_protected_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "director_protected"
+import . "swigtests/director_protected"
 
 type FooBar struct{} // From Bar
 func (p *FooBar) Ping() string {
diff --git a/Examples/test-suite/go/director_string_runme.go b/Examples/test-suite/go/director_string_runme.go
index f4f9cc1..0c73b6a 100644
--- a/Examples/test-suite/go/director_string_runme.go
+++ b/Examples/test-suite/go/director_string_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "director_string"
+import . "swigtests/director_string"
 
 type B struct { // From A
 	abi  A
diff --git a/Examples/test-suite/go/director_unroll_runme.go b/Examples/test-suite/go/director_unroll_runme.go
index 6a919f6..560034c 100644
--- a/Examples/test-suite/go/director_unroll_runme.go
+++ b/Examples/test-suite/go/director_unroll_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "director_unroll"
+import "swigtests/director_unroll"
 
 type MyFoo struct{} // From director_unroll.Foo
 func (p *MyFoo) Ping() string {
diff --git a/Examples/test-suite/go/disown_runme.go b/Examples/test-suite/go/disown_runme.go
index 4484515..ba072a8 100644
--- a/Examples/test-suite/go/disown_runme.go
+++ b/Examples/test-suite/go/disown_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "disown"
+import . "swigtests/disown"
 
 func main() {
 	a := NewA()
diff --git a/Examples/test-suite/go/dynamic_cast_runme.go b/Examples/test-suite/go/dynamic_cast_runme.go
index 46ba236..213bc0c 100644
--- a/Examples/test-suite/go/dynamic_cast_runme.go
+++ b/Examples/test-suite/go/dynamic_cast_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "dynamic_cast"
+import "swigtests/dynamic_cast"
 
 func main() {
 	f := dynamic_cast.NewFoo()
diff --git a/Examples/test-suite/go/empty_c_runme.go b/Examples/test-suite/go/empty_c_runme.go
index 1a1bd9c..f093103 100644
--- a/Examples/test-suite/go/empty_c_runme.go
+++ b/Examples/test-suite/go/empty_c_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import _ "empty_c"
+import _ "swigtests/empty_c"
 
 func main() {
 }
diff --git a/Examples/test-suite/go/empty_runme.go b/Examples/test-suite/go/empty_runme.go
index 681a6f3..03f423b 100644
--- a/Examples/test-suite/go/empty_runme.go
+++ b/Examples/test-suite/go/empty_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import _ "empty"
+import _ "swigtests/empty"
 
 func main() {
 }
diff --git a/Examples/test-suite/go/enum_template_runme.go b/Examples/test-suite/go/enum_template_runme.go
index c60a452..7f43eab 100644
--- a/Examples/test-suite/go/enum_template_runme.go
+++ b/Examples/test-suite/go/enum_template_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "enum_template"
+import "swigtests/enum_template"
 
 func main() {
 	if enum_template.MakeETest() != 1 {
diff --git a/Examples/test-suite/go/enums_runme.go b/Examples/test-suite/go/enums_runme.go
index 7a528b3..4a879a0 100644
--- a/Examples/test-suite/go/enums_runme.go
+++ b/Examples/test-suite/go/enums_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "enums"
+import "swigtests/enums"
 
 func main() {
 	enums.Bar2(1)
diff --git a/Examples/test-suite/go/exception_order_runme.go b/Examples/test-suite/go/exception_order_runme.go
index 21dcff3..ee67712 100644
--- a/Examples/test-suite/go/exception_order_runme.go
+++ b/Examples/test-suite/go/exception_order_runme.go
@@ -1,7 +1,7 @@
 package main
 
 import "strings"
-import . "exception_order"
+import . "swigtests/exception_order"
 
 func main() {
 	a := NewA()
diff --git a/Examples/test-suite/go/extend_placement_runme.go b/Examples/test-suite/go/extend_placement_runme.go
index 253ec66..8795896 100644
--- a/Examples/test-suite/go/extend_placement_runme.go
+++ b/Examples/test-suite/go/extend_placement_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "extend_placement"
+import "swigtests/extend_placement"
 
 func main() {
 	foo := extend_placement.NewFoo()
diff --git a/Examples/test-suite/go/extend_template_ns_runme.go b/Examples/test-suite/go/extend_template_ns_runme.go
index d005172..b1dd43a 100644
--- a/Examples/test-suite/go/extend_template_ns_runme.go
+++ b/Examples/test-suite/go/extend_template_ns_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "extend_template_ns"
+import . "swigtests/extend_template_ns"
 
 func main() {
 	f := NewFoo_One()
diff --git a/Examples/test-suite/go/extend_template_runme.go b/Examples/test-suite/go/extend_template_runme.go
index a5c4da4..4a6b709 100644
--- a/Examples/test-suite/go/extend_template_runme.go
+++ b/Examples/test-suite/go/extend_template_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "extend_template"
+import "swigtests/extend_template"
 
 func main() {
 	f := extend_template.NewFoo_0()
diff --git a/Examples/test-suite/go/extend_variable_runme.go b/Examples/test-suite/go/extend_variable_runme.go
index 9425aee..278bffe 100644
--- a/Examples/test-suite/go/extend_variable_runme.go
+++ b/Examples/test-suite/go/extend_variable_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "extend_variable"
+import . "swigtests/extend_variable"
 
 func main() {
 	if FooBar != 42 {
diff --git a/Examples/test-suite/go/extern_c_runme.go b/Examples/test-suite/go/extern_c_runme.go
index 9bc2cd0..1cbfd9d 100644
--- a/Examples/test-suite/go/extern_c_runme.go
+++ b/Examples/test-suite/go/extern_c_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "extern_c"
+import "swigtests/extern_c"
 
 func main() {
 	extern_c.RealFunction(2)
diff --git a/Examples/test-suite/go/friends_runme.go b/Examples/test-suite/go/friends_runme.go
index 2e34a4d..b6b9e93 100644
--- a/Examples/test-suite/go/friends_runme.go
+++ b/Examples/test-suite/go/friends_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "friends"
+import "swigtests/friends"
 
 func main() {
 	a := friends.NewA(2)
diff --git a/Examples/test-suite/go/fvirtual_runme.go b/Examples/test-suite/go/fvirtual_runme.go
index 86ef90f..01b94f4 100644
--- a/Examples/test-suite/go/fvirtual_runme.go
+++ b/Examples/test-suite/go/fvirtual_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "fvirtual"
+import . "swigtests/fvirtual"
 
 func main() {
 	sw := NewNodeSwitch()
diff --git a/Examples/test-suite/go/global_ns_arg_runme.go b/Examples/test-suite/go/global_ns_arg_runme.go
index e86aa67..aeacd91 100644
--- a/Examples/test-suite/go/global_ns_arg_runme.go
+++ b/Examples/test-suite/go/global_ns_arg_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "global_ns_arg"
+import . "swigtests/global_ns_arg"
 
 func main() {
 	Foo(1)
diff --git a/Examples/test-suite/go/go_director_inout_runme.go b/Examples/test-suite/go/go_director_inout_runme.go
index e6768a4..171b3c2 100644
--- a/Examples/test-suite/go/go_director_inout_runme.go
+++ b/Examples/test-suite/go/go_director_inout_runme.go
@@ -1,7 +1,7 @@
 package main
 
 import (
-	wrap "go_director_inout"
+	wrap "swigtests/go_director_inout"
 )
 
 type GoMyClass struct {}
diff --git a/Examples/test-suite/go/go_inout_runme.go b/Examples/test-suite/go/go_inout_runme.go
index 4599aa1..2dc5b99 100644
--- a/Examples/test-suite/go/go_inout_runme.go
+++ b/Examples/test-suite/go/go_inout_runme.go
@@ -5,7 +5,7 @@
 	"fmt"
 	"reflect"
 
-	"go_inout"
+	"swigtests/go_inout"
 )
 
 type S struct {
diff --git a/Examples/test-suite/go/grouping_runme.go b/Examples/test-suite/go/grouping_runme.go
index f808e12..d5f3475 100644
--- a/Examples/test-suite/go/grouping_runme.go
+++ b/Examples/test-suite/go/grouping_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "grouping"
+import "swigtests/grouping"
 
 func main() {
 	x := grouping.Test1(42)
diff --git a/Examples/test-suite/go/import_nomodule_runme.go b/Examples/test-suite/go/import_nomodule_runme.go
index 48592df..2368015 100644
--- a/Examples/test-suite/go/import_nomodule_runme.go
+++ b/Examples/test-suite/go/import_nomodule_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "import_nomodule"
+import . "swigtests/import_nomodule"
 
 func main() {
 	f := Create_Foo()
diff --git a/Examples/test-suite/go/inctest_runme.go b/Examples/test-suite/go/inctest_runme.go
index 3148abc..490721e 100644
--- a/Examples/test-suite/go/inctest_runme.go
+++ b/Examples/test-suite/go/inctest_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "inctest"
+import "swigtests/inctest"
 
 func main() {
 	inctest.NewA()
diff --git a/Examples/test-suite/go/inherit_member_runme.go b/Examples/test-suite/go/inherit_member_runme.go
index 6fd70cf..10dabad 100644
--- a/Examples/test-suite/go/inherit_member_runme.go
+++ b/Examples/test-suite/go/inherit_member_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import wrap "inherit_member"
+import wrap "swigtests/inherit_member"
 
 func main() {
 	s := wrap.NewChild()
diff --git a/Examples/test-suite/go/inherit_missing_runme.go b/Examples/test-suite/go/inherit_missing_runme.go
index c70c483..b4706e9 100644
--- a/Examples/test-suite/go/inherit_missing_runme.go
+++ b/Examples/test-suite/go/inherit_missing_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "inherit_missing"
+import "swigtests/inherit_missing"
 
 func main() {
 	a := inherit_missing.New_Foo()
diff --git a/Examples/test-suite/go/input_runme.go b/Examples/test-suite/go/input_runme.go
index ddc2992..c5eb9e4 100644
--- a/Examples/test-suite/go/input_runme.go
+++ b/Examples/test-suite/go/input_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "input"
+import . "swigtests/input"
 
 func main() {
 	f := NewFoo()
diff --git a/Examples/test-suite/go/keyword_rename_c_runme.go b/Examples/test-suite/go/keyword_rename_c_runme.go
index 26f2ea4..28f6ddd 100644
--- a/Examples/test-suite/go/keyword_rename_c_runme.go
+++ b/Examples/test-suite/go/keyword_rename_c_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "keyword_rename_c"
+import "swigtests/keyword_rename_c"
 
 func main() {
 	keyword_rename_c.Xgo(1)
diff --git a/Examples/test-suite/go/keyword_rename_runme.go b/Examples/test-suite/go/keyword_rename_runme.go
index 7a40ff8..f93c7ab 100644
--- a/Examples/test-suite/go/keyword_rename_runme.go
+++ b/Examples/test-suite/go/keyword_rename_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "keyword_rename"
+import "swigtests/keyword_rename"
 
 func main() {
 	keyword_rename.Xgo(1)
diff --git a/Examples/test-suite/go/li_attribute_runme.go b/Examples/test-suite/go/li_attribute_runme.go
index b502b8c..0702b89 100644
--- a/Examples/test-suite/go/li_attribute_runme.go
+++ b/Examples/test-suite/go/li_attribute_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "li_attribute"
+import "swigtests/li_attribute"
 
 func main() {
 	aa := li_attribute.NewA(1, 2, 3)
diff --git a/Examples/test-suite/go/li_carrays_cpp_runme.go b/Examples/test-suite/go/li_carrays_cpp_runme.go
index cfc1712..a96291c 100644
--- a/Examples/test-suite/go/li_carrays_cpp_runme.go
+++ b/Examples/test-suite/go/li_carrays_cpp_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "li_carrays_cpp"
+import . "swigtests/li_carrays_cpp"
 
 func main() {
 	d := NewDoubleArray(10)
diff --git a/Examples/test-suite/go/li_carrays_runme.go b/Examples/test-suite/go/li_carrays_runme.go
index 9128bbf..eefc6ad 100644
--- a/Examples/test-suite/go/li_carrays_runme.go
+++ b/Examples/test-suite/go/li_carrays_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "li_carrays"
+import . "swigtests/li_carrays"
 
 func main() {
 	d := NewDoubleArray(10)
diff --git a/Examples/test-suite/go/li_cdata_cpp_runme.go b/Examples/test-suite/go/li_cdata_cpp_runme.go
index daa5384..5849c50 100644
--- a/Examples/test-suite/go/li_cdata_cpp_runme.go
+++ b/Examples/test-suite/go/li_cdata_cpp_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "li_cdata_cpp"
+import . "swigtests/li_cdata_cpp"
 
 func main() {
 	s := "ABC abc"
diff --git a/Examples/test-suite/go/li_cdata_runme.go b/Examples/test-suite/go/li_cdata_runme.go
index 9458dab..0c3e591 100644
--- a/Examples/test-suite/go/li_cdata_runme.go
+++ b/Examples/test-suite/go/li_cdata_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "li_cdata"
+import . "swigtests/li_cdata"
 
 func main() {
 	s := "ABC abc"
diff --git a/Examples/test-suite/go/li_cmalloc_runme.go b/Examples/test-suite/go/li_cmalloc_runme.go
index 5b9f970..fb1b009 100644
--- a/Examples/test-suite/go/li_cmalloc_runme.go
+++ b/Examples/test-suite/go/li_cmalloc_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "li_cmalloc"
+import . "swigtests/li_cmalloc"
 
 func main() {
 	p := Malloc_int()
diff --git a/Examples/test-suite/go/li_cpointer_cpp_runme.go b/Examples/test-suite/go/li_cpointer_cpp_runme.go
index 0de57c6..f422b23 100644
--- a/Examples/test-suite/go/li_cpointer_cpp_runme.go
+++ b/Examples/test-suite/go/li_cpointer_cpp_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "li_cpointer_cpp"
+import . "swigtests/li_cpointer_cpp"
 
 func main() {
 	p := New_intp()
diff --git a/Examples/test-suite/go/li_cpointer_runme.go b/Examples/test-suite/go/li_cpointer_runme.go
index 0fe29e7..1a83bc6 100644
--- a/Examples/test-suite/go/li_cpointer_runme.go
+++ b/Examples/test-suite/go/li_cpointer_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "li_cpointer"
+import . "swigtests/li_cpointer"
 
 func main() {
 	p := New_intp()
diff --git a/Examples/test-suite/go/li_std_map_runme.go b/Examples/test-suite/go/li_std_map_runme.go
index 5c5cc2e..019ac6e 100644
--- a/Examples/test-suite/go/li_std_map_runme.go
+++ b/Examples/test-suite/go/li_std_map_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "li_std_map"
+import "swigtests/li_std_map"
 
 func main() {
 	a1 := li_std_map.NewA(3)
diff --git a/Examples/test-suite/go/li_std_vector_ptr_runme.go b/Examples/test-suite/go/li_std_vector_ptr_runme.go
index d66ff19..9a62d37 100644
--- a/Examples/test-suite/go/li_std_vector_ptr_runme.go
+++ b/Examples/test-suite/go/li_std_vector_ptr_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "li_std_vector_ptr"
+import . "swigtests/li_std_vector_ptr"
 import "fmt"
 
 func check(val1 int, val2 int) {
diff --git a/Examples/test-suite/go/member_pointer_runme.go b/Examples/test-suite/go/member_pointer_runme.go
index 731526b..0278938 100644
--- a/Examples/test-suite/go/member_pointer_runme.go
+++ b/Examples/test-suite/go/member_pointer_runme.go
@@ -3,7 +3,7 @@
 package main
 
 import "fmt"
-import . "member_pointer"
+import . "swigtests/member_pointer"
 
 func check(what string, expected float64, actual float64) {
 	if expected != actual {
diff --git a/Examples/test-suite/go/memberin_extend_c_runme.go b/Examples/test-suite/go/memberin_extend_c_runme.go
index 0551acc..696f08a 100644
--- a/Examples/test-suite/go/memberin_extend_c_runme.go
+++ b/Examples/test-suite/go/memberin_extend_c_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "memberin_extend_c"
+import "swigtests/memberin_extend_c"
 
 func main() {
 	t := memberin_extend_c.NewPerson()
diff --git a/Examples/test-suite/go/minherit_runme.go b/Examples/test-suite/go/minherit_runme.go
index 9b7873c..f1504af 100644
--- a/Examples/test-suite/go/minherit_runme.go
+++ b/Examples/test-suite/go/minherit_runme.go
@@ -1,7 +1,7 @@
 package main
 
 import "fmt"
-import "minherit"
+import "swigtests/minherit"
 
 func main() {
 	a := minherit.NewFoo()
diff --git a/Examples/test-suite/go/namespace_class_runme.go b/Examples/test-suite/go/namespace_class_runme.go
index 4c240b6..435ee86 100644
--- a/Examples/test-suite/go/namespace_class_runme.go
+++ b/Examples/test-suite/go/namespace_class_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "namespace_class"
+import . "swigtests/namespace_class"
 
 func main() {
 	EulerT3DToFrame(1, 1, 1)
diff --git a/Examples/test-suite/go/namespace_typemap_runme.go b/Examples/test-suite/go/namespace_typemap_runme.go
index 47e2b64..6da4333 100644
--- a/Examples/test-suite/go/namespace_typemap_runme.go
+++ b/Examples/test-suite/go/namespace_typemap_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "namespace_typemap"
+import . "swigtests/namespace_typemap"
 
 func main() {
 	if Stest1("hello") != "hello" {
diff --git a/Examples/test-suite/go/namespace_virtual_method_runme.go b/Examples/test-suite/go/namespace_virtual_method_runme.go
index a8cb38b..7ac4d33 100644
--- a/Examples/test-suite/go/namespace_virtual_method_runme.go
+++ b/Examples/test-suite/go/namespace_virtual_method_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "namespace_virtual_method"
+import "swigtests/namespace_virtual_method"
 
 func main() {
 	_ = namespace_virtual_method.NewSpam()
diff --git a/Examples/test-suite/go/naturalvar_runme.go b/Examples/test-suite/go/naturalvar_runme.go
index ed47e9d..458745e 100644
--- a/Examples/test-suite/go/naturalvar_runme.go
+++ b/Examples/test-suite/go/naturalvar_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "naturalvar"
+import . "swigtests/naturalvar"
 
 func main() {
 	f := NewFoo()
diff --git a/Examples/test-suite/go/nested_workaround_runme.go b/Examples/test-suite/go/nested_workaround_runme.go
index 8b31a7f..f42b487 100644
--- a/Examples/test-suite/go/nested_workaround_runme.go
+++ b/Examples/test-suite/go/nested_workaround_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "nested_workaround"
+import . "swigtests/nested_workaround"
 
 func main() {
 	inner := NewInner(5)
diff --git a/Examples/test-suite/go/overload_complicated_runme.go b/Examples/test-suite/go/overload_complicated_runme.go
index ce9d124..c238d97 100644
--- a/Examples/test-suite/go/overload_complicated_runme.go
+++ b/Examples/test-suite/go/overload_complicated_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "overload_complicated"
+import . "swigtests/overload_complicated"
 
 func main() {
 	var pInt *int
diff --git a/Examples/test-suite/go/overload_copy_runme.go b/Examples/test-suite/go/overload_copy_runme.go
index 55ec4a3..9815d76 100644
--- a/Examples/test-suite/go/overload_copy_runme.go
+++ b/Examples/test-suite/go/overload_copy_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "overload_copy"
+import . "swigtests/overload_copy"
 
 func main() {
 	f := NewFoo()
diff --git a/Examples/test-suite/go/overload_extend2_runme.go b/Examples/test-suite/go/overload_extend2_runme.go
index db79098..d549098 100644
--- a/Examples/test-suite/go/overload_extend2_runme.go
+++ b/Examples/test-suite/go/overload_extend2_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "overload_extend2"
+import "swigtests/overload_extend2"
 
 func main() {
 	f := overload_extend2.NewFoo()
diff --git a/Examples/test-suite/go/overload_extend_c_runme.go b/Examples/test-suite/go/overload_extend_c_runme.go
index 4d3b2b6..93b91d9 100644
--- a/Examples/test-suite/go/overload_extend_c_runme.go
+++ b/Examples/test-suite/go/overload_extend_c_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "overload_extend_c"
+import "swigtests/overload_extend_c"
 
 func main() {
 	f := overload_extend_c.NewFoo()
diff --git a/Examples/test-suite/go/overload_extend_runme.go b/Examples/test-suite/go/overload_extend_runme.go
index d73d6cf..c1435f3 100644
--- a/Examples/test-suite/go/overload_extend_runme.go
+++ b/Examples/test-suite/go/overload_extend_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "overload_extend"
+import "swigtests/overload_extend"
 
 func main() {
 	f := overload_extend.NewFoo()
diff --git a/Examples/test-suite/go/overload_polymorphic_runme.go b/Examples/test-suite/go/overload_polymorphic_runme.go
index 12b9777..6a4301f 100644
--- a/Examples/test-suite/go/overload_polymorphic_runme.go
+++ b/Examples/test-suite/go/overload_polymorphic_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "overload_polymorphic"
+import "swigtests/overload_polymorphic"
 
 func main(){
 	t := overload_polymorphic.NewDerived()
diff --git a/Examples/test-suite/go/overload_rename_runme.go b/Examples/test-suite/go/overload_rename_runme.go
index 3bd4a69..982b178 100644
--- a/Examples/test-suite/go/overload_rename_runme.go
+++ b/Examples/test-suite/go/overload_rename_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "overload_rename"
+import "swigtests/overload_rename"
 
 func main() {
 	_ = overload_rename.NewFoo(float32(1))
diff --git a/Examples/test-suite/go/overload_simple_runme.go b/Examples/test-suite/go/overload_simple_runme.go
index 3eb859b..23a80bf 100644
--- a/Examples/test-suite/go/overload_simple_runme.go
+++ b/Examples/test-suite/go/overload_simple_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "overload_simple"
+import . "swigtests/overload_simple"
 
 func main() {
 	if Foo(3) != "foo:int" {
diff --git a/Examples/test-suite/go/overload_subtype_runme.go b/Examples/test-suite/go/overload_subtype_runme.go
index 45d5a02..09f7a83 100644
--- a/Examples/test-suite/go/overload_subtype_runme.go
+++ b/Examples/test-suite/go/overload_subtype_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "overload_subtype"
+import . "swigtests/overload_subtype"
 
 func main() {
 	f := NewFoo()
diff --git a/Examples/test-suite/go/overload_template_fast_runme.go b/Examples/test-suite/go/overload_template_fast_runme.go
index 63809c0..3b348f3 100644
--- a/Examples/test-suite/go/overload_template_fast_runme.go
+++ b/Examples/test-suite/go/overload_template_fast_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "overload_template_fast"
+import . "swigtests/overload_template_fast"
 
 func main() {
 	_ = Foo()
diff --git a/Examples/test-suite/go/overload_template_runme.go b/Examples/test-suite/go/overload_template_runme.go
index f3a08ec..b85afb4 100644
--- a/Examples/test-suite/go/overload_template_runme.go
+++ b/Examples/test-suite/go/overload_template_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "overload_template"
+import . "swigtests/overload_template"
 
 func main() {
 	_ = Foo()
diff --git a/Examples/test-suite/go/preproc_runme.go b/Examples/test-suite/go/preproc_runme.go
index 3c55aae..8783054 100644
--- a/Examples/test-suite/go/preproc_runme.go
+++ b/Examples/test-suite/go/preproc_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "preproc"
+import "swigtests/preproc"
 
 func main() {
 	if preproc.GetEndif() != 1 {
diff --git a/Examples/test-suite/go/primitive_ref_runme.go b/Examples/test-suite/go/primitive_ref_runme.go
index a1de2f8..8dcf9f5 100644
--- a/Examples/test-suite/go/primitive_ref_runme.go
+++ b/Examples/test-suite/go/primitive_ref_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "primitive_ref"
+import . "swigtests/primitive_ref"
 
 func main() {
 	if Ref_int(3) != 3 {
diff --git a/Examples/test-suite/go/profiletest_runme.go b/Examples/test-suite/go/profiletest_runme.go
index c2b922b..68509f5 100644
--- a/Examples/test-suite/go/profiletest_runme.go
+++ b/Examples/test-suite/go/profiletest_runme.go
@@ -1,7 +1,7 @@
 package main
 
 import "fmt"
-import "profiletest"
+import "swigtests/profiletest"
 
 func main() {
 	a := profiletest.NewA()
diff --git a/Examples/test-suite/go/refcount_runme.go b/Examples/test-suite/go/refcount_runme.go
index 07d4072..76e30dd 100644
--- a/Examples/test-suite/go/refcount_runme.go
+++ b/Examples/test-suite/go/refcount_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "refcount"
+import . "swigtests/refcount"
 
 // very innocent example
 
diff --git a/Examples/test-suite/go/reference_global_vars_runme.go b/Examples/test-suite/go/reference_global_vars_runme.go
index 908358f..f8c1258 100644
--- a/Examples/test-suite/go/reference_global_vars_runme.go
+++ b/Examples/test-suite/go/reference_global_vars_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "reference_global_vars"
+import . "swigtests/reference_global_vars"
 
 func main() {
 	// const class reference variable
diff --git a/Examples/test-suite/go/rename_scope_runme.go b/Examples/test-suite/go/rename_scope_runme.go
index 13bd3f1..4ad7549 100644
--- a/Examples/test-suite/go/rename_scope_runme.go
+++ b/Examples/test-suite/go/rename_scope_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "rename_scope"
+import . "swigtests/rename_scope"
 
 func main() {
 	a := NewNatural_UP()
diff --git a/Examples/test-suite/go/rename_simple_runme.go b/Examples/test-suite/go/rename_simple_runme.go
index bd559ef..efe1edc 100644
--- a/Examples/test-suite/go/rename_simple_runme.go
+++ b/Examples/test-suite/go/rename_simple_runme.go
@@ -1,7 +1,7 @@
 package main
 
 import "fmt"
-import . "rename_simple"
+import . "swigtests/rename_simple"
 
 func main() {
 	s := NewNewStruct()
diff --git a/Examples/test-suite/go/rename_strip_encoder_runme.go b/Examples/test-suite/go/rename_strip_encoder_runme.go
index ae67060..74a0dba 100644
--- a/Examples/test-suite/go/rename_strip_encoder_runme.go
+++ b/Examples/test-suite/go/rename_strip_encoder_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "rename_strip_encoder"
+import . "swigtests/rename_strip_encoder"
 
 func main() {
 	_ = NewSomeWidget()
diff --git a/Examples/test-suite/go/ret_by_value_runme.go b/Examples/test-suite/go/ret_by_value_runme.go
index 9659d21..345868d 100644
--- a/Examples/test-suite/go/ret_by_value_runme.go
+++ b/Examples/test-suite/go/ret_by_value_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "ret_by_value"
+import "swigtests/ret_by_value"
 
 func main() {
 	a := ret_by_value.Get_test()
diff --git a/Examples/test-suite/go/return_const_value_runme.go b/Examples/test-suite/go/return_const_value_runme.go
index aadb126..fc6baa2 100644
--- a/Examples/test-suite/go/return_const_value_runme.go
+++ b/Examples/test-suite/go/return_const_value_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "return_const_value"
+import "swigtests/return_const_value"
 
 func main() {
 	p := return_const_value.Foo_ptrGetPtr()
diff --git a/Examples/test-suite/go/smart_pointer_extend_runme.go b/Examples/test-suite/go/smart_pointer_extend_runme.go
index a851e26..f91c9ac 100644
--- a/Examples/test-suite/go/smart_pointer_extend_runme.go
+++ b/Examples/test-suite/go/smart_pointer_extend_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "smart_pointer_extend"
+import . "swigtests/smart_pointer_extend"
 
 func main() {
 	f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_member_runme.go b/Examples/test-suite/go/smart_pointer_member_runme.go
index e7fe7c4..ca2ac2c 100644
--- a/Examples/test-suite/go/smart_pointer_member_runme.go
+++ b/Examples/test-suite/go/smart_pointer_member_runme.go
@@ -1,7 +1,7 @@
 package main
 
 import "fmt"
-import . "smart_pointer_member"
+import . "swigtests/smart_pointer_member"
 
 func main() {
 	f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_multi_runme.go b/Examples/test-suite/go/smart_pointer_multi_runme.go
index 7c76061..a8ec39f 100644
--- a/Examples/test-suite/go/smart_pointer_multi_runme.go
+++ b/Examples/test-suite/go/smart_pointer_multi_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "smart_pointer_multi"
+import . "swigtests/smart_pointer_multi"
 
 func main() {
 	f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_multi_typedef_runme.go b/Examples/test-suite/go/smart_pointer_multi_typedef_runme.go
index e584cf7..6bfd21e 100644
--- a/Examples/test-suite/go/smart_pointer_multi_typedef_runme.go
+++ b/Examples/test-suite/go/smart_pointer_multi_typedef_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "smart_pointer_multi_typedef"
+import . "swigtests/smart_pointer_multi_typedef"
 
 func main() {
 	f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_overload_runme.go b/Examples/test-suite/go/smart_pointer_overload_runme.go
index 9481554..c28ce61 100644
--- a/Examples/test-suite/go/smart_pointer_overload_runme.go
+++ b/Examples/test-suite/go/smart_pointer_overload_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "smart_pointer_overload"
+import . "swigtests/smart_pointer_overload"
 
 func main() {
 	f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_rename_runme.go b/Examples/test-suite/go/smart_pointer_rename_runme.go
index 44841f5..22c0eb1 100644
--- a/Examples/test-suite/go/smart_pointer_rename_runme.go
+++ b/Examples/test-suite/go/smart_pointer_rename_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "smart_pointer_rename"
+import . "swigtests/smart_pointer_rename"
 
 func main() {
 	f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_simple_runme.go b/Examples/test-suite/go/smart_pointer_simple_runme.go
index b468bd2..8a14dcf 100644
--- a/Examples/test-suite/go/smart_pointer_simple_runme.go
+++ b/Examples/test-suite/go/smart_pointer_simple_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "smart_pointer_simple"
+import . "swigtests/smart_pointer_simple"
 
 func main() {
 	f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_templatevariables_runme.go b/Examples/test-suite/go/smart_pointer_templatevariables_runme.go
index 6d4ea91..8f7102d 100644
--- a/Examples/test-suite/go/smart_pointer_templatevariables_runme.go
+++ b/Examples/test-suite/go/smart_pointer_templatevariables_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "smart_pointer_templatevariables"
+import . "swigtests/smart_pointer_templatevariables"
 
 func main() {
 	d := NewDiffImContainerPtr_D(Create(1234, 5678))
diff --git a/Examples/test-suite/go/smart_pointer_typedef_runme.go b/Examples/test-suite/go/smart_pointer_typedef_runme.go
index e89a8b1..5468a29 100644
--- a/Examples/test-suite/go/smart_pointer_typedef_runme.go
+++ b/Examples/test-suite/go/smart_pointer_typedef_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "smart_pointer_typedef"
+import . "swigtests/smart_pointer_typedef"
 
 func main() {
 	f := NewFoo()
diff --git a/Examples/test-suite/go/sneaky1_runme.go b/Examples/test-suite/go/sneaky1_runme.go
index 57c7797..c17f0ff 100644
--- a/Examples/test-suite/go/sneaky1_runme.go
+++ b/Examples/test-suite/go/sneaky1_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "sneaky1"
+import "swigtests/sneaky1"
 
 func main() {
 	_ = sneaky1.Add(3, 4)
diff --git a/Examples/test-suite/go/special_variable_macros_runme.go b/Examples/test-suite/go/special_variable_macros_runme.go
index 9338e65..597c487 100644
--- a/Examples/test-suite/go/special_variable_macros_runme.go
+++ b/Examples/test-suite/go/special_variable_macros_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "special_variable_macros"
+import "swigtests/special_variable_macros"
 
 func main() {
 	name := special_variable_macros.NewName()
diff --git a/Examples/test-suite/go/static_const_member_2_runme.go b/Examples/test-suite/go/static_const_member_2_runme.go
index ff8cbbb..7586eb4 100644
--- a/Examples/test-suite/go/static_const_member_2_runme.go
+++ b/Examples/test-suite/go/static_const_member_2_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "static_const_member_2"
+import . "swigtests/static_const_member_2"
 
 func main() {
 	_ = NewTest_int()
diff --git a/Examples/test-suite/go/struct_initialization_runme.go b/Examples/test-suite/go/struct_initialization_runme.go
index a815bd3..d5eb4e9 100644
--- a/Examples/test-suite/go/struct_initialization_runme.go
+++ b/Examples/test-suite/go/struct_initialization_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "struct_initialization"
+import . "swigtests/struct_initialization"
 
 func main() {
 	if GetInstanceC1().GetX() != 10 {
diff --git a/Examples/test-suite/go/struct_rename_runme.go b/Examples/test-suite/go/struct_rename_runme.go
index de99fc3..6d619e0 100644
--- a/Examples/test-suite/go/struct_rename_runme.go
+++ b/Examples/test-suite/go/struct_rename_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "struct_rename"
+import "swigtests/struct_rename"
 
 func main() {
 	_ = struct_rename.NewBar()
diff --git a/Examples/test-suite/go/struct_value_runme.go b/Examples/test-suite/go/struct_value_runme.go
index 3b5e5c1..c43a67a 100644
--- a/Examples/test-suite/go/struct_value_runme.go
+++ b/Examples/test-suite/go/struct_value_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "struct_value"
+import "swigtests/struct_value"
 
 func main() {
 	b := struct_value.NewBar()
diff --git a/Examples/test-suite/go/template_default_arg_runme.go b/Examples/test-suite/go/template_default_arg_runme.go
index d67e63f..9558c74 100644
--- a/Examples/test-suite/go/template_default_arg_runme.go
+++ b/Examples/test-suite/go/template_default_arg_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "template_default_arg"
+import "swigtests/template_default_arg"
 
 func main() {
 	helloInt := template_default_arg.NewHello_int()
diff --git a/Examples/test-suite/go/template_extend1_runme.go b/Examples/test-suite/go/template_extend1_runme.go
index 0912fa6..f2469ab 100644
--- a/Examples/test-suite/go/template_extend1_runme.go
+++ b/Examples/test-suite/go/template_extend1_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "template_extend1"
+import "swigtests/template_extend1"
 
 func main() {
 	a := template_extend1.NewLBaz()
diff --git a/Examples/test-suite/go/template_extend2_runme.go b/Examples/test-suite/go/template_extend2_runme.go
index ced3d93..c3669bc 100644
--- a/Examples/test-suite/go/template_extend2_runme.go
+++ b/Examples/test-suite/go/template_extend2_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "template_extend2"
+import "swigtests/template_extend2"
 
 func main() {
 	a := template_extend2.NewLBaz()
diff --git a/Examples/test-suite/go/template_inherit_runme.go b/Examples/test-suite/go/template_inherit_runme.go
index a8d5126..10071b1 100644
--- a/Examples/test-suite/go/template_inherit_runme.go
+++ b/Examples/test-suite/go/template_inherit_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "template_inherit"
+import . "swigtests/template_inherit"
 
 func main() {
 	a := NewFooInt()
diff --git a/Examples/test-suite/go/template_ns4_runme.go b/Examples/test-suite/go/template_ns4_runme.go
index 6c658ec..c1b356b 100644
--- a/Examples/test-suite/go/template_ns4_runme.go
+++ b/Examples/test-suite/go/template_ns4_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "template_ns4"
+import . "swigtests/template_ns4"
 
 func main() {
 	d := Make_Class_DD()
diff --git a/Examples/test-suite/go/template_ns_runme.go b/Examples/test-suite/go/template_ns_runme.go
index cfc56fa..e77c17b 100644
--- a/Examples/test-suite/go/template_ns_runme.go
+++ b/Examples/test-suite/go/template_ns_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "template_ns"
+import . "swigtests/template_ns"
 
 func main() {
 	p1 := NewPairii(2, 3)
diff --git a/Examples/test-suite/go/template_opaque_runme.go b/Examples/test-suite/go/template_opaque_runme.go
index 71701df..b3bf610 100644
--- a/Examples/test-suite/go/template_opaque_runme.go
+++ b/Examples/test-suite/go/template_opaque_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "template_opaque"
+import "swigtests/template_opaque"
 
 func main() {
 	v := template_opaque.NewOpaqueVectorType(int64(10))
diff --git a/Examples/test-suite/go/template_ref_type_runme.go b/Examples/test-suite/go/template_ref_type_runme.go
index a01ce3d..516b6c7 100644
--- a/Examples/test-suite/go/template_ref_type_runme.go
+++ b/Examples/test-suite/go/template_ref_type_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "template_ref_type"
+import "swigtests/template_ref_type"
 
 func main() {
 	xr := template_ref_type.NewXC()
diff --git a/Examples/test-suite/go/template_rename_runme.go b/Examples/test-suite/go/template_rename_runme.go
index 6e04f88..08cf3fb 100644
--- a/Examples/test-suite/go/template_rename_runme.go
+++ b/Examples/test-suite/go/template_rename_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "template_rename"
+import "swigtests/template_rename"
 
 func main() {
 	i := template_rename.NewIFoo()
diff --git a/Examples/test-suite/go/template_static_runme.go b/Examples/test-suite/go/template_static_runme.go
index f10ea78..205813d 100644
--- a/Examples/test-suite/go/template_static_runme.go
+++ b/Examples/test-suite/go/template_static_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "template_static"
+import . "swigtests/template_static"
 
 func main() {
 	FooBar_double(1)
diff --git a/Examples/test-suite/go/template_tbase_template_runme.go b/Examples/test-suite/go/template_tbase_template_runme.go
index e1c46aa..a483243 100644
--- a/Examples/test-suite/go/template_tbase_template_runme.go
+++ b/Examples/test-suite/go/template_tbase_template_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "template_tbase_template"
+import . "swigtests/template_tbase_template"
 
 func main() {
 	a := Make_Class_dd()
diff --git a/Examples/test-suite/go/template_type_namespace_runme.go b/Examples/test-suite/go/template_type_namespace_runme.go
index 1356f9b..562fae7 100644
--- a/Examples/test-suite/go/template_type_namespace_runme.go
+++ b/Examples/test-suite/go/template_type_namespace_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "template_type_namespace"
+import . "swigtests/template_type_namespace"
 
 func main() {
 	if Foo().Get(0) == "" {
diff --git a/Examples/test-suite/go/template_typedef_cplx3_runme.go b/Examples/test-suite/go/template_typedef_cplx3_runme.go
index 0a2b313..52a9bc7 100644
--- a/Examples/test-suite/go/template_typedef_cplx3_runme.go
+++ b/Examples/test-suite/go/template_typedef_cplx3_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "template_typedef_cplx3"
+import . "swigtests/template_typedef_cplx3"
 
 func main() {
 	// this is OK
diff --git a/Examples/test-suite/go/template_typedef_cplx4_runme.go b/Examples/test-suite/go/template_typedef_cplx4_runme.go
index d8952cf..84347e4 100644
--- a/Examples/test-suite/go/template_typedef_cplx4_runme.go
+++ b/Examples/test-suite/go/template_typedef_cplx4_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "template_typedef_cplx4"
+import . "swigtests/template_typedef_cplx4"
 
 func main() {
 	// this is OK
diff --git a/Examples/test-suite/go/threads_exception_runme.go b/Examples/test-suite/go/threads_exception_runme.go
index e3da1dc..b554f0e 100644
--- a/Examples/test-suite/go/threads_exception_runme.go
+++ b/Examples/test-suite/go/threads_exception_runme.go
@@ -1,7 +1,7 @@
 package main
 
 import "strings"
-import "threads_exception"
+import "swigtests/threads_exception"
 
 func main() {
 	t := threads_exception.NewTest()
diff --git a/Examples/test-suite/go/typedef_class_runme.go b/Examples/test-suite/go/typedef_class_runme.go
index d94126d..157a917 100644
--- a/Examples/test-suite/go/typedef_class_runme.go
+++ b/Examples/test-suite/go/typedef_class_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "typedef_class"
+import "swigtests/typedef_class"
 
 func main() {
 	a := typedef_class.NewRealA()
diff --git a/Examples/test-suite/go/typedef_funcptr_runme.go b/Examples/test-suite/go/typedef_funcptr_runme.go
index 9d55f3f..f76f088 100644
--- a/Examples/test-suite/go/typedef_funcptr_runme.go
+++ b/Examples/test-suite/go/typedef_funcptr_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "typedef_funcptr"
+import . "swigtests/typedef_funcptr"
 
 func main() {
 	a := 100
diff --git a/Examples/test-suite/go/typedef_inherit_runme.go b/Examples/test-suite/go/typedef_inherit_runme.go
index 7a65569..f2dbb32 100644
--- a/Examples/test-suite/go/typedef_inherit_runme.go
+++ b/Examples/test-suite/go/typedef_inherit_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "typedef_inherit"
+import "swigtests/typedef_inherit"
 
 func main() {
 	a := typedef_inherit.NewFoo()
diff --git a/Examples/test-suite/go/typedef_scope_runme.go b/Examples/test-suite/go/typedef_scope_runme.go
index af282b1..9c845bb 100644
--- a/Examples/test-suite/go/typedef_scope_runme.go
+++ b/Examples/test-suite/go/typedef_scope_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "typedef_scope"
+import "swigtests/typedef_scope"
 
 func main() {
 	b := typedef_scope.NewBar()
diff --git a/Examples/test-suite/go/typemap_namespace_runme.go b/Examples/test-suite/go/typemap_namespace_runme.go
index a2880d4..f086080 100644
--- a/Examples/test-suite/go/typemap_namespace_runme.go
+++ b/Examples/test-suite/go/typemap_namespace_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "typemap_namespace"
+import . "swigtests/typemap_namespace"
 
 func main() {
 	if Test1("hello") != "hello" {
diff --git a/Examples/test-suite/go/typemap_ns_using_runme.go b/Examples/test-suite/go/typemap_ns_using_runme.go
index c4c21cf..00e1131 100644
--- a/Examples/test-suite/go/typemap_ns_using_runme.go
+++ b/Examples/test-suite/go/typemap_ns_using_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "typemap_ns_using"
+import "swigtests/typemap_ns_using"
 
 func main() {
 	if typemap_ns_using.Spam(37) != 37 {
diff --git a/Examples/test-suite/go/typemap_out_optimal_runme.go b/Examples/test-suite/go/typemap_out_optimal_runme.go
index 7cc3b38..0cccd97 100644
--- a/Examples/test-suite/go/typemap_out_optimal_runme.go
+++ b/Examples/test-suite/go/typemap_out_optimal_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "typemap_out_optimal"
+import . "swigtests/typemap_out_optimal"
 
 func main() {
 	SetXXDebug(false)
diff --git a/Examples/test-suite/go/typename_runme.go b/Examples/test-suite/go/typename_runme.go
index d166509..1e1696d 100644
--- a/Examples/test-suite/go/typename_runme.go
+++ b/Examples/test-suite/go/typename_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "typename"
+import "swigtests/typename"
 
 func main() {
 	f := typename.NewFoo()
diff --git a/Examples/test-suite/go/unions_runme.go b/Examples/test-suite/go/unions_runme.go
index b76ca5c..6e29811 100644
--- a/Examples/test-suite/go/unions_runme.go
+++ b/Examples/test-suite/go/unions_runme.go
@@ -3,7 +3,7 @@
 
 package main
 
-import "unions"
+import "swigtests/unions"
 
 func main() {
 	// Create new instances of SmallStruct and BigStruct for later use
diff --git a/Examples/test-suite/go/using1_runme.go b/Examples/test-suite/go/using1_runme.go
index a6a6fa7..09cc381 100644
--- a/Examples/test-suite/go/using1_runme.go
+++ b/Examples/test-suite/go/using1_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "using1"
+import "swigtests/using1"
 
 func main() {
 	if using1.Spam(37) != 37 {
diff --git a/Examples/test-suite/go/using2_runme.go b/Examples/test-suite/go/using2_runme.go
index f6b8d49..8109037 100644
--- a/Examples/test-suite/go/using2_runme.go
+++ b/Examples/test-suite/go/using2_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "using2"
+import "swigtests/using2"
 
 func main() {
 	if using2.Spam(37) != 37 {
diff --git a/Examples/test-suite/go/using_composition_runme.go b/Examples/test-suite/go/using_composition_runme.go
index 712d1fa..7ef09fe 100644
--- a/Examples/test-suite/go/using_composition_runme.go
+++ b/Examples/test-suite/go/using_composition_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "using_composition"
+import . "swigtests/using_composition"
 
 func main() {
 	f := NewFooBar()
diff --git a/Examples/test-suite/go/using_extend_runme.go b/Examples/test-suite/go/using_extend_runme.go
index 27d1ccc..dac300b 100644
--- a/Examples/test-suite/go/using_extend_runme.go
+++ b/Examples/test-suite/go/using_extend_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "using_extend"
+import . "swigtests/using_extend"
 
 func main() {
 	f := NewFooBar()
diff --git a/Examples/test-suite/go/using_inherit_runme.go b/Examples/test-suite/go/using_inherit_runme.go
index a881718..c875590 100644
--- a/Examples/test-suite/go/using_inherit_runme.go
+++ b/Examples/test-suite/go/using_inherit_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "using_inherit"
+import . "swigtests/using_inherit"
 
 func main() {
 	b := NewBar()
diff --git a/Examples/test-suite/go/using_private_runme.go b/Examples/test-suite/go/using_private_runme.go
index 2da62dc..4c86ef5 100644
--- a/Examples/test-suite/go/using_private_runme.go
+++ b/Examples/test-suite/go/using_private_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "using_private"
+import . "swigtests/using_private"
 
 func main() {
 	f := NewFooBar()
diff --git a/Examples/test-suite/go/using_protected_runme.go b/Examples/test-suite/go/using_protected_runme.go
index 3fd5029..4310818 100644
--- a/Examples/test-suite/go/using_protected_runme.go
+++ b/Examples/test-suite/go/using_protected_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "using_protected"
+import . "swigtests/using_protected"
 
 func main() {
 	f := NewFooBar()
diff --git a/Examples/test-suite/go/varargs_overload_runme.go b/Examples/test-suite/go/varargs_overload_runme.go
index 8ce580d..50a4308 100644
--- a/Examples/test-suite/go/varargs_overload_runme.go
+++ b/Examples/test-suite/go/varargs_overload_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "varargs_overload"
+import "swigtests/varargs_overload"
 
 func main() {
 	if varargs_overload.Vararg_over1("Hello") != "Hello" {
diff --git a/Examples/test-suite/go/varargs_runme.go b/Examples/test-suite/go/varargs_runme.go
index 60bd882..eb2fa94 100644
--- a/Examples/test-suite/go/varargs_runme.go
+++ b/Examples/test-suite/go/varargs_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "varargs"
+import "swigtests/varargs"
 
 func main() {
 	if varargs.Test("Hello") != "Hello" {
diff --git a/Examples/test-suite/go/virtual_derivation_runme.go b/Examples/test-suite/go/virtual_derivation_runme.go
index 4e2c6e5..2113530 100644
--- a/Examples/test-suite/go/virtual_derivation_runme.go
+++ b/Examples/test-suite/go/virtual_derivation_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import . "virtual_derivation"
+import . "swigtests/virtual_derivation"
 
 // very innocent example
 
diff --git a/Examples/test-suite/go/virtual_poly_runme.go b/Examples/test-suite/go/virtual_poly_runme.go
index 32906b3..9973f24 100644
--- a/Examples/test-suite/go/virtual_poly_runme.go
+++ b/Examples/test-suite/go/virtual_poly_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "virtual_poly"
+import "swigtests/virtual_poly"
 
 func main() {
 	d := virtual_poly.NewNDouble(3.5)
diff --git a/Examples/test-suite/go/voidtest_runme.go b/Examples/test-suite/go/voidtest_runme.go
index 133545c..35c5289 100644
--- a/Examples/test-suite/go/voidtest_runme.go
+++ b/Examples/test-suite/go/voidtest_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "voidtest"
+import "swigtests/voidtest"
 
 func main() {
 	voidtest.Globalfunc()
diff --git a/Examples/test-suite/go/wrapmacro_runme.go b/Examples/test-suite/go/wrapmacro_runme.go
index a251a05..d792d4f 100644
--- a/Examples/test-suite/go/wrapmacro_runme.go
+++ b/Examples/test-suite/go/wrapmacro_runme.go
@@ -1,6 +1,6 @@
 package main
 
-import "wrapmacro"
+import "swigtests/wrapmacro"
 
 func main() {
 	a := 2
diff --git a/Examples/test-suite/java/CommentParser.java b/Examples/test-suite/java/CommentParser.java
index 7dc6d59..1fc6f64 100644
--- a/Examples/test-suite/java/CommentParser.java
+++ b/Examples/test-suite/java/CommentParser.java
@@ -1,5 +1,6 @@
 
-import com.sun.javadoc.*;
+import com.sun.source.doctree.*;
+import com.sun.source.util.DocTrees;
 import java.util.HashMap;
 import java.util.Map.Entry;
 import java.util.Map;
@@ -9,45 +10,120 @@
 import java.io.OutputStreamWriter;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.util.*;
+import java.util.spi.ToolProvider;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.lang.model.util.*;
+import jdk.javadoc.doclet.*;
 
 
-public class CommentParser {
+public class CommentParser implements Doclet {
     private static Map<String, String> m_parsedComments = new HashMap<String, String>();
 
-    public static boolean start(RootDoc root) {
+    // We need to implement these base class pure virtual methods.
 
+    @Override
+    public void init(Locale locale, Reporter reporter) {
+    }
+
+    @Override
+    public Set<? extends Option> getSupportedOptions() {
+        return new HashSet<>();
+    }
+
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    @Override
+    public String getName() {
+        return "CommentParser";
+    }
+
+    // Element name must be the fully qualified name of the element.
+    //
+    // If there is no comment associated with this element, simply do nothing.
+    private void storeCommentFor(DocTrees docTrees, String fullName, Element e) {
+        DocCommentTree docCommentTree = docTrees.getDocCommentTree(e);
+        if (docCommentTree == null)
+            return;
+
+        StringBuilder name = new StringBuilder(fullName);
+
+        // We must use signature in the key for methods for compatibility with
+        // the existing tests and to allow distinguishing between overloaded
+        // methods.
+        if (e instanceof ExecutableElement) {
+            ExecutableElement ex = (ExecutableElement)e;
+            name.append("(");
+
+            boolean firstParam = true;
+            for (VariableElement p : ex.getParameters()) {
+                if (firstParam) {
+                    firstParam = false;
+                } else {
+                    name.append(", ");
+                }
+
+                name.append(p.asType().toString());
+            }
+
+            name.append(")");
+        }
+
+        // For some reason the comment in the source is split into "body" and
+        // "block tags" parts, so we need to concatenate them back together.
+        StringBuilder comment = new StringBuilder();
+        for (DocTree d : docCommentTree.getFullBody()) {
+            comment.append(d.toString());
+            comment.append("\n");
+        }
+
+        boolean firstBlockTag = true;
+        for (DocTree d : docCommentTree.getBlockTags()) {
+            if (firstBlockTag) {
+                firstBlockTag = false;
+                comment.append("\n");
+            }
+
+            comment.append(d.toString());
+            comment.append("\n");
+        }
+
+        m_parsedComments.put(name.toString(), comment.toString());
+    }
+
+    @Override
+    public boolean run(DocletEnvironment docEnv) {
         /*
          * This method is called by 'javadoc' and gets the whole parsed java
          * file, we get comments and store them
          */
+        DocTrees docTrees = docEnv.getDocTrees();
+        for (TypeElement t : ElementFilter.typesIn(docEnv.getIncludedElements())) {
+            String typeName = t.getQualifiedName().toString();
 
-        for (ClassDoc classDoc : root.classes()) {
+            storeCommentFor(docTrees, typeName, t);
 
-            if (classDoc.getRawCommentText().length() > 0)
-                m_parsedComments.put(classDoc.qualifiedName(), classDoc.getRawCommentText());
+            for (Element e : t.getEnclosedElements()) {
+                // Omit the method name for ctors: this is a bit weird, but
+                // this is what the existing tests expect.
+                String fullName = typeName;
+                if (e.getKind() != ElementKind.CONSTRUCTOR) {
+                    fullName = fullName + "." + e.getSimpleName();
+                }
 
-            for (FieldDoc f : classDoc.enumConstants()) {
-                if (f.getRawCommentText().length() > 0)
-                    m_parsedComments.put(f.qualifiedName(), f.getRawCommentText());
-            }
-            for (FieldDoc f : classDoc.fields()) {
-                if (f.getRawCommentText().length() > 0)
-                    m_parsedComments.put(f.qualifiedName(), f.getRawCommentText());
-            }
-            for (ConstructorDoc c : classDoc.constructors()) {
-                if (c.getRawCommentText().length() > 0)
-                    m_parsedComments.put(c.toString(), c.getRawCommentText());
-            }
-            for (MethodDoc m : classDoc.methods()) {
-                if (m.getRawCommentText().length() > 0)
-                    m_parsedComments.put(m.toString(), m.getRawCommentText());
+                storeCommentFor(docTrees, fullName, e);
             }
         }
+
         return true;
     }
 
     
-    public int check(Map<String, String> wantedComments) {
+    public static int check(Map<String, String> wantedComments) {
         int errorCount=0;
         Iterator<Entry<String, String>> it = m_parsedComments.entrySet().iterator();
 
@@ -93,13 +169,14 @@
                 System.out.println("Output is also saved to files '" + expectedFileName +
                                    "' and '" + gotFileName + "'");
                 // here we print original strings, for nicer output
-                System.out.println("\n\n---\nexpected:\n" + wantedComments.get(e.getKey()));
+                System.out.println("\n\n---\nexpected:\n" + wantedStr);
                 System.out.println("\n\n---\ngot:\n" + e.getValue());
 
                 try {
                     // write expected string to file
                     BufferedWriter expectedFile = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(expectedFileName)));
-                    expectedFile.write(wantedComments.get(e.getKey()));
+                    if (wantedStr != null)
+                        expectedFile.write(wantedStr);
                     expectedFile.close();
 
                     // write translated string to file
@@ -130,7 +207,7 @@
     }
 
     
-    private void printKeys(Map<String, String> map) {
+    private static void printKeys(Map<String, String> map) {
         
         Set<String> keys = map.keySet();
         for (String key : keys) {
@@ -154,6 +231,15 @@
         }
     }
 
+    public static void parse(String sourcefile) {
+        ToolProvider javadoc = ToolProvider.findFirst("javadoc").orElseThrow();
+        int result = javadoc.run(System.out, System.err, new String[]{"-quiet", "-doclet", "CommentParser", sourcefile});
+        if (result != 0) {
+          System.err.println("Executing javadoc failed.");
+          System.exit(result);
+        }
+    }
+
     
     public static void main(String argv[]) {
 		
@@ -162,8 +248,7 @@
             System.exit(1);
         }
 		
-        com.sun.tools.javadoc.Main.execute("The comment parser program",
-                                           "CommentParser", new String[]{"-quiet", argv[0]});
+        parse(argv[0]);
 		
         // if we are run as standalone app, print the list of found comments as it would appear in java source
 		
diff --git a/Examples/test-suite/java/Makefile.in b/Examples/test-suite/java/Makefile.in
index 2e788fa..f8e290e 100644
--- a/Examples/test-suite/java/Makefile.in
+++ b/Examples/test-suite/java/Makefile.in
@@ -9,6 +9,7 @@
 JAVA_CLASSPATH_SEP = @JAVA_CLASSPATH_SEP@
 JAVA_TOOLS_JAR     = @JAVA_TOOLS_JAR@
 SCRIPTSUFFIX = _runme.java
+SKIP_DOXYGEN_TEST_CASES = @JAVA_SKIP_DOXYGEN_TEST_CASES@
 
 srcdir       = @srcdir@
 top_srcdir   = ../@top_srcdir@
@@ -108,13 +109,11 @@
 	  mkdir $(JAVA_PACKAGE);							  \
 	fi
 
-# Doxygen test cases need to be compiled together with the CommentParser class
-# which depends on com.sun.javadoc package which is located in this JAR.
+# Doxygen test cases need to be compiled together with the CommentParser class.
 CommentParser.class:
 	$(COMPILETOOL) $(JAVAC) -classpath $(JAVA_CLASSPATH) -d . $(srcdir)/CommentParser.java
 
 JAVA_CLASSPATH := .
-$(DOXYGEN_TEST_CASES:=.cpptest): JAVA_CLASSPATH := "$(JAVA_TOOLS_JAR)$(JAVA_CLASSPATH_SEP)."
 $(DOXYGEN_TEST_CASES:=.cpptest): CommentParser.class
 
 # Compiles java files then runs the testcase. A testcase is only run if
diff --git a/Examples/test-suite/java/doxygen_alias_runme.java b/Examples/test-suite/java/doxygen_alias_runme.java
index e21ed6d..98cd977 100644
--- a/Examples/test-suite/java/doxygen_alias_runme.java
+++ b/Examples/test-suite/java/doxygen_alias_runme.java
@@ -1,6 +1,5 @@
 
 import doxygen_alias.*;
-import com.sun.javadoc.*;
 import java.util.HashMap;
 
 public class doxygen_alias_runme {
@@ -15,10 +14,7 @@
 
   public static void main(String argv[])
   {
-    CommentParser parser = new CommentParser();
-    com.sun.tools.javadoc.Main.execute("doxygen_alias runtime test",
-                                       "CommentParser",
-                                       new String[]{"-quiet", "doxygen_alias"});
+    CommentParser.parse("doxygen_alias");
 
     HashMap<String, String> wantedComments = new HashMap<String, String>();
     wantedComments.put("doxygen_alias.doxygen_alias.make_something()",
@@ -27,6 +23,6 @@
       "     @return A new object which may be null.\n" +
       "");
 
-    System.exit(parser.check(wantedComments));
+    System.exit(CommentParser.check(wantedComments));
   }
 }
diff --git a/Examples/test-suite/java/doxygen_basic_notranslate_runme.java b/Examples/test-suite/java/doxygen_basic_notranslate_runme.java
index e3d9b02..621cc9e 100644
--- a/Examples/test-suite/java/doxygen_basic_notranslate_runme.java
+++ b/Examples/test-suite/java/doxygen_basic_notranslate_runme.java
@@ -1,6 +1,5 @@
 
 import doxygen_basic_notranslate.*;
-import com.sun.javadoc.*;
 import java.util.HashMap;
 
 public class doxygen_basic_notranslate_runme {
@@ -15,14 +14,7 @@
   
   public static void main(String argv[]) 
   {
-    /*
-      Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
-      and calls the start() method of that class with parsed information.
-    */
-    CommentParser parser = new CommentParser();
-    com.sun.tools.javadoc.Main.execute("doxygen_basic_notranslate runtime test",
-                                       "CommentParser",
-                                       new String[]{"-quiet", "doxygen_basic_notranslate"});
+    CommentParser.parse("doxygen_basic_notranslate");
 
     HashMap<String, String> wantedComments = new HashMap<String, String>();
     wantedComments.put("doxygen_basic_notranslate.doxygen_basic_notranslate.function3(int)",
@@ -97,6 +89,6 @@
     		"");
     
     // and ask the parser to check comments for us
-    System.exit(parser.check(wantedComments));
+    System.exit(CommentParser.check(wantedComments));
   }
 }
diff --git a/Examples/test-suite/java/doxygen_basic_translate_runme.java b/Examples/test-suite/java/doxygen_basic_translate_runme.java
index ab343b5..f0b1efb 100644
--- a/Examples/test-suite/java/doxygen_basic_translate_runme.java
+++ b/Examples/test-suite/java/doxygen_basic_translate_runme.java
@@ -1,6 +1,5 @@
 
 import doxygen_basic_translate.*;
-import com.sun.javadoc.*;
 import java.util.HashMap;
 
 public class doxygen_basic_translate_runme {
@@ -15,14 +14,7 @@
   
   public static void main(String argv[]) 
   {
-    /*
-      Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
-      and calls the start() method of that class with parsed information.
-    */
-    CommentParser parser = new CommentParser();
-    com.sun.tools.javadoc.Main.execute("doxygen_basic_translate runtime test",
-                                       "CommentParser",
-                                       new String[]{"-quiet", "doxygen_basic_translate"});
+    CommentParser.parse("doxygen_basic_translate");
 
     HashMap<String, String> wantedComments = new HashMap<String, String>();
     
@@ -96,6 +88,6 @@
     		"");
 
     // and ask the parser to check comments for us
-    System.exit(parser.check(wantedComments));
+    System.exit(CommentParser.check(wantedComments));
   }
 }
diff --git a/Examples/test-suite/java/doxygen_basic_translate_style2_runme.java b/Examples/test-suite/java/doxygen_basic_translate_style2_runme.java
index 05e51cf..28cf2da 100644
--- a/Examples/test-suite/java/doxygen_basic_translate_style2_runme.java
+++ b/Examples/test-suite/java/doxygen_basic_translate_style2_runme.java
@@ -1,6 +1,5 @@
 
 import doxygen_basic_translate_style2.*;
-import com.sun.javadoc.*;
 import java.util.HashMap;
 
 public class doxygen_basic_translate_style2_runme {
@@ -15,14 +14,7 @@
   
   public static void main(String argv[]) 
   {
-    /*
-      Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
-      and calls the start() method of that class with parsed information.
-    */
-    CommentParser parser = new CommentParser();
-    com.sun.tools.javadoc.Main.execute("doxygen_basic_translate_style2 runtime test",
-                                       "CommentParser",
-                                       new String[]{"-quiet", "doxygen_basic_translate_style2"});
+    CommentParser.parse("doxygen_basic_translate_style2");
 
     HashMap<String, String> wantedComments = new HashMap<String, String>();
     
@@ -96,6 +88,6 @@
     		"");
 
     // and ask the parser to check comments for us
-    System.exit(parser.check(wantedComments));
+    System.exit(CommentParser.check(wantedComments));
   }
 }
diff --git a/Examples/test-suite/java/doxygen_ignore_runme.java b/Examples/test-suite/java/doxygen_ignore_runme.java
index 6250ce5..29b6e06 100644
--- a/Examples/test-suite/java/doxygen_ignore_runme.java
+++ b/Examples/test-suite/java/doxygen_ignore_runme.java
@@ -1,6 +1,5 @@
 
 import doxygen_ignore.*;
-import com.sun.javadoc.*;
 import java.util.HashMap;
 
 public class doxygen_ignore_runme {
@@ -15,10 +14,7 @@
 
   public static void main(String argv[]) 
   {
-    CommentParser parser = new CommentParser();
-    com.sun.tools.javadoc.Main.execute("doxygen_ignore runtime test",
-                                       "CommentParser",
-                                       new String[]{"-quiet", "doxygen_ignore"});
+    CommentParser.parse("doxygen_ignore");
 
     HashMap<String, String> wantedComments = new HashMap<String, String>();
     wantedComments.put("doxygen_ignore.doxygen_ignore.func()",
@@ -39,6 +35,6 @@
       "\n" +
       "");
 
-    System.exit(parser.check(wantedComments));
+    System.exit(CommentParser.check(wantedComments));
   }
 }
diff --git a/Examples/test-suite/java/doxygen_misc_constructs_runme.java b/Examples/test-suite/java/doxygen_misc_constructs_runme.java
index 5d95bd5..b1f4e2e 100644
--- a/Examples/test-suite/java/doxygen_misc_constructs_runme.java
+++ b/Examples/test-suite/java/doxygen_misc_constructs_runme.java
@@ -1,6 +1,5 @@
 
 import doxygen_misc_constructs.*;
-import com.sun.javadoc.*;
 import java.util.HashMap;
 
 public class doxygen_misc_constructs_runme {
@@ -15,14 +14,7 @@
 
   public static void main(String argv[])
   {
-    /*
-      Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
-      and calls the start() method of that class with parsed information.
-    */
-    CommentParser parser = new CommentParser();
-    com.sun.tools.javadoc.Main.execute("doxygen_misc_constructs runtime test",
-                                       "CommentParser",
-                                       new String[]{"-quiet", "doxygen_misc_constructs"});
+    CommentParser.parse("doxygen_misc_constructs");
 
     HashMap<String, String> wantedComments = new HashMap<String, String>();
 
@@ -195,6 +187,6 @@
 
 
     // and ask the parser to check comments for us
-    System.exit(parser.check(wantedComments));
+    System.exit(CommentParser.check(wantedComments));
   }
 }
diff --git a/Examples/test-suite/java/doxygen_nested_class_runme.java b/Examples/test-suite/java/doxygen_nested_class_runme.java
index 3ffa796..e9d1a06 100644
--- a/Examples/test-suite/java/doxygen_nested_class_runme.java
+++ b/Examples/test-suite/java/doxygen_nested_class_runme.java
@@ -1,5 +1,4 @@
 import doxygen_nested_class.*;
-import com.sun.javadoc.*;
 import java.util.HashMap;
 
 public class doxygen_nested_class_runme {
@@ -14,14 +13,7 @@
 
   public static void main(String argv[]) 
   {
-    /*
-      Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
-      and calls the start() method of that class with parsed information.
-    */
-    CommentParser parser = new CommentParser();
-    com.sun.tools.javadoc.Main.execute("doxygen_nested_class runtime test",
-                                       "CommentParser",
-                                       new String[]{"-quiet", "doxygen_nested_class"});
+    CommentParser.parse("doxygen_nested_class");
 
     HashMap<String, String> wantedComments = new HashMap<String, String>();
     
@@ -43,6 +35,6 @@
     		" doxShort const variable ");
     
     // and ask the parser to check comments for us
-    System.exit(parser.check(wantedComments));
+    System.exit(CommentParser.check(wantedComments));
   }
 }
diff --git a/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java
index ef1f06a..6b1e2b0 100644
--- a/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java
+++ b/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java
@@ -1,6 +1,5 @@
 
 import doxygen_parsing_enums_proper.*;
-import com.sun.javadoc.*;
 import java.util.HashMap;
 
 public class doxygen_parsing_enums_proper_runme {
@@ -15,14 +14,7 @@
   
   public static void main(String argv[]) 
   {
-    /*
-      Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
-      and calls the start() method of that class with parsed information.
-    */
-    CommentParser parser = new CommentParser();
-    com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_proper runtime test",
-                                       "CommentParser",
-                                       new String[]{"-quiet", "doxygen_parsing_enums_proper"});
+    CommentParser.parse("doxygen_parsing_enums_proper");
 
     HashMap<String, String> wantedComments = new HashMap<String, String>();
     
@@ -61,6 +53,6 @@
     		"Post comment after last comma.");
     
     // and ask the parser to check comments for us
-    System.exit(parser.check(wantedComments));
+    System.exit(CommentParser.check(wantedComments));
   }
 }
diff --git a/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java
index 85ec0cb..1e0dd74 100644
--- a/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java
+++ b/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java
@@ -1,6 +1,5 @@
 
 import doxygen_parsing_enums_simple.*;
-import com.sun.javadoc.*;
 import java.util.HashMap;
 
 public class doxygen_parsing_enums_simple_runme {
@@ -15,14 +14,7 @@
   
   public static void main(String argv[]) 
   {
-    /*
-      Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
-      and calls the start() method of that class with parsed information.
-    */
-    CommentParser parser = new CommentParser();
-    com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_simple runtime test",
-                                       "CommentParser",
-                                       new String[]{"-quiet", "doxygen_parsing_enums_simple"});
+    CommentParser.parse("doxygen_parsing_enums_simple");
 
     HashMap<String, String> wantedComments = new HashMap<String, String>();
     
@@ -53,6 +45,6 @@
     		"Post comment after last comma.");
     
     // and ask the parser to check comments for us
-    System.exit(parser.check(wantedComments));
+    System.exit(CommentParser.check(wantedComments));
   }
 }
diff --git a/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java
index 4e5f4b4..7cf3b17 100644
--- a/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java
+++ b/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java
@@ -1,6 +1,5 @@
 
 import doxygen_parsing_enums_typesafe.*;
-import com.sun.javadoc.*;
 import java.util.HashMap;
 
 public class doxygen_parsing_enums_typesafe_runme {
@@ -15,14 +14,7 @@
   
   public static void main(String argv[]) 
   {
-    /*
-      Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
-      and calls the start() method of that class with parsed information.
-    */
-    CommentParser parser = new CommentParser();
-    com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_typesafe runtime test",
-                                       "CommentParser",
-                                       new String[]{"-quiet", "doxygen_parsing_enums_typesafe"});
+    CommentParser.parse("doxygen_parsing_enums_typesafe");
 
     HashMap<String, String> wantedComments = new HashMap<String, String>();
     
@@ -62,6 +54,6 @@
 
     
     // and ask the parser to check comments for us
-    System.exit(parser.check(wantedComments));
+    System.exit(CommentParser.check(wantedComments));
   }
 }
diff --git a/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java
index 4286491..3a41fe5 100644
--- a/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java
+++ b/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java
@@ -1,6 +1,5 @@
 
 import doxygen_parsing_enums_typeunsafe.*;
-import com.sun.javadoc.*;
 import java.util.HashMap;
 
 public class doxygen_parsing_enums_typeunsafe_runme {
@@ -15,14 +14,7 @@
   
   public static void main(String argv[]) 
   {
-    /*
-      Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
-      and calls the start() method of that class with parsed information.
-    */
-    CommentParser parser = new CommentParser();
-    com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_typeunsafe runtime test",
-                                       "CommentParser",
-                                       new String[]{"-quiet", "doxygen_parsing_enums_typeunsafe"});
+    CommentParser.parse("doxygen_parsing_enums_typeunsafe");
 
     HashMap<String, String> wantedComments = new HashMap<String, String>();
     
@@ -61,6 +53,6 @@
     		"Post comment after last comma.");
     
     // and ask the parser to check comments for us
-    System.exit(parser.check(wantedComments));
+    System.exit(CommentParser.check(wantedComments));
   }
 }
diff --git a/Examples/test-suite/java/doxygen_parsing_runme.java b/Examples/test-suite/java/doxygen_parsing_runme.java
index d58b1f4..10d65fc 100644
--- a/Examples/test-suite/java/doxygen_parsing_runme.java
+++ b/Examples/test-suite/java/doxygen_parsing_runme.java
@@ -1,6 +1,5 @@
 
 import doxygen_parsing.*;
-import com.sun.javadoc.*;
 import java.util.HashMap;
 
 public class doxygen_parsing_runme {
@@ -15,14 +14,7 @@
 
   public static void main(String argv[]) 
   {
-    /*
-      Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
-      and calls the start() method of that class with parsed information.
-    */
-    CommentParser parser = new CommentParser();
-    com.sun.tools.javadoc.Main.execute("doxygen_parsing runtime test",
-                                       "CommentParser",
-                                       new String[]{"-quiet", "doxygen_parsing"});
+    CommentParser.parse("doxygen_parsing");
 
     HashMap<String, String> wantedComments = new HashMap<String, String>();
     
@@ -136,6 +128,6 @@
     		"");
     
     // and ask the parser to check comments for us
-    System.exit(parser.check(wantedComments));
+    System.exit(CommentParser.check(wantedComments));
   }
 }
diff --git a/Examples/test-suite/java/doxygen_translate_all_tags_runme.java b/Examples/test-suite/java/doxygen_translate_all_tags_runme.java
index 1d61608..fda1fc3 100644
--- a/Examples/test-suite/java/doxygen_translate_all_tags_runme.java
+++ b/Examples/test-suite/java/doxygen_translate_all_tags_runme.java
@@ -1,6 +1,5 @@
 
 import doxygen_translate_all_tags.*;
-import com.sun.javadoc.*;
 import java.util.HashMap;
 
 public class doxygen_translate_all_tags_runme {
@@ -15,14 +14,7 @@
   
   public static void main(String argv[]) 
   {
-    /*
-      Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
-      and calls the start() method of that class with parsed information.
-    */
-    CommentParser parser = new CommentParser();
-    com.sun.tools.javadoc.Main.execute("doxygen_translate_all_tags runtime test",
-                                       "CommentParser",
-                                       new String[]{"-quiet", "doxygen_translate_all_tags"});
+    CommentParser.parse("doxygen_translate_all_tags");
 
     HashMap<String, String> wantedComments = new HashMap<String, String>();
     
@@ -157,6 +149,6 @@
     		" And here goes simple text \n" +
     		"");
     // and ask the parser to check comments for us
-    System.exit(parser.check(wantedComments));
+    System.exit(CommentParser.check(wantedComments));
   }
 }
diff --git a/Examples/test-suite/java/doxygen_translate_links_runme.java b/Examples/test-suite/java/doxygen_translate_links_runme.java
index 6d74e16..afee4ea 100644
--- a/Examples/test-suite/java/doxygen_translate_links_runme.java
+++ b/Examples/test-suite/java/doxygen_translate_links_runme.java
@@ -1,6 +1,5 @@
 
 import doxygen_translate_links.*;
-import com.sun.javadoc.*;
 import java.util.HashMap;
 
 public class doxygen_translate_links_runme {
@@ -15,14 +14,7 @@
   
   public static void main(String argv[]) 
   {
-    /*
-      Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
-      and calls the start() method of that class with parsed information.
-    */
-    CommentParser parser = new CommentParser();
-    com.sun.tools.javadoc.Main.execute("doxygen_translate_links runtime test",
-                                       "CommentParser",
-                                       new String[]{"-quiet", "doxygen_translate_links"});
+    CommentParser.parse("doxygen_translate_links");
 
     HashMap<String, String> wantedComments = new HashMap<String, String>();
     
@@ -64,6 +56,6 @@
     		"");
     
     // and ask the parser to check comments for us
-    System.exit(parser.check(wantedComments));
+    System.exit(CommentParser.check(wantedComments));
   }
 }
\ No newline at end of file
diff --git a/Examples/test-suite/java/doxygen_translate_runme.java b/Examples/test-suite/java/doxygen_translate_runme.java
index 55e5d23..b049a64 100644
--- a/Examples/test-suite/java/doxygen_translate_runme.java
+++ b/Examples/test-suite/java/doxygen_translate_runme.java
@@ -1,6 +1,5 @@
 
 import doxygen_translate.*;
-import com.sun.javadoc.*;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -16,14 +15,7 @@
   
   public static void main(String argv[]) 
   {
-    /*
-      Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
-      and calls the start() method of that class with parsed information.
-    */
-    CommentParser parser = new CommentParser();
-    com.sun.tools.javadoc.Main.execute("doxygen_translate runtime test",
-                                       "CommentParser",
-                                       new String[]{"-quiet", "doxygen_translate"});
+    CommentParser.parse("doxygen_translate");
 
     Map<String, String> wantedComments = new HashMap<String, String>();
     
@@ -274,6 +266,6 @@
                 "");
         
     // and ask the parser to check comments for us
-    System.exit(parser.check(wantedComments));
+    System.exit(CommentParser.check(wantedComments));
   }
 }
diff --git a/Examples/test-suite/javascript/native_directive_runme.js b/Examples/test-suite/javascript/native_directive_runme.js
new file mode 100644
index 0000000..5c1d69c
--- /dev/null
+++ b/Examples/test-suite/javascript/native_directive_runme.js
@@ -0,0 +1,9 @@
+var native_directive = require("native_directive");
+
+(function main() {
+  var s = "abc.DEF-123";
+  if (native_directive.CountAlphas(s) !== 6)
+    throw "CountAlphas failed";
+  if (native_directive.CountAlphaCharacters(s) !== 6)
+    throw "CountAlphaCharacters failed";
+})();
diff --git a/Examples/test-suite/kwargs_feature.i b/Examples/test-suite/kwargs_feature.i
index a8d1c38..2b662ca 100644
--- a/Examples/test-suite/kwargs_feature.i
+++ b/Examples/test-suite/kwargs_feature.i
@@ -100,3 +100,29 @@
 
   int foo_mm(int min = 1, int max = 2) {return min + max; }
 %}
+
+
+// Extended constructors
+%extend Extending0 {
+  Extending0() { return new Extending0(); }
+}
+%extend Extending1 {
+  Extending1(int one) { return new Extending1(); }
+}
+%extend Extending2 {
+  Extending2(int one, const char *two) { return new Extending2(); }
+}
+%extend ExtendingOptArgs1 {
+  ExtendingOptArgs1(int one = 0) { return new ExtendingOptArgs1(); }
+}
+%extend ExtendingOptArgs2 {
+  ExtendingOptArgs2(int one = 0, const char* two = NULL) { return new ExtendingOptArgs2(); }
+}
+
+%inline %{
+struct Extending0 {};
+struct Extending1 {};
+struct Extending2 {};
+struct ExtendingOptArgs1 {};
+struct ExtendingOptArgs2 {};
+%}
diff --git a/Examples/test-suite/li_std_containers_overload.i b/Examples/test-suite/li_std_containers_overload.i
new file mode 100644
index 0000000..5e7c28e
--- /dev/null
+++ b/Examples/test-suite/li_std_containers_overload.i
@@ -0,0 +1,33 @@
+%module li_std_containers_overload
+
+// Suppress warning that ought not to appear, but there is no easy fix
+%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) VectorOverload;
+
+%include <std_string.i>
+%include <std_vector.i>
+
+%inline %{
+struct X {};
+struct Y {};
+%}
+
+%template(VectorX) std::vector<X>;
+%template(VectorY) std::vector<Y>;
+%template(VectorString) std::vector<std::string>;
+%template(VectorInt) std::vector<int>;
+
+%inline %{
+using namespace std;
+string VectorOverload(vector<X> v) {
+  return "vector<X>";
+}
+string VectorOverload(vector<Y> v) {
+  return "vector<Y>";
+}
+string VectorOverload(vector<string> v) {
+  return "vector<string>";
+}
+string VectorOverload(vector<int> v) {
+  return "vector<int>";
+}
+%}
diff --git a/Examples/test-suite/native_directive.i b/Examples/test-suite/native_directive.i
index d08c9a9..9ae76e0 100644
--- a/Examples/test-suite/native_directive.i
+++ b/Examples/test-suite/native_directive.i
@@ -41,3 +41,62 @@
 %}
 #endif
 
+
+// TODO: C#
+// TODO: Python
+
+
+#ifdef SWIGJAVASCRIPT
+%native(CountAlphaCharacters) void JavaScript_alpha_count();
+%{
+#ifdef SWIG_V8_VERSION /* engine = node || v8 */
+
+static SwigV8ReturnValue JavaScript_alpha_count(const SwigV8Arguments &args) {
+  SWIGV8_HANDLESCOPE();
+  v8::Handle<v8::Value> jsresult;
+  char *arg1 = (char *)0;
+  int res1;
+  char *buf1 = 0;
+  int alloc1 = 0;
+  int result;
+  if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_alpha_count.");
+  res1 = SWIG_AsCharPtrAndSize(args[0], &buf1, NULL, &alloc1);
+  if (!SWIG_IsOK(res1))
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "alpha_count" "', argument " "1"" of type '" "char const *""'");
+  arg1 = reinterpret_cast< char * >(buf1);
+  result = (int)alpha_count((char const *)arg1);
+  jsresult = SWIG_From_int(static_cast< int >(result));
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  SWIGV8_RETURN(jsresult);
+fail:
+  SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+#else /* engine = jsc */
+
+static JSValueRef JavaScript_alpha_count(JSContextRef context, JSObjectRef function,
+  JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+  char *arg1 = (char *)0;
+  int res1;
+  char *buf1 = 0;
+  int alloc1 = 0;
+  int result;
+  JSValueRef jsresult;
+  if (argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments.");
+  res1 = SWIG_JSC_AsCharPtrAndSize(context, argv[0], &buf1, NULL, &alloc1);
+  if (!SWIG_IsOK(res1))
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "alpha_count" "', argument " "1"" of type '" "char const *""'");
+  arg1 = reinterpret_cast< char * >(buf1);
+  result = (int)alpha_count((char const *)arg1);
+  jsresult = SWIG_From_int  SWIG_JSC_FROM_CALL_ARGS(static_cast< int >(result));
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  return jsresult;
+fail:
+  return JSValueMakeUndefined(context);
+}
+
+#endif /* engine */
+%}
+#endif /* SWIGJAVASCRIPT */
+
diff --git a/Examples/test-suite/octave/li_std_containers_overload_runme.m b/Examples/test-suite/octave/li_std_containers_overload_runme.m
new file mode 100644
index 0000000..786d634
--- /dev/null
+++ b/Examples/test-suite/octave/li_std_containers_overload_runme.m
@@ -0,0 +1,37 @@
+# do not dump Octave core
+if exist("crash_dumps_octave_core", "builtin")
+  crash_dumps_octave_core(0);
+endif
+
+li_std_containers_overload
+
+function check(got, expected)
+  if (!strcmp(got, expected))
+    error("Failed check. '%s' != '%s'", got, expected)
+  endif
+end
+
+v = VectorX();
+check(VectorOverload(v), "vector<X>");
+
+v = VectorY();
+check(VectorOverload(v), "vector<Y>");
+
+v = VectorInt();
+check(VectorOverload(v), "vector<int>");
+
+v = VectorString();
+check(VectorOverload(v), "vector<string>");
+
+# TODO: Conversion from an Octave sequence not implemented yet
+# v = {X()};
+# check(VectorOverload(v), "vector<X>");
+
+# v = {Y()};
+# check(VectorOverload(v), "vector<Y>");
+
+# v = {1, 2, 3};
+# check(VectorOverload(v), "vector<int>");
+
+# v = {"aaa", "bbb", "ccc"};
+# check(VectorOverload(v), "vector<string>");
diff --git a/Examples/test-suite/python/cpp_parameters_runme.py b/Examples/test-suite/python/cpp_parameters_runme.py
new file mode 100644
index 0000000..99d14ad
--- /dev/null
+++ b/Examples/test-suite/python/cpp_parameters_runme.py
@@ -0,0 +1,296 @@
+from cpp_parameters import *
+
+# Testing correct and incorrect parameter counts being passed (kwargs and non-kwargs)
+# Note that the implementation depends a lot on whether zero, one, two or more args are being wrapped
+
+def is_python_fastproxy():
+    """Return True if SWIG is generating Python code using -fastproxy."""
+    import cpp_parameters
+    # Note: _swig_new_instance_method is only generated when using -fastproxy
+    return hasattr(cpp_parameters, "_swig_new_instance_method")
+
+# Zero parameters expected
+x = Zero()
+try:
+    x = Zero(z=0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+try:
+    x = Zero(0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+
+try:
+    x.zero(z=0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+try:
+    x.zero(0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+
+try:
+    Zero.stat_zero(z=0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+try:
+    Zero.stat_zero(0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+
+try:
+    global_zero(z=0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+try:
+    global_zero(0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+
+# One mandatory parameter expected
+x = One(1)
+try:
+    x = One(a=1, z=0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+try:
+    x = One(1, 0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+
+try:
+    x.one(a=1, z=0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+try:
+    x.one(1, 0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+
+try:
+    One.stat_one(a=1, z=0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+try:
+    One.stat_one(1, 0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+
+try:
+    global_one(a=1, z=0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+try:
+    global_one(1, 0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+
+# Two mandatory parameters expected
+x = Two(1, 2)
+try:
+    x = Two(a=1, b=2, z=0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+try:
+    x = Two(1, 2, 0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+
+try:
+    x.two(a=1, b=2, z=0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+try:
+    x.two(1, 2, 0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+
+try:
+    Two.stat_two(a=1, b=2, z=0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+try:
+    Two.stat_two(1, 2, 0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+
+try:
+    global_two(a=1, b=2, z=0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+try:
+    global_two(1, 2, 0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+
+# Single optional parameter expected
+x = Single(1)
+try:
+    x = Single(a=1, z=0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+try:
+    x = Single(1, 0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+
+try:
+    x.single(a=1, z=0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+try:
+    x.single(1, 0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+
+try:
+    Single.stat_single(a=1, z=0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+try:
+    Single.stat_single(1, 0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+
+try:
+    global_single(a=1, z=0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+try:
+    global_single(1, 0)
+    raise RuntimeError("Missed throw")
+except TypeError:
+    pass
+
+# Test that -builtin option throws TypeError if kwargs are used even when they look like they should work, kwargs are not supported unless using -keyword.
+# Also same for -fastproxy option except that kwargs are supported by default for constructors. TODO: Fix inconsistency.
+
+if is_python_builtin() or is_python_fastproxy():
+    # One mandatory parameter in API
+    x = One(1)
+    if is_python_fastproxy():
+        x = One(a=1)
+    else:
+        try:
+            x = One(a=1)
+            raise RuntimeError("Missed throw")
+        except TypeError:
+            pass
+    try:
+        x.one(a=1)
+        raise RuntimeError("Missed throw")
+    except TypeError:
+        pass
+    try:
+        One.stat_one(a=1)
+        raise RuntimeError("Missed throw")
+    except TypeError:
+        pass
+    try:
+        global_one(a=1)
+        raise RuntimeError("Missed throw")
+    except TypeError:
+        pass
+
+    # Two mandatory parameters in API
+    x = Two(1, 2)
+    if is_python_fastproxy():
+        x = Two(a=1, b=2)
+    else:
+        try:
+            x = Two(a=1, b=2)
+            raise RuntimeError("Missed throw")
+        except TypeError:
+            pass
+    try:
+        x.two(a=1, b=2)
+        raise RuntimeError("Missed throw")
+    except TypeError:
+        pass
+    try:
+        Two.stat_two(a=1, b=2)
+        raise RuntimeError("Missed throw")
+    except TypeError:
+        pass
+    try:
+        global_two(a=1, b=2)
+        raise RuntimeError("Missed throw")
+    except TypeError:
+        pass
+
+    # Single optional parameter in API
+    x = Single(1)
+    if is_python_fastproxy():
+        x = Single(a=1)
+    else:
+        try:
+            x = Single(a=1)
+            raise RuntimeError("Missed throw")
+        except TypeError:
+            pass
+    try:
+        x.single(a=1)
+        raise RuntimeError("Missed throw")
+    except TypeError:
+        pass
+    try:
+        Single.stat_single(a=1)
+        raise RuntimeError("Missed throw")
+    except TypeError:
+        pass
+    try:
+        global_single(a=1)
+        raise RuntimeError("Missed throw")
+    except TypeError:
+        pass
+
+else:
+    # Non-builtin should work as expected
+    # One mandatory parameter in API
+    x = One(a=1)
+    x.one(a=1)
+    One.stat_one(a=1)
+    global_one(a=1)
+
+    # Two mandatory parameters in API
+    x = Two(a=1, b=2)
+    x.two(a=1, b=2)
+    Two.stat_two(a=1, b=2)
+    global_two(a=1, b=2)
+
+    # Single optional parameter in API
+    x = Single(a=1)
+    x.single(a=1)
+    Single.stat_single(a=1)
+    global_single(a=1)
diff --git a/Examples/test-suite/python/kwargs_feature_runme.py b/Examples/test-suite/python/kwargs_feature_runme.py
index a2d4731..31d49d2 100644
--- a/Examples/test-suite/python/kwargs_feature_runme.py
+++ b/Examples/test-suite/python/kwargs_feature_runme.py
@@ -79,3 +79,46 @@
 
 if rfoo(x=11, n=22) != 11:
     raise RuntimeError
+
+# Extended constructors
+e = Extending0()
+e = Extending1(one=1)
+e = Extending1(1)
+e = Extending2(1, "two")
+e = Extending2(1, two="two")
+e = Extending2(two="two", one=1)
+e = ExtendingOptArgs1()
+e = ExtendingOptArgs1(1)
+e = ExtendingOptArgs2(one=1)
+e = ExtendingOptArgs2()
+e = ExtendingOptArgs2(one=1)
+e = ExtendingOptArgs2(two="two")
+e = ExtendingOptArgs2(two="two", one=1)
+
+# Invalid kwargs test
+h = Hello()
+try:
+    h = Hello(nonexistent=10)
+    raise RuntimeError("missed exception")
+except TypeError as e:
+    pass
+
+f = Foo(1)
+f = Foo(a=1)
+try:
+    f = Foo(nonexistent=10)
+    raise RuntimeError("missed exception")
+except TypeError as e:
+    pass
+
+try:
+    f = Foo(a=1, nonexistent=10)
+    raise RuntimeError("missed exception")
+except TypeError as e:
+    pass
+
+try:
+    f = Foo(1, nonexistent=10)
+    raise RuntimeError("missed exception")
+except TypeError as e:
+    pass
diff --git a/Examples/test-suite/python/li_std_containers_overload_runme.py b/Examples/test-suite/python/li_std_containers_overload_runme.py
new file mode 100644
index 0000000..dcb3835
--- /dev/null
+++ b/Examples/test-suite/python/li_std_containers_overload_runme.py
@@ -0,0 +1,29 @@
+from li_std_containers_overload import *
+
+def check(got, expected):
+    if got != expected:
+        raise RuntimeError("Failed check. '{}' != '{}'".format(got, expected))
+
+v = VectorX()
+check(VectorOverload(v), "vector<X>")
+
+v = VectorY()
+check(VectorOverload(v), "vector<Y>")
+
+v = VectorInt()
+check(VectorOverload(v), "vector<int>")
+
+v = VectorString()
+check(VectorOverload(v), "vector<string>")
+
+v = [X()]
+check(VectorOverload(v), "vector<X>")
+
+v = [Y()]
+check(VectorOverload(v), "vector<Y>")
+
+v = [1, 2, 3]
+check(VectorOverload(v), "vector<int>")
+
+v = ["aaa", "bbb", "ccc"]
+check(VectorOverload(v), "vector<string>")
diff --git a/Examples/test-suite/ruby/Makefile.in b/Examples/test-suite/ruby/Makefile.in
index d75cdb0..2c59029 100644
--- a/Examples/test-suite/ruby/Makefile.in
+++ b/Examples/test-suite/ruby/Makefile.in
@@ -23,6 +23,7 @@
 	li_std_wstring_inherit \
 	primitive_types \
 	ruby_alias_method \
+	ruby_global_immutable_vars_cpp \
 	ruby_keywords \
 	ruby_minherit_shared_ptr \
 	ruby_naming \
@@ -48,6 +49,7 @@
 	li_cstring \
 	ruby_alias_global_function \
 	ruby_alias_module_function \
+	ruby_global_immutable_vars \
 	ruby_manual_proxy \
 
 include $(srcdir)/../common.mk
@@ -57,6 +59,8 @@
 
 # Custom tests - tests with additional commandline options
 ruby_alias_global_function.ctest: SWIGOPT += -globalmodule
+ruby_global_immutable_vars.ctest: SWIGOPT += -globalmodule
+ruby_global_immutable_vars_cpp.cpptest: SWIGOPT += -globalmodule
 ruby_naming.cpptest: SWIGOPT += -autorename
 
 # Rules for the different types of tests
diff --git a/Examples/test-suite/ruby/global_immutable_vars_cpp_runme.rb b/Examples/test-suite/ruby/global_immutable_vars_cpp_runme.rb
new file mode 100644
index 0000000..7897f7d
--- /dev/null
+++ b/Examples/test-suite/ruby/global_immutable_vars_cpp_runme.rb
@@ -0,0 +1,48 @@
+#!/usr/bin/env ruby
+#
+# C++ version of global_immutable_vars_runme.rb
+#
+
+require 'swig_assert'
+
+require 'global_immutable_vars_cpp'
+
+# first check if all variables can be read
+swig_assert_each_line( <<EOF )
+Global_immutable_vars_cpp::default_mutable_var == 40
+Global_immutable_vars_cpp::global_immutable_var == 41
+Global_immutable_vars_cpp::specific_mutable_var == 42
+Global_immutable_vars_cpp::global_mutable_var == 43
+Global_immutable_vars_cpp::specific_immutable_var == 44
+EOF
+
+# check that all mutable variables can be modified
+swig_assert_each_line( <<EOF )
+Global_immutable_vars_cpp::default_mutable_var = 80
+Global_immutable_vars_cpp::default_mutable_var == 80
+Global_immutable_vars_cpp::specific_mutable_var = 82
+Global_immutable_vars_cpp::specific_mutable_var == 82
+Global_immutable_vars_cpp::global_mutable_var = 83
+Global_immutable_vars_cpp::global_mutable_var == 83
+EOF
+
+# now check that immutable variables cannot be modified
+had_exception = false
+begin
+  Global_immutable_vars_cpp::global_immutable_var = 81
+rescue NoMethodError => e
+  had_exception = true
+end
+swig_assert(had_exception, nil,
+            "Global_immutable_vars_cpp::global_immutable_var is writable (expected to be immutable)")
+
+had_exception = false
+begin
+  Global_immutable_vars_cpp::specific_immutable_var = 81
+rescue NoMethodError => e
+  had_exception = true
+end
+swig_assert(had_exception, nil,
+            "Global_immutable_vars_cpp::specific_immutable_var is writable (expected to be immutable)")
+
+swig_assert(Global_immutable_vars_cpp::check_values(80, 41, 82, 83, 44) == 1, nil, "Check values failed")
diff --git a/Examples/test-suite/ruby/global_immutable_vars_runme.rb b/Examples/test-suite/ruby/global_immutable_vars_runme.rb
new file mode 100644
index 0000000..ffbea27
--- /dev/null
+++ b/Examples/test-suite/ruby/global_immutable_vars_runme.rb
@@ -0,0 +1,52 @@
+#!/usr/bin/env ruby
+#
+# Here the proper generation of mutable and immutable variables is tested
+# in the target language.
+# Immutable variables do not have "<var>=" methods generated by SWIG,
+# therefore trying to assign these variables shall throw a NoMethodError
+# exception.
+#
+
+require 'swig_assert'
+
+require 'global_immutable_vars'
+
+# first check if all variables can be read
+swig_assert_each_line( <<EOF )
+Global_immutable_vars::default_mutable_var == 40
+Global_immutable_vars::global_immutable_var == 41
+Global_immutable_vars::specific_mutable_var == 42
+Global_immutable_vars::global_mutable_var == 43
+Global_immutable_vars::specific_immutable_var == 44
+EOF
+
+# check that all mutable variables can be modified
+swig_assert_each_line( <<EOF )
+Global_immutable_vars::default_mutable_var = 80
+Global_immutable_vars::default_mutable_var == 80
+Global_immutable_vars::specific_mutable_var = 82
+Global_immutable_vars::specific_mutable_var == 82
+Global_immutable_vars::global_mutable_var = 83
+Global_immutable_vars::global_mutable_var == 83
+EOF
+
+# now check that immutable variables cannot be modified
+had_exception = false
+begin
+  Global_immutable_vars::global_immutable_var = 81
+rescue NoMethodError => e
+  had_exception = true
+end
+swig_assert(had_exception, nil,
+            "Global_immutable_vars::global_immutable_var is writable (expected to be immutable)")
+
+had_exception = false
+begin
+  Global_immutable_vars::specific_immutable_var = 81
+rescue NoMethodError => e
+  had_exception = true
+end
+swig_assert(had_exception, nil,
+            "Global_immutable_vars::specific_immutable_var is writable (expected to be immutable)")
+
+swig_assert(Global_immutable_vars::check_values(80, 41, 82, 83, 44) == 1, nil, "Check values failed")
diff --git a/Examples/test-suite/ruby/li_std_containers_overload_runme.rb b/Examples/test-suite/ruby/li_std_containers_overload_runme.rb
new file mode 100644
index 0000000..913b611
--- /dev/null
+++ b/Examples/test-suite/ruby/li_std_containers_overload_runme.rb
@@ -0,0 +1,44 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+# 
+# 
+# 
+#
+
+require 'swig_assert'
+
+require 'li_std_containers_overload'
+
+include Li_std_containers_overload
+
+def check(got, expected)
+  if (got != expected)
+    raise RuntimeError, "Failed check. '#{got}' != '#{expected}'"
+  end
+end
+
+v = VectorX.new()
+check(VectorOverload(v), "vector<X>")
+
+v = VectorY.new()
+check(VectorOverload(v), "vector<Y>")
+
+v = VectorInt.new()
+check(VectorOverload(v), "vector<int>")
+
+v = VectorString.new()
+check(VectorOverload(v), "vector<string>")
+
+v = [X.new()]
+check(VectorOverload(v), "vector<X>")
+
+v = [Y.new()]
+check(VectorOverload(v), "vector<Y>")
+
+v = [1, 2, 3]
+check(VectorOverload(v), "vector<int>")
+
+v = ["aaa", "bbb", "ccc"]
+check(VectorOverload(v), "vector<string>")
diff --git a/Examples/test-suite/ruby/ruby_global_immutable_vars_cpp_runme.rb b/Examples/test-suite/ruby/ruby_global_immutable_vars_cpp_runme.rb
new file mode 100644
index 0000000..5523b59
--- /dev/null
+++ b/Examples/test-suite/ruby/ruby_global_immutable_vars_cpp_runme.rb
@@ -0,0 +1,48 @@
+#!/usr/bin/env ruby
+#
+# C++ version of ruby_global_immutable_vars_runme.rb.
+#
+
+require 'swig_assert'
+
+require 'ruby_global_immutable_vars_cpp'
+
+# first check if all variables can be read
+swig_assert_each_line( <<EOF )
+$default_mutable_var == 40
+$global_immutable_var == 41
+$specific_mutable_var == 42
+$global_mutable_var == 43
+$specific_immutable_var == 44
+EOF
+
+# check that all mutable variables can be modified
+swig_assert_each_line( <<EOF )
+$default_mutable_var = 80
+$default_mutable_var == 80
+$specific_mutable_var = 82
+$specific_mutable_var == 82
+$global_mutable_var = 83
+$global_mutable_var == 83
+EOF
+
+# now check that immutable variables cannot be modified
+had_exception = false
+begin
+  $global_immutable_var = 81
+rescue NameError => e
+  had_exception = true
+end
+swig_assert(had_exception, nil,
+            "$global_immutable_var is writable (expected to be immutable)")
+
+had_exception = false
+begin
+  $specific_immutable_var = 81
+rescue NameError => e
+  had_exception = true
+end
+swig_assert(had_exception, nil,
+            "$specific_immutable_var is writable (expected to be immutable)")
+
+swig_assert(check_values(80, 41, 82, 83, 44) == 1, nil, "Check values failed")
diff --git a/Examples/test-suite/ruby/ruby_global_immutable_vars_runme.rb b/Examples/test-suite/ruby/ruby_global_immutable_vars_runme.rb
new file mode 100644
index 0000000..45a8506
--- /dev/null
+++ b/Examples/test-suite/ruby/ruby_global_immutable_vars_runme.rb
@@ -0,0 +1,52 @@
+#!/usr/bin/env ruby
+#
+# This test program is similar to global_immutable_vars_runme.rb
+# with the difference that the global variables to check are also
+# Ruby global variables (SWIG Ruby option "-globalmodule").
+#
+# Immutable global variables shall throw a NameError exception.
+#
+
+require 'swig_assert'
+
+require 'ruby_global_immutable_vars'
+
+# first check if all variables can be read
+swig_assert_each_line( <<EOF )
+$default_mutable_var == 40
+$global_immutable_var == 41
+$specific_mutable_var == 42
+$global_mutable_var == 43
+$specific_immutable_var == 44
+EOF
+
+# check that all mutable variables can be modified
+swig_assert_each_line( <<EOF )
+$default_mutable_var = 80
+$default_mutable_var == 80
+$specific_mutable_var = 82
+$specific_mutable_var == 82
+$global_mutable_var = 83
+$global_mutable_var == 83
+EOF
+
+# now check that immutable variables cannot be modified
+had_exception = false
+begin
+  $global_immutable_var = 81
+rescue NameError => e
+  had_exception = true
+end
+swig_assert(had_exception, nil,
+            "$global_immutable_var is writable (expected to be immutable)")
+
+had_exception = false
+begin
+  $specific_immutable_var = 81
+rescue NameError => e
+  had_exception = true
+end
+swig_assert(had_exception, nil,
+            "$specific_immutable_var is writable (expected to be immutable)")
+
+swig_assert(check_values(80, 41, 82, 83, 44) == 1, nil, "Check values failed")
diff --git a/Examples/test-suite/ruby_global_immutable_vars.i b/Examples/test-suite/ruby_global_immutable_vars.i
new file mode 100644
index 0000000..6f067d2
--- /dev/null
+++ b/Examples/test-suite/ruby_global_immutable_vars.i
@@ -0,0 +1,34 @@
+%module ruby_global_immutable_vars
+
+// This copy of global_immutable_vars.i shall be compiled with the
+// SWIG Ruby option "-globalmodule" in order to check the code path
+// for registering global methods (in contrast to module methods).
+
+%inline %{
+  int default_mutable_var = 40;
+%}
+
+%immutable;
+%feature("immutable", "0") specific_mutable_var;
+
+%inline %{
+  int global_immutable_var = 41;
+  int specific_mutable_var = 42;
+%}
+
+%mutable;
+%immutable specific_immutable_var;
+%inline %{
+  int global_mutable_var = 43;
+  int specific_immutable_var = 44;
+
+  int check_values(int default_mutable, int global_immutable, int specific_mutable, int global_mutable, int specific_immutable) {
+    return
+      default_mutable    == default_mutable_var &&
+      global_immutable   == global_immutable_var &&
+      specific_mutable   == specific_mutable_var &&
+      global_mutable     == global_mutable_var &&
+      specific_immutable == specific_immutable_var;
+  }
+%}
+
diff --git a/Examples/test-suite/ruby_global_immutable_vars_cpp.i b/Examples/test-suite/ruby_global_immutable_vars_cpp.i
new file mode 100644
index 0000000..511390e
--- /dev/null
+++ b/Examples/test-suite/ruby_global_immutable_vars_cpp.i
@@ -0,0 +1,32 @@
+%module ruby_global_immutable_vars_cpp
+
+// C++ version of ruby_global_immutable_vars.i
+
+%inline %{
+  int default_mutable_var = 40;
+%}
+
+%immutable;
+%feature("immutable", "0") specific_mutable_var;
+
+%inline %{
+  int global_immutable_var = 41;
+  int specific_mutable_var = 42;
+%}
+
+%mutable;
+%immutable specific_immutable_var;
+%inline %{
+  int global_mutable_var = 43;
+  int specific_immutable_var = 44;
+
+  int check_values(int default_mutable, int global_immutable, int specific_mutable, int global_mutable, int specific_immutable) {
+    return
+      default_mutable    == default_mutable_var &&
+      global_immutable   == global_immutable_var &&
+      specific_mutable   == specific_mutable_var &&
+      global_mutable     == global_mutable_var &&
+      specific_immutable == specific_immutable_var;
+  }
+%}
+
diff --git a/Lib/java/javahead.swg b/Lib/java/javahead.swg
index 685bba1..2e10254 100644
--- a/Lib/java/javahead.swg
+++ b/Lib/java/javahead.swg
@@ -5,7 +5,7 @@
  * ----------------------------------------------------------------------------- */
 
 
-/* JNI function calls require different calling conventions for C and C++. These JCALL macros are used so 
+/* JNI function calls require different calling conventions for C and C++. These JCALL macros are used so
  * that the same typemaps can be used for generating code for both C and C++. The SWIG preprocessor can expand
  * the macros thereby generating the correct calling convention. It is thus essential that all typemaps that
  * use the macros are not within %{ %} brackets as they won't be run through the SWIG preprocessor. */
@@ -50,15 +50,16 @@
 %insert(runtime) %{
 /* Support for throwing Java exceptions */
 typedef enum {
-  SWIG_JavaOutOfMemoryError = 1, 
-  SWIG_JavaIOException, 
-  SWIG_JavaRuntimeException, 
+  SWIG_JavaOutOfMemoryError = 1,
+  SWIG_JavaIOException,
+  SWIG_JavaRuntimeException,
   SWIG_JavaIndexOutOfBoundsException,
   SWIG_JavaArithmeticException,
   SWIG_JavaIllegalArgumentException,
   SWIG_JavaNullPointerException,
   SWIG_JavaDirectorPureVirtual,
-  SWIG_JavaUnknownError
+  SWIG_JavaUnknownError,
+  SWIG_JavaIllegalStateException,
 } SWIG_JavaExceptionCodes;
 
 typedef struct {
@@ -80,6 +81,7 @@
     { SWIG_JavaNullPointerException, "java/lang/NullPointerException" },
     { SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" },
     { SWIG_JavaUnknownError,  "java/lang/UnknownError" },
+    { SWIG_JavaIllegalStateException, "java/lang/IllegalStateException" },
     { (SWIG_JavaExceptionCodes)0,  "java/lang/UnknownError" }
   };
   const SWIG_JavaExceptions_t *except_ptr = java_exceptions;
diff --git a/Lib/lua/luarun.swg b/Lib/lua/luarun.swg
index 9636cdc..bd764d6 100644
--- a/Lib/lua/luarun.swg
+++ b/Lib/lua/luarun.swg
@@ -289,7 +289,7 @@
 typedef struct {
   swig_type_info   *type;
   int     own;  /* 1 if owned & must be destroyed */
-  char data[1];       /* arbitrary amount of data */    
+  char data[1];       /* arbitrary amount of data */
 } swig_lua_rawdata;
 
 /* Common SWIG API */
@@ -341,7 +341,7 @@
 #define SWIG_isptrtype(L,I) (lua_isuserdata(L,I) || lua_isnil(L,I))
 
 #ifdef __cplusplus
-/* Special helper for member function pointers 
+/* Special helper for member function pointers
 it gets the address, casts it, then dereferences it */
 /*#define SWIG_mem_fn_as_voidptr(a)  (*((char**)&(a))) */
 #endif
@@ -444,7 +444,7 @@
           lua_pop(L,1); /*remove nil */
           lua_newtable(L);
           SWIG_Lua_elua_emulate_register(L,entry->value.value.table);
-        } 
+        }
         if(is_metatable) {
           assert(lua_istable(L,-1));
           lua_pushvalue(L,-1);
@@ -453,11 +453,11 @@
 
         break;
       case LUA_TUSERDATA:
-        if(entry->value.value.userdata.member) 
+        if(entry->value.value.userdata.member)
           SWIG_NewMemberObj(L,entry->value.value.userdata.pvalue,
               entry->value.value.userdata.lvalue,
               *(entry->value.value.userdata.ptype));
-        else 
+        else
           SWIG_NewPointerObj(L,entry->value.value.userdata.pvalue,
               *(entry->value.value.userdata.ptype),0);
         break;
@@ -502,7 +502,7 @@
   }
   assert(lua_gettop(L) == 2);
   return 1;
-  
+
 fail:
   lua_error(L);
   return 0;
@@ -520,7 +520,7 @@
   lua_pushcfunction(L, SWIG_Lua_emulate_elua_getmetatable);
   lua_rawset(L,-3);
   lua_pop(L,2);
-      
+
 }
 /* END OF REMOVE */
 
@@ -1039,17 +1039,11 @@
 {
 /*  there should be 1 param passed in
   (1) userdata (not the metatable) */
-  const char *className;
-  void* userData;
+  swig_lua_userdata* userData;
   assert(lua_isuserdata(L,1));  /* just in case */
-  userData = lua_touserdata(L,1); /* get the userdata address for later */
-  lua_getmetatable(L,1);    /* get the meta table */
-  assert(lua_istable(L,-1));  /* just in case */
+  userData = (swig_lua_userdata*)lua_touserdata(L,1); /* get the userdata address */
 
-  lua_getfield(L, -1, ".type");
-  className = lua_tostring(L, -1);
-
-  lua_pushfstring(L, "<%s userdata: %p>", className, userData);
+  lua_pushfstring(L, "<userdata of type '%s' at %p>", userData->type->str, userData->ptr);
   return 1;
 }
 
@@ -1061,7 +1055,7 @@
   swig_lua_userdata *usr;
   assert(lua_isuserdata(L,-1));  /* just in case */
   usr=(swig_lua_userdata*)lua_touserdata(L,-1);  /* get it */
-  
+
   usr->own = 0; /* clear our ownership */
   return 0;
 }
@@ -1170,7 +1164,7 @@
 Each class structure has a list of pointers to the base class structures.
 This function fills them.
 It cannot be done at compile time, as this will not work with hireachies
-spread over more than one swig file. 
+spread over more than one swig file.
 Therefore it must be done at runtime, querying the SWIG type system.
 */
 SWIGINTERN void SWIG_Lua_init_base_class(lua_State *L,swig_lua_class *clss)
@@ -1404,11 +1398,11 @@
 
   lua_checkstack(L,5);
   numargs = lua_gettop(L); /* number of arguments to pass to actual metamethod */
-  
+
   /* Get upvalues from closure */
   lua_pushvalue(L, lua_upvalueindex(1)); /*Get function name*/
   metamethod_name_idx = lua_gettop(L);
-  
+
   lua_pushvalue(L, lua_upvalueindex(2));
   clss = (const swig_lua_class*)(lua_touserdata(L,-1));
   lua_pop(L,1); /* remove lightuserdata with clss from stack */
@@ -1440,7 +1434,7 @@
 
   /* metamethod name - on the top of the stack */
   assert(lua_isstring(L,-1));
-  
+
   key_index = lua_gettop(L);
 
   /* Check whether method is already defined in metatable */
@@ -1450,7 +1444,7 @@
     lua_pop(L,1);
     return -1;
   }
-  lua_pop(L,1); 
+  lua_pop(L,1);
 
   /* Iterating over immediate bases */
   for(i=0;clss->bases[i];i++)
@@ -1460,13 +1454,13 @@
     lua_pushvalue(L, key_index);
     lua_rawget(L, -2);
     if( !lua_isnil(L,-1) ) {
-      lua_pushvalue(L, key_index); 
+      lua_pushvalue(L, key_index);
 
       /* Add proxy function */
       lua_pushvalue(L, key_index); /* first closure value is function name */
       lua_pushlightuserdata(L, clss); /* second closure value is swig_lua_class structure */
       lua_pushcclosure(L, SWIG_Lua_resolve_metamethod, 2);
-      
+
       lua_rawset(L, metatable_index);
       success = 1;
     }
@@ -1477,7 +1471,7 @@
       break;
   }
 
-  return success; 
+  return success;
 }
 
 SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class *clss)
@@ -1816,7 +1810,7 @@
   memcpy(raw->data,ptr,size); /* copy the data */
   SWIG_Lua_AddMetatable(L,type); /* add metatable */
 }
-    
+
 /* converts a packed userdata. user for member fn pointers only */
 SWIGRUNTIME int  SWIG_Lua_ConvertPacked(lua_State *L,int index,void *ptr,size_t size,swig_type_info *type)
 {
@@ -1915,7 +1909,7 @@
 In lua 5.0.X it's lua_dostring()
 In lua 5.1.X it's luaL_dostring()
 */
-SWIGINTERN int 
+SWIGINTERN int
 SWIG_Lua_dostring(lua_State *L, const char *str) {
   int ok,top;
   if (str==0 || str[0]==0) return 0; /* nothing to do */
@@ -1930,7 +1924,7 @@
   }
   lua_settop(L,top); /* restore the stack */
   return ok;
-}    
+}
 
 #ifdef __cplusplus
 }
diff --git a/Lib/ocaml/carray.i b/Lib/ocaml/carray.i
index 5e74c3d..4378f73 100644
--- a/Lib/ocaml/carray.i
+++ b/Lib/ocaml/carray.i
@@ -77,7 +77,7 @@
 
 %typemap(out) SWIGTYPE [] {
     int i;
-    CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
+    const CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
     $result = caml_array_new($1_dim0);
 
     for( i = 0; i < $1_dim0; i++ ) {
diff --git a/Lib/ocaml/ocaml.swg b/Lib/ocaml/ocaml.swg
index ac496bd..afb01da 100644
--- a/Lib/ocaml/ocaml.swg
+++ b/Lib/ocaml/ocaml.swg
@@ -62,7 +62,7 @@
 
 #if 0
 %typemap(argout) SWIGTYPE & {
-    CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
+    const CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
     if( fromval ) {
 	swig_result =
 	    caml_list_append(swig_result,
@@ -75,7 +75,7 @@
     }
 }
 %typemap(argout) SWIGTYPE && {
-    CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
+    const CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
     if( fromval ) {
 	swig_result =
 	    caml_list_append(swig_result,
diff --git a/Lib/ocaml/ocamlrun.swg b/Lib/ocaml/ocamlrun.swg
index 3d552cc..5a923c5 100644
--- a/Lib/ocaml/ocamlrun.swg
+++ b/Lib/ocaml/ocamlrun.swg
@@ -407,7 +407,7 @@
 	    CAMLreturn((long)SWIG_Int64_val(SWIG_Field(SWIG_Field(v,0),0)));
 	case C_enum: {
 	    SWIG_CAMLlocal1(ret);
-	    CAML_VALUE *enum_to_int = caml_named_value(SWIG_MODULE "_enum_to_int");
+	    const CAML_VALUE *enum_to_int = caml_named_value(SWIG_MODULE "_enum_to_int");
 	    if( !name ) caml_failwith( "Not an enum conversion" );
 	    ret = caml_callback2(*enum_to_int,*caml_named_value(name),v);
 	    CAMLreturn(caml_long_val(ret));
@@ -451,7 +451,7 @@
 	CAMLparam1(v);
 	void *outptr = NULL;
         swig_type_info *outdescr = NULL;
-        static CAML_VALUE *func_val = NULL;
+        static const CAML_VALUE *func_val = NULL;
 
 	if( v == Val_unit ) {
 	    *out = 0;
@@ -574,7 +574,7 @@
         CAMLparam0();
         SWIG_CAMLlocal1(result);
 
-        CAML_VALUE *fromval = caml_named_value(name);
+        const CAML_VALUE *fromval = caml_named_value(name);
         if (fromval) {
             result = caml_callback(*fromval, caml_val_ptr(ptr, descriptor));
         } else {
diff --git a/Lib/octave/octcontainer.swg b/Lib/octave/octcontainer.swg
index 269ff75..310a849 100644
--- a/Lib/octave/octcontainer.swg
+++ b/Lib/octave/octcontainer.swg
@@ -401,20 +401,14 @@
       return const_reference(_seq, n);
     }
 
-    bool check(bool set_err = true) const
+    bool check() const
     {
       int s = size();
       for (int i = 0; i < s; ++i) {
 	//	swig::SwigVar_PyObject item = OctSequence_GetItem(_seq, i);
 	octave_value item; // * todo
-	if (!swig::check<value_type>(item)) {
-	  if (set_err) {
-	    char msg[1024];
-	    sprintf(msg, "in sequence element %d", i);
-	    SWIG_Error(SWIG_RuntimeError, msg);
-	  }
+	if (!swig::check<value_type>(item))
 	  return false;
-	}
       }
       return true;
     }
diff --git a/Lib/octave/octrun.swg b/Lib/octave/octrun.swg
index ff614e6..325a4cc 100644
--- a/Lib/octave/octrun.swg
+++ b/Lib/octave/octrun.swg
@@ -507,10 +507,10 @@
 	delete this;
     }
 
-    long swig_this() const {
+    size_t swig_this() const {
       if (!types.size())
-	return (long) this;
-      return (long) types[0].second.ptr;
+	return (size_t) this;
+      return (size_t) types[0].second.ptr;
     }
     const char* help_text() const {
       if (!types.size())
diff --git a/Lib/python/builtin.swg b/Lib/python/builtin.swg
index 28051e6..5308748 100644
--- a/Lib/python/builtin.swg
+++ b/Lib/python/builtin.swg
@@ -256,6 +256,12 @@
 #if PY_VERSION_HEX >= 0x03040000
       0,                                        /* tp_finalize */
 #endif
+#if PY_VERSION_HEX >= 0x03080000
+      0,                                        /* tp_vectorcall */
+#endif
+#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
+      0,                                        /* tp_print */
+#endif
 #ifdef COUNT_ALLOCS
       0,                                        /* tp_allocs */
       0,                                        /* tp_frees */
@@ -334,6 +340,12 @@
 #if PY_VERSION_HEX >= 0x03040000
       0,                                        /* tp_finalize */
 #endif
+#if PY_VERSION_HEX >= 0x03080000
+      0,                                        /* tp_vectorcall */
+#endif
+#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
+      0,                                        /* tp_print */
+#endif
 #ifdef COUNT_ALLOCS
       0,                                        /* tp_allocs */
       0,                                        /* tp_frees */
diff --git a/Lib/python/pycontainer.swg b/Lib/python/pycontainer.swg
index ef2f725..a7cc605 100644
--- a/Lib/python/pycontainer.swg
+++ b/Lib/python/pycontainer.swg
@@ -69,8 +69,7 @@
     static bool back_reference(PyObject* child, PyObject* owner) {
       SwigPyObject* swigThis = SWIG_Python_GetSwigThis(child);
       if (swigThis && (swigThis->own & SWIG_POINTER_OWN) != SWIG_POINTER_OWN) {
-        PyObject_SetAttr(child, container_owner_attribute(), owner);
-        return true;
+        return PyObject_SetAttr(child, container_owner_attribute(), owner) != -1;
       }
       return false;
     }
@@ -672,19 +671,13 @@
       return const_reference(_seq, n);
     }
 
-    bool check(bool set_err = true) const
+    bool check() const
     {
       Py_ssize_t s = size();
       for (Py_ssize_t i = 0; i < s; ++i) {
 	swig::SwigVar_PyObject item = PySequence_GetItem(_seq, i);
-	if (!swig::check<value_type>(item)) {
-	  if (set_err) {
-	    char msg[1024];
-	    sprintf(msg, "in sequence element %d", (int)i);
-	    SWIG_Error(SWIG_RuntimeError, msg);
-	  }
+	if (!swig::check<value_type>(item))
 	  return false;
-	}
       }
       return true;
     }
diff --git a/Lib/python/pyinit.swg b/Lib/python/pyinit.swg
index dfbf40b..a6d609d 100644
--- a/Lib/python/pyinit.swg
+++ b/Lib/python/pyinit.swg
@@ -186,6 +186,12 @@
 #if PY_VERSION_HEX >= 0x03040000
       0,                                  /* tp_finalize */
 #endif
+#if PY_VERSION_HEX >= 0x03080000
+      0,                                  /* tp_vectorcall */
+#endif
+#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
+      0,                                  /* tp_print */
+#endif
 #ifdef COUNT_ALLOCS
       0,                                  /* tp_allocs */
       0,                                  /* tp_frees */
diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg
index 445a1e3..d6eeda9 100644
--- a/Lib/python/pyrun.swg
+++ b/Lib/python/pyrun.swg
@@ -183,6 +183,19 @@
   }
 }
 
+SWIGINTERN int
+SWIG_Python_CheckNoKeywords(PyObject *kwargs, const char *name) {
+  int no_kwargs = 1;
+  if (kwargs) {
+    assert(PyDict_Check(kwargs));
+    if (PyDict_Size(kwargs) > 0) {
+      PyErr_Format(PyExc_TypeError, "%s() does not take keyword arguments", name);
+      no_kwargs = 0;
+    }
+  }
+  return no_kwargs;
+}
+
 /* A functor is a function object with one single object argument */
 #define SWIG_Python_CallFunctor(functor, obj)	        PyObject_CallFunctionObjArgs(functor, obj, NULL);
 
@@ -696,6 +709,12 @@
 #if PY_VERSION_HEX >= 0x03040000
       0,                                    /* tp_finalize */
 #endif
+#if PY_VERSION_HEX >= 0x03080000
+      0,                                    /* tp_vectorcall */
+#endif
+#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
+      0,                                    /* tp_print */
+#endif
 #ifdef COUNT_ALLOCS
       0,                                    /* tp_allocs */
       0,                                    /* tp_frees */
@@ -857,6 +876,12 @@
 #if PY_VERSION_HEX >= 0x03040000
       0,                                    /* tp_finalize */
 #endif
+#if PY_VERSION_HEX >= 0x03080000
+      0,                                    /* tp_vectorcall */
+#endif
+#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
+      0,                                    /* tp_print */
+#endif
 #ifdef COUNT_ALLOCS
       0,                                    /* tp_allocs */
       0,                                    /* tp_frees */
@@ -1183,8 +1208,10 @@
 	}
       }
 #else
-      PyObject *key = SWIG_This();
-      PyObject_SetAttr(inst, key, swig_this);
+      if (PyObject_SetAttr(inst, SWIG_This(), swig_this) == -1) {
+        Py_DECREF(inst);
+        inst = 0;
+      }
 #endif
     }
   } else {
@@ -1196,8 +1223,12 @@
         inst = ((PyTypeObject *)data->newargs)->tp_new((PyTypeObject *)data->newargs, empty_args, empty_kwargs);
         Py_DECREF(empty_kwargs);
         if (inst) {
-          PyObject_SetAttr(inst, SWIG_This(), swig_this);
-          Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
+          if (PyObject_SetAttr(inst, SWIG_This(), swig_this) == -1) {
+            Py_DECREF(inst);
+            inst = 0;
+          } else {
+            Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
+          }
         }
       }
       Py_DECREF(empty_args);
diff --git a/Lib/python/std_map.i b/Lib/python/std_map.i
index 8ae483c..e0b7d69 100644
--- a/Lib/python/std_map.i
+++ b/Lib/python/std_map.i
@@ -101,7 +101,7 @@
 %#endif
 	  res = traits_asptr_stdseq<map_type, std::pair<K, T> >::asptr(items, val);
 	} else {
-	  map_type *p;
+	  map_type *p = 0;
 	  swig_type_info *descriptor = swig::type_info<map_type>();
 	  res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
 	  if (SWIG_IsOK(res) && val)  *val = p;
diff --git a/Lib/python/std_multimap.i b/Lib/python/std_multimap.i
index f78a527..bbffb6b 100644
--- a/Lib/python/std_multimap.i
+++ b/Lib/python/std_multimap.i
@@ -29,7 +29,7 @@
 %#endif
 	  res = traits_asptr_stdseq<std::multimap<K,T>, std::pair<K, T> >::asptr(items, val);
 	} else {
-	  multimap_type *p;
+	  multimap_type *p = 0;
 	  swig_type_info *descriptor = swig::type_info<multimap_type>();
 	  res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
 	  if (SWIG_IsOK(res) && val)  *val = p;
diff --git a/Lib/python/std_pair.i b/Lib/python/std_pair.i
index 172572b..cf463cb 100644
--- a/Lib/python/std_pair.i
+++ b/Lib/python/std_pair.i
@@ -47,7 +47,7 @@
 	    res = get_pair(first, second, val);
 	  }
 	} else {
-	  value_type *p;
+	  value_type *p = 0;
 	  swig_type_info *descriptor = swig::type_info<value_type>();
 	  res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
 	  if (SWIG_IsOK(res) && val)  *val = *p;
@@ -104,7 +104,7 @@
 	    res = get_pair(first, second, val);
 	  }
 	} else {
-	  value_type *p;
+	  value_type *p = 0;
 	  swig_type_info *descriptor = swig::type_info<value_type>();
 	  res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
 	  if (SWIG_IsOK(res) && val)  *val = p;
diff --git a/Lib/python/std_unordered_map.i b/Lib/python/std_unordered_map.i
index 042d5b6..784be4c 100644
--- a/Lib/python/std_unordered_map.i
+++ b/Lib/python/std_unordered_map.i
@@ -87,7 +87,7 @@
 %#endif
 	  res = traits_asptr_stdseq<std::unordered_map<K,T,Hash,Compare,Alloc>, std::pair<K, T> >::asptr(items, val);
 	} else {
-	  unordered_map_type *p;
+	  unordered_map_type *p = 0;
 	  swig_type_info *descriptor = swig::type_info<unordered_map_type>();
 	  res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
 	  if (SWIG_IsOK(res) && val)  *val = p;
diff --git a/Lib/python/std_unordered_multimap.i b/Lib/python/std_unordered_multimap.i
index 2811404..bc095ea 100644
--- a/Lib/python/std_unordered_multimap.i
+++ b/Lib/python/std_unordered_multimap.i
@@ -36,7 +36,7 @@
 %#endif
 	  res = traits_asptr_stdseq<std::unordered_multimap<K,T,Hash,Compare,Alloc>, std::pair<K, T> >::asptr(items, val);
 	} else {
-	  unordered_multimap_type *p;
+	  unordered_multimap_type *p = 0;
 	  swig_type_info *descriptor = swig::type_info<unordered_multimap_type>();
 	  res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
 	  if (SWIG_IsOK(res) && val)  *val = p;
diff --git a/Lib/ruby/rubyclasses.swg b/Lib/ruby/rubyclasses.swg
index f7b51bd..b345fce 100644
--- a/Lib/ruby/rubyclasses.swg
+++ b/Lib/ruby/rubyclasses.swg
@@ -174,7 +174,7 @@
       return rb_inspect(_obj);
     }
 
-    static VALUE swig_rescue_swallow(VALUE)
+    static VALUE swig_rescue_swallow(VALUE, VALUE)
     {
       /*
       VALUE errstr = rb_obj_as_string(rb_errinfo());
@@ -203,8 +203,8 @@
         args.id     = op_id;
         args.nargs  = 1;
         args.target = VALUE(other);
-        ret = rb_rescue(RUBY_METHOD_FUNC(swig_rescue_funcall), VALUE(&args),
-                       (RUBY_METHOD_FUNC(swig_rescue_swallow)), Qnil);
+        ret = rb_rescue(VALUEFUNC(swig_rescue_funcall), VALUE(&args),
+                       (VALUEFUNC(swig_rescue_swallow)), Qnil);
       }
       if (ret == Qnil) {
         VALUE a = rb_funcall(         _obj, hash_id, 0 );
@@ -243,8 +243,8 @@
       args.id     = op_id;
       args.nargs  = 0;
       args.target = Qnil;
-      ret = rb_rescue(RUBY_METHOD_FUNC(swig_rescue_funcall), VALUE(&args),
-                     (RUBY_METHOD_FUNC(swig_rescue_swallow)), Qnil);
+      ret = rb_rescue(VALUEFUNC(swig_rescue_funcall), VALUE(&args),
+                     (VALUEFUNC(swig_rescue_swallow)), Qnil);
       SWIG_RUBY_THREAD_END_BLOCK;
       return ret;
     }
@@ -262,8 +262,8 @@
       args.id     = op_id;
       args.nargs  = 1;
       args.target = VALUE(other);
-      ret = rb_rescue(RUBY_METHOD_FUNC(swig_rescue_funcall), VALUE(&args),
-                     (RUBY_METHOD_FUNC(swig_rescue_swallow)), Qnil);
+      ret = rb_rescue(VALUEFUNC(swig_rescue_funcall), VALUE(&args),
+                     (VALUEFUNC(swig_rescue_swallow)), Qnil);
       SWIG_RUBY_THREAD_END_BLOCK;
       return GC_VALUE(ret);
     }
diff --git a/Lib/ruby/rubycontainer.swg b/Lib/ruby/rubycontainer.swg
index e8830a7..9fa205b 100644
--- a/Lib/ruby/rubycontainer.swg
+++ b/Lib/ruby/rubycontainer.swg
@@ -395,19 +395,13 @@
       return const_reference(_seq, n);
     }
 
-    bool check(bool set_err = false) const
+    bool check() const
     {
       int s = (int) size();
       for (int i = 0; i < s; ++i) {
 	VALUE item = rb_ary_entry(_seq, i );
-	if (!swig::check<value_type>(item)) {
-	  if (set_err) {
-	    char msg[1024];
-	    sprintf(msg, "in sequence element %d", i);
-	    SWIG_Error(SWIG_RuntimeError, msg);
-	  }
+	if (!swig::check<value_type>(item))
 	  return false;
-	}
       }
       return true;
     }
diff --git a/Lib/ruby/rubyhead.swg b/Lib/ruby/rubyhead.swg
index 90f07cf..bf4e362 100644
--- a/Lib/ruby/rubyhead.swg
+++ b/Lib/ruby/rubyhead.swg
@@ -98,38 +98,46 @@
 
 
 /*
- * Need to be very careful about how these macros are defined, especially
- * when compiling C++ code or C code with an ANSI C compiler.
+ * The following macros are used for providing the correct type of a
+ * function pointer to the Ruby C API.
+ * Starting with Ruby 2.7 (corresponding to RB_METHOD_DEFINITION_DECL being
+ * defined) these macros act transparently due to Ruby's moving away from
+ * ANYARGS and instead employing strict function signatures.
  *
- * VALUEFUNC(f) is a macro used to typecast a C function that implements
- * a Ruby method so that it can be passed as an argument to API functions
- * like rb_define_method() and rb_define_singleton_method().
+ * Note: In case of C (not C++) the macros are transparent even before
+ * Ruby 2.7 due to the fact that the Ruby C API used function declarators
+ * with empty parentheses, which allows for an unspecified number of
+ * arguments.
  *
- * VOIDFUNC(f) is a macro used to typecast a C function that implements
- * either the "mark" or "free" stuff for a Ruby Data object, so that it
- * can be passed as an argument to API functions like Data_Wrap_Struct()
+ * PROTECTFUNC(f) is used for the function pointer argument of the Ruby
+ * C API function rb_protect().
+ *
+ * VALUEFUNC(f) is used for the function pointer argument(s) of Ruby C API
+ * functions like rb_define_method() and rb_define_singleton_method().
+ *
+ * VOIDFUNC(f) is used to typecast a C function that implements either
+ * the "mark" or "free" stuff for a Ruby Data object, so that it can be
+ * passed as an argument to Ruby C API functions like Data_Wrap_Struct()
  * and Data_Make_Struct().
+ *
+ * SWIG_RUBY_VOID_ANYARGS_FUNC(f) is used for the function pointer
+ * argument(s) of Ruby C API functions like rb_define_virtual_variable().
+ *
+ * SWIG_RUBY_INT_ANYARGS_FUNC(f) is used for the function pointer
+ * argument(s) of Ruby C API functions like st_foreach().
  */
- 
-#ifdef __cplusplus
-#  ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
-#    define PROTECTFUNC(f) ((VALUE (*)()) f)
-#    define VALUEFUNC(f) ((VALUE (*)()) f)
-#    define VOIDFUNC(f)  ((void (*)()) f)
-#  else
-#    ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
-#      define PROTECTFUNC(f) ((VALUE (*)()) f)
-#      define VALUEFUNC(f) ((VALUE (*)()) f)
-#      define VOIDFUNC(f)  ((RUBY_DATA_FUNC) f)
-#    else /* These definitions should work for Ruby 1.7+ */
-#      define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
-#      define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
-#      define VOIDFUNC(f)  ((RUBY_DATA_FUNC) f)
-#    endif
-#  endif
+#if defined(__cplusplus) && !defined(RB_METHOD_DEFINITION_DECL)
+#  define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
+#  define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
+#  define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
+#  define SWIG_RUBY_VOID_ANYARGS_FUNC(f) ((void (*)(ANYARGS))(f))
+#  define SWIG_RUBY_INT_ANYARGS_FUNC(f) ((int (*)(ANYARGS))(f))
 #else
+#  define PROTECTFUNC(f) (f)
 #  define VALUEFUNC(f) (f)
 #  define VOIDFUNC(f) (f)
+#  define SWIG_RUBY_VOID_ANYARGS_FUNC(f) (f)
+#  define SWIG_RUBY_INT_ANYARGS_FUNC(f) (f)
 #endif
 
 /* Don't use for expressions have side effect */
diff --git a/Lib/ruby/rubyprimtypes.swg b/Lib/ruby/rubyprimtypes.swg
index 3a84819..4b078de 100644
--- a/Lib/ruby/rubyprimtypes.swg
+++ b/Lib/ruby/rubyprimtypes.swg
@@ -10,15 +10,16 @@
 %fragment("SWIG_ruby_failed","header")
 {
 SWIGINTERN VALUE
-SWIG_ruby_failed(void)
+SWIG_ruby_failed(VALUE SWIGUNUSEDPARM(arg1), VALUE SWIGUNUSEDPARM(arg2))
 {
   return Qnil;
 } 
 }
 
 %define %ruby_aux_method(Type, Method, Action)
-SWIGINTERN VALUE SWIG_AUX_##Method##(VALUE *args)
+SWIGINTERN VALUE SWIG_AUX_##Method##(VALUE arg)
 {
+  VALUE *args = (VALUE *)arg;
   VALUE obj = args[0];
   VALUE type = TYPE(obj);
   Type *res = (Type *)(args[1]);
@@ -79,7 +80,7 @@
     VALUE a[2];
     a[0] = obj;
     a[1] = (VALUE)(&v);
-    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
+    if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2LONG), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
       if (val) *val = v;
       return SWIG_OK;
     }
@@ -111,7 +112,7 @@
     VALUE a[2];
     a[0] = obj;
     a[1] = (VALUE)(&v);
-    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
+    if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
       if (val) *val = v;
       return SWIG_OK;
     }
@@ -149,7 +150,7 @@
     VALUE a[2];
     a[0] = obj;
     a[1] = (VALUE)(&v);
-    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
+    if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2LL), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
       if (val) *val = v;
       return SWIG_OK;
     }
@@ -187,7 +188,7 @@
     VALUE a[2];
     a[0] = obj;
     a[1] = (VALUE)(&v);
-    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
+    if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2ULL), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
       if (val) *val = v;
       return SWIG_OK;
     }
@@ -215,7 +216,7 @@
     VALUE a[2];
     a[0] = obj;
     a[1] = (VALUE)(&v);
-    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2DBL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
+    if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2DBL), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
       if (val) *val = v;
       return SWIG_OK;
     }
diff --git a/Lib/ruby/rubytracking.swg b/Lib/ruby/rubytracking.swg
index b9fb249..1edcc56 100644
--- a/Lib/ruby/rubytracking.swg
+++ b/Lib/ruby/rubytracking.swg
@@ -32,7 +32,7 @@
 */
 static st_table* swig_ruby_trackings = NULL;
 
-static VALUE swig_ruby_trackings_count(ANYARGS) {
+static VALUE swig_ruby_trackings_count(ID id, VALUE *var) {
   return SWIG2NUM(swig_ruby_trackings->num_entries);
 }
 
@@ -69,7 +69,9 @@
     swig_ruby_trackings = (st_table*)NUM2SWIG(trackings_value);
   }
 
-  rb_define_virtual_variable("SWIG_TRACKINGS_COUNT", swig_ruby_trackings_count, NULL);
+  rb_define_virtual_variable("SWIG_TRACKINGS_COUNT",
+                             VALUEFUNC(swig_ruby_trackings_count),
+                             SWIG_RUBY_VOID_ANYARGS_FUNC((rb_gvar_setter_t*)NULL));
 }
 
 /* Add a Tracking from a C/C++ struct to a Ruby object */
@@ -118,13 +120,15 @@
    to the passed callback function. */
 
 /* Proxy method to abstract the internal trackings datatype */
-static int swig_ruby_internal_iterate_callback(void* ptr, VALUE obj, void(*meth)(void* ptr, VALUE obj)) {
-  (*meth)(ptr, obj);
+static int swig_ruby_internal_iterate_callback(st_data_t ptr, st_data_t obj, st_data_t meth) {
+  ((void (*) (void *, VALUE))meth)((void *)ptr, (VALUE)obj);
   return ST_CONTINUE;
 }
 
 SWIGRUNTIME void SWIG_RubyIterateTrackings( void(*meth)(void* ptr, VALUE obj) ) {
-  st_foreach(swig_ruby_trackings, (int (*)(ANYARGS))&swig_ruby_internal_iterate_callback, (st_data_t)meth);
+  st_foreach(swig_ruby_trackings,
+             SWIG_RUBY_INT_ANYARGS_FUNC(swig_ruby_internal_iterate_callback),
+             (st_data_t)meth);
 }
 
 #ifdef __cplusplus
diff --git a/README b/README
index 165098c..1a1cda6 100644
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
 SWIG (Simplified Wrapper and Interface Generator)
 
-Version: 4.0.1 (in progress)
+Version: 4.0.2 (in progress)
 
 Tagline: SWIG is a compiler that integrates C and C++ with languages
          including Perl, Python, Tcl, Ruby, PHP, Java, C#, D, Go, Lua,
diff --git a/RELEASENOTES b/RELEASENOTES
index 3fe78f2..8633dad 100644
--- a/RELEASENOTES
+++ b/RELEASENOTES
@@ -7,6 +7,16 @@
 Detailed release notes are available with the release and are also
 published on the SWIG web site at http://swig.org/release.html.
 
+SWIG-4.0.1 summary:
+- SWIG now cleans up on error by removing all generated files.
+- Add Python 3.8 support.
+- Python Sphinx compatibility added for Doxygen comments.
+- Some minor regressions introduced in 4.0.0 were fixed.
+- Fix some C++17 compatibility problems in Python and Ruby generated
+  code.
+- Minor improvements/fixes for C#, Java, Javascript, Lua, MzScheme,
+  Ocaml, Octave and Python.
+
 SWIG-4.0.0 summary:
 - Support for Doxygen documentation comments which are parsed and
   converted into JavaDoc or PyDoc comments.
diff --git a/Source/CParse/cscanner.c b/Source/CParse/cscanner.c
index 4566817..7a9c05c 100644
--- a/Source/CParse/cscanner.c
+++ b/Source/CParse/cscanner.c
@@ -873,10 +873,14 @@
 	  return (USING);
 	if (strcmp(yytext, "namespace") == 0)
 	  return (NAMESPACE);
-	if (strcmp(yytext, "override") == 0)
+	if (strcmp(yytext, "override") == 0) {
+	  last_id = 1;
 	  return (OVERRIDE);
-	if (strcmp(yytext, "final") == 0)
+	}
+	if (strcmp(yytext, "final") == 0) {
+	  last_id = 1;
 	  return (FINAL);
+	}
       } else {
 	if (strcmp(yytext, "class") == 0) {
 	  Swig_warning(WARN_PARSE_CLASS_KEYWORD, cparse_file, cparse_line, "class keyword used, but not in C++ mode.\n");
diff --git a/Source/DOH/README b/Source/DOH/README
index 8be5f65..be90f25 100644
--- a/Source/DOH/README
+++ b/Source/DOH/README
@@ -73,11 +73,17 @@
 Chop(obj)                       Remove trailing whitespace
 
 flags is one of the following:
-     DOH_REPLACE_ANY
-     DOH_REPLACE_NOQUOTE
-     DOH_REPLACE_ID
-     DOH_REPLACE_FIRST
-             
+    DOH_REPLACE_ID
+    DOH_REPLACE_ID_BEGIN
+    DOH_REPLACE_ID_END
+    DOH_REPLACE_NUMBER_END
+
+and can be combined with one or more of the following:
+    DOH_REPLACE_ANY
+    DOH_REPLACE_NOQUOTE
+    DOH_REPLACE_NOCOMMENT
+    DOH_REPLACE_FIRST
+
 Callable Operations
 -------------------
 Call(obj, args)                 Perform a function call with arguments args.
diff --git a/Source/DOH/doh.h b/Source/DOH/doh.h
index 7fb64c0..fd0530e 100644
--- a/Source/DOH/doh.h
+++ b/Source/DOH/doh.h
@@ -289,11 +289,12 @@
 
 #define   DOH_REPLACE_ANY         0x01
 #define   DOH_REPLACE_NOQUOTE     0x02
-#define   DOH_REPLACE_ID          0x04
-#define   DOH_REPLACE_FIRST       0x08
-#define   DOH_REPLACE_ID_BEGIN    0x10
-#define   DOH_REPLACE_ID_END      0x20
-#define   DOH_REPLACE_NUMBER_END  0x40
+#define   DOH_REPLACE_NOCOMMENT   0x04
+#define   DOH_REPLACE_ID          0x08
+#define   DOH_REPLACE_FIRST       0x10
+#define   DOH_REPLACE_ID_BEGIN    0x20
+#define   DOH_REPLACE_ID_END      0x40
+#define   DOH_REPLACE_NUMBER_END  0x80
 
 #define Replaceall(s,t,r)  DohReplace(s,t,r,DOH_REPLACE_ANY)
 #define Replaceid(s,t,r)   DohReplace(s,t,r,DOH_REPLACE_ID)
diff --git a/Source/DOH/string.c b/Source/DOH/string.c
index 6c67285..3689f4f 100644
--- a/Source/DOH/string.c
+++ b/Source/DOH/string.c
@@ -595,6 +595,13 @@
   }
 }
 
+static char *end_comment(char *s) {
+  char *substring = strstr(s, "*/");
+  if (substring)
+    ++substring;
+  return substring;
+}
+
 static char *match_simple(char *base, char *s, char *token, int tokenlen) {
   (void) base;
   (void) tokenlen;
@@ -677,6 +684,7 @@
   int ic;
   int rcount = 0;
   int noquote = 0;
+  int nocomment = 0;
   char *c, *s, *t, *first;
   char *q, *q2;
   char *base;
@@ -698,6 +706,11 @@
   if (flags & DOH_REPLACE_NOQUOTE)
     noquote = 1;
 
+  if (flags & DOH_REPLACE_NOCOMMENT)
+    nocomment = 1;
+
+  assert(!(noquote && nocomment)); /* quote and comment combination not implemented */
+
   /* If we are not replacing inside quotes, we need to do a little extra work */
   if (noquote) {
     q = strpbrk(base, "\"\'");
@@ -723,6 +736,31 @@
     }
   }
 
+  /* If we are not replacing inside comments, we need to do a little extra work */
+  if (nocomment) {
+    q = strstr(base, "/*");
+    if (!q) {
+      nocomment = 0;		/* Well, no comments to worry about. Oh well */
+    } else {
+      while (q && (q < s)) {
+	/* First match was found inside a comment.  Try to find another match */
+	q2 = end_comment(q);
+	if (!q2) {
+	  return 0;
+	}
+	if (q2 > s) {
+	  /* Find next match */
+	  s = (*match) (base, q2 + 1, token, tokenlen);
+	}
+	if (!s)
+	  return 0;		/* Oh well, no matches */
+	q = strstr(q2 + 1, "/*");
+	if (!q)
+	  nocomment = 0;		/* No more comments */
+      }
+    }
+  }
+
   first = s;
   replen = (int)strlen(rep);
 
@@ -768,6 +806,28 @@
 	  }
 	}
       }
+      if (nocomment) {
+	q = strstr(s, "/*");
+	if (!q) {
+	  nocomment = 0;
+	} else {
+	  while (q && (q < c)) {
+	    /* First match was found inside a comment.  Try to find another match */
+	    q2 = end_comment(q);
+	    if (!q2) {
+	      c = 0;
+	      break;
+	    }
+	    if (q2 > c)
+	      c = (*match) (base, q2 + 1, token, tokenlen);
+	    if (!c)
+	      break;
+	    q = strstr(q2 + 1, "/*");
+	    if (!q)
+	      nocomment = 0;	/* No more comments */
+	  }
+	}
+      }
       if (delta) {
 	if (c) {
 	  memmove(t, s, c - s);
@@ -823,6 +883,29 @@
 	  }
 	}
       }
+      if (nocomment) {
+	q = strstr(s, "/*");
+	if (!q) {
+	  break;
+	} else {
+	  while (q && (q < c)) {
+	    /* First match was found inside a comment.  Try to find another match */
+	    q2 = end_comment(q);
+	    if (!q2) {
+	      c = 0;
+	      break;
+	    }
+	    if (q2 > c) {
+	      c = (*match) (base, q2 + 1, token, tokenlen);
+	      if (!c)
+		break;
+	    }
+	    q = strstr(q2 + 1, "/*");
+	    if (!q)
+	      nocomment = 0;
+	  }
+	}
+      }
       if (c) {
 	rcount++;
 	ic--;
@@ -875,6 +958,29 @@
 	  }
 	}
       }
+      if (nocomment) {
+	q = strstr(s, "/*");
+	if (!q) {
+	  nocomment = 0;
+	} else {
+	  while (q && (q < c)) {
+	    /* First match was found inside a comment.  Try to find another match */
+	    q2 = end_comment(q);
+	    if (!q2) {
+	      c = 0;
+	      break;
+	    }
+	    if (q2 > c) {
+	      c = (*match) (base, q2 + 1, token, tokenlen);
+	      if (!c)
+		break;
+	    }
+	    q = strstr(q2 + 1, "/*");
+	    if (!q)
+	      nocomment = 0;	/* No more comments */
+	  }
+	}
+      }
       if (i < (rcount - 1)) {
 	memcpy(t, s, c - s);
 	t += (c - s);
diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx
index 76ec6a4..d08884b 100644
--- a/Source/Modules/csharp.cxx
+++ b/Source/Modules/csharp.cxx
@@ -1533,7 +1533,7 @@
       if (classname_substituted_flag) {
 	if (SwigType_isenum(t)) {
 	  // This handles wrapping of inline initialised const enum static member variables (not when wrapping enum items - ignored later on)
-	  Printf(constants_code, "(%s)%s.%s();\n", return_type, full_imclass_name, Swig_name_get(getNSpace(), symname));
+	  Printf(constants_code, "(%s)%s.%s();\n", return_type, full_imclass_name ? full_imclass_name : imclass_name, Swig_name_get(getNSpace(), symname));
 	} else {
 	  // This handles function pointers using the %constant directive
 	  Printf(constants_code, "new %s(%s.%s(), false);\n", return_type, full_imclass_name ? full_imclass_name : imclass_name, Swig_name_get(getNSpace(), symname));
@@ -4064,11 +4064,10 @@
 	      /* Get the C# parameter type */
 	      if ((tm = Getattr(p, "tmap:cstype"))) {
 		substituteClassname(pt, tm);
-		if (Strncmp(tm, "ref ", 4) == 0) {
-		  Replace(tm, "ref ", "", DOH_REPLACE_FIRST);
+		int flags = DOH_REPLACE_FIRST | DOH_REPLACE_ID_BEGIN | DOH_REPLACE_NOCOMMENT;
+		if (Replace(tm, "ref ", "", flags) || Replace(tm, "ref\t", "", flags)) {
 		  Printf(proxy_method_types, "typeof(%s).MakeByRefType()", tm);
-		} else if (Strncmp(tm, "out ", 4) == 0) {
-		  Replace(tm, "out ", "", DOH_REPLACE_FIRST);
+		} else if (Replace(tm, "out ", "", flags) || Replace(tm, "out\t", "", flags)) {
 		  Printf(proxy_method_types, "typeof(%s).MakeByRefType()", tm);
 		} else {
 		  Printf(proxy_method_types, "typeof(%s)", tm);
diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx
index 259f23f..fcc8381 100644
--- a/Source/Modules/java.cxx
+++ b/Source/Modules/java.cxx
@@ -1633,7 +1633,7 @@
       if (classname_substituted_flag) {
 	if (SwigType_isenum(t)) {
 	  // This handles wrapping of inline initialised const enum static member variables (not when wrapping enum items - ignored later on)
-	  Printf(constants_code, "%s.swigToEnum(%s.%s());\n", return_type, full_imclass_name, Swig_name_get(getNSpace(), symname));
+	  Printf(constants_code, "%s.swigToEnum(%s.%s());\n", return_type, full_imclass_name ? full_imclass_name : imclass_name, Swig_name_get(getNSpace(), symname));
 	} else {
 	  // This handles function pointers using the %constant directive
 	  Printf(constants_code, "new %s(%s.%s(), false);\n", return_type, full_imclass_name ? full_imclass_name : imclass_name, Swig_name_get(getNSpace(), symname));
diff --git a/Source/Modules/javascript.cxx b/Source/Modules/javascript.cxx
index 8c87330..d2b33b1 100644
--- a/Source/Modules/javascript.cxx
+++ b/Source/Modules/javascript.cxx
@@ -198,6 +198,11 @@
   virtual int emitWrapperFunction(Node *n);
 
   /**
+   * Invoked by nativeWrapper callback
+   */
+  virtual int emitNativeFunction(Node *n);
+
+  /**
    * Invoked from constantWrapper after call to Language::constantWrapper.
    **/
   virtual int emitConstant(Node *n);
@@ -311,6 +316,7 @@
   virtual int classHandler(Node *n);
   virtual int functionWrapper(Node *n);
   virtual int constantWrapper(Node *n);
+  virtual int nativeWrapper(Node *n);
   virtual void main(int argc, char *argv[]);
   virtual int top(Node *n);
 
@@ -442,6 +448,18 @@
 }
 
 /* ---------------------------------------------------------------------
+ * nativeWrapper()
+ *
+ * Function wrapper for generating placeholders for native functions
+ * --------------------------------------------------------------------- */
+
+int JAVASCRIPT::nativeWrapper(Node *n) {
+  emitter->emitNativeFunction(n);
+
+  return SWIG_OK;
+}
+
+/* ---------------------------------------------------------------------
  * classHandler()
  *
  * Function handler for generating wrappers for class
@@ -768,6 +786,14 @@
   return ret;
 }
 
+int JSEmitter::emitNativeFunction(Node *n) {
+  String *wrapname = Getattr(n, "wrap:name");
+  enterFunction(n);
+  state.function(WRAPPER_NAME, wrapname);
+  exitFunction(n);
+  return SWIG_OK;
+}
+
 int JSEmitter::enterClass(Node *n) {
   state.clazz(RESET);
   state.clazz(NAME, Getattr(n, "sym:name"));
diff --git a/Source/Modules/ocaml.cxx b/Source/Modules/ocaml.cxx
index 6f2a349..9f7504b 100644
--- a/Source/Modules/ocaml.cxx
+++ b/Source/Modules/ocaml.cxx
@@ -1619,7 +1619,7 @@
       /* pass the method call on to the OCaml object */
       Printv(w->code,
 	     "swig_result = caml_swig_alloc(1,C_list);\n" "SWIG_Store_field(swig_result,0,args);\n" "args = swig_result;\n" "swig_result = Val_unit;\n", 0);
-      Printf(w->code, "static CAML_VALUE *swig_ocaml_func_val = NULL;\n" "if (!swig_ocaml_func_val) {\n");
+      Printf(w->code, "static const CAML_VALUE *swig_ocaml_func_val = NULL;\n" "if (!swig_ocaml_func_val) {\n");
       Printf(w->code, "  swig_ocaml_func_val = caml_named_value(\"swig_runmethod\");\n  }\n");
       Printf(w->code, "swig_result = caml_callback3(*swig_ocaml_func_val,swig_get_self(),caml_copy_string(\"%s\"),args);\n", Getattr(n, "name"));
       /* exception handling */
diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx
index ea31af0..1dbedad 100644
--- a/Source/Modules/python.cxx
+++ b/Source/Modules/python.cxx
@@ -2493,7 +2493,7 @@
     String *symname = Getattr(n, "sym:name");
     String *wname = Swig_name_wrapper(symname);
 
-    const char *builtin_kwargs = builtin_ctor ? ", PyObject *SWIGUNUSEDPARM(kwargs)" : "";
+    const char *builtin_kwargs = builtin_ctor ? ", PyObject *kwargs" : "";
     Printv(f->def, linkage, builtin_ctor ? "int " : "PyObject *", wname, "(PyObject *self, PyObject *args", builtin_kwargs, ") {", NIL);
 
     Wrapper_add_local(f, "argc", "Py_ssize_t argc");
@@ -2503,6 +2503,9 @@
     if (!fastunpack) {
       Wrapper_add_local(f, "ii", "Py_ssize_t ii");
 
+      if (builtin_ctor)
+	Printf(f->code, "if (!SWIG_Python_CheckNoKeywords(kwargs, \"%s\")) SWIG_fail;\n", symname);
+
       if (maxargs - (add_self ? 1 : 0) > 0) {
         Append(f->code, "if (!PyTuple_Check(args)) SWIG_fail;\n");
         Append(f->code, "argc = PyObject_Length(args);\n");
@@ -2518,8 +2521,9 @@
       if (add_self)
 	Append(f->code, "argc++;\n");
     } else {
-      String *iname = Getattr(n, "sym:name");
-      Printf(f->code, "if (!(argc = SWIG_Python_UnpackTuple(args, \"%s\", 0, %d, argv%s))) SWIG_fail;\n", iname, maxargs, add_self ? "+1" : "");
+      if (builtin_ctor)
+	Printf(f->code, "if (!SWIG_Python_CheckNoKeywords(kwargs, \"%s\")) SWIG_fail;\n", symname);
+      Printf(f->code, "if (!(argc = SWIG_Python_UnpackTuple(args, \"%s\", 0, %d, argv%s))) SWIG_fail;\n", symname, maxargs, add_self ? "+1" : "");
       if (add_self)
 	Append(f->code, "argv[0] = self;\n");
       else
@@ -2700,8 +2704,12 @@
       --tuple_required;
     }
     num_fixed_arguments = tuple_required;
+
+    // builtin handles/checks kwargs by default except in constructor wrappers so we need to explicitly handle them in the C constructor wrapper
+    // The check below is for zero arguments. Sometimes (eg directors) self is the first argument for a method with zero arguments.
     if (((num_arguments == 0) && (num_required == 0)) || ((num_arguments == 1) && (num_required == 1) && Getattr(l, "self")))
-      allow_kwargs = 0;
+      if (!builtin_ctor)
+	allow_kwargs = 0;
     varargs = emit_isvarargs(l);
 
     String *wname = Copy(wrapper_name);
@@ -2709,7 +2717,7 @@
       Append(wname, overname);
     }
 
-    const char *builtin_kwargs = builtin_ctor ? ", PyObject *SWIGUNUSEDPARM(kwargs)" : "";
+    const char *builtin_kwargs = builtin_ctor ? ", PyObject *kwargs" : "";
     if (!allow_kwargs || overname) {
       if (!varargs) {
 	Printv(f->def, linkage, wrap_return, wname, "(PyObject *", self_param, ", PyObject *args", builtin_kwargs, ") {", NIL);
@@ -2727,7 +2735,7 @@
       }
       Printv(f->def, linkage, wrap_return, wname, "(PyObject *", self_param, ", PyObject *args, PyObject *kwargs) {", NIL);
     }
-    if (!builtin || !in_class || tuple_arguments > 0) {
+    if (!builtin || !in_class || tuple_arguments > 0 || builtin_ctor) {
       if (!allow_kwargs) {
 	Append(parse_args, "    if (!PyArg_ParseTuple(args, \"");
       } else {
@@ -2876,14 +2884,13 @@
       Printv(f->locals, "  char * kwnames[] = ", kwargs, ";\n", NIL);
     }
 
-    if (builtin && !funpack && in_class && tuple_arguments == 0) {
-      Printf(parse_args, "    if (args && PyTuple_Check(args) && PyTuple_GET_SIZE(args) > 0) SWIG_exception_fail(SWIG_TypeError, \"%s takes no arguments\");\n", iname);
-    } else if (use_parse || allow_kwargs) {
+    if (use_parse || allow_kwargs) {
       Printf(parse_args, ":%s\"", iname);
       Printv(parse_args, arglist, ")) SWIG_fail;\n", NIL);
       funpack = 0;
     } else {
       Clear(parse_args);
+
       if (funpack) {
 	Clear(f->def);
 	if (overname) {
@@ -2896,6 +2903,8 @@
 	} else {
 	  int is_tp_call = Equal(Getattr(n, "feature:python:slot"), "tp_call");
 	  Printv(f->def, linkage, wrap_return, wname, "(PyObject *", self_param, ", PyObject *args", builtin_kwargs, ") {", NIL);
+	  if (builtin_ctor)
+	    Printf(parse_args, "if (!SWIG_Python_CheckNoKeywords(kwargs, \"%s\")) SWIG_fail;\n", iname);
 	  if (onearg && !builtin_ctor && !is_tp_call) {
 	    Printf(parse_args, "if (!args) SWIG_fail;\n");
 	    Append(parse_args, "swig_obj[0] = args;\n");
@@ -2906,8 +2915,14 @@
 	  }
 	}
       } else {
-	Printf(parse_args, "if (!PyArg_UnpackTuple(args, \"%s\", %d, %d", iname, num_fixed_arguments, tuple_arguments);
-	Printv(parse_args, arglist, ")) SWIG_fail;\n", NIL);
+	if (builtin_ctor)
+	  Printf(parse_args, "if (!SWIG_Python_CheckNoKeywords(kwargs, \"%s\")) SWIG_fail;\n", iname);
+	if (builtin && in_class && tuple_arguments == 0) {
+	  Printf(parse_args, "    if (args && PyTuple_Check(args) && PyTuple_GET_SIZE(args) > 0) SWIG_exception_fail(SWIG_TypeError, \"%s takes no arguments\");\n", iname);
+	} else {
+	  Printf(parse_args, "if (!PyArg_UnpackTuple(args, \"%s\", %d, %d", iname, num_fixed_arguments, tuple_arguments);
+	  Printv(parse_args, arglist, ")) SWIG_fail;\n", NIL);
+	}
       }
     }
 
@@ -4128,6 +4143,13 @@
     Printv(f, "#if PY_VERSION_HEX >= 0x03040000\n", NIL);
     printSlot(f, getSlot(n, "feature:python:tp_finalize"), "tp_finalize", "destructor");
     Printv(f, "#endif\n", NIL);
+    Printv(f, "#if PY_VERSION_HEX >= 0x03080000\n", NIL);
+    printSlot(f, getSlot(n, "feature:python:tp_vectorcall"), "tp_vectorcall", "vectorcallfunc");
+    Printv(f, "#endif\n", NIL);
+    Printv(f, "#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)\n", NIL);
+    printSlot(f, getSlot(), "tp_print");
+    Printv(f, "#endif\n", NIL);
+
     Printv(f, "#ifdef COUNT_ALLOCS\n", NIL);
     printSlot(f, getSlot(n, "feature:python:tp_allocs"), "tp_allocs", "Py_ssize_t");
     printSlot(f, getSlot(n, "feature:python:tp_frees"), "tp_frees", "Py_ssize_t");
diff --git a/Source/Modules/ruby.cxx b/Source/Modules/ruby.cxx
index 6a1e16d..48b0efa 100644
--- a/Source/Modules/ruby.cxx
+++ b/Source/Modules/ruby.cxx
@@ -2191,6 +2191,12 @@
     String *tm;
     String *getfname, *setfname;
     Wrapper *getf, *setf;
+    const int assignable = is_assignable(n);
+
+    // Determine whether virtual global variables shall be used
+    // which have different getter and setter signatures,
+    // see https://docs.ruby-lang.org/en/2.6.0/extension_rdoc.html#label-Global+Variables+Shared+Between+C+and+Ruby
+    const bool use_virtual_var = (current == NO_CPP && useGlobalModule);
 
     getf = NewWrapper();
     setf = NewWrapper();
@@ -2201,7 +2207,7 @@
     getfname = Swig_name_wrapper(getname);
     Setattr(n, "wrap:name", getfname);
     Printv(getf->def, "SWIGINTERN VALUE\n", getfname, "(", NIL);
-    Printf(getf->def, "VALUE self");
+    Printf(getf->def, (use_virtual_var) ? "ID id, VALUE *data" : "VALUE self");
     Printf(getf->def, ") {");
     Wrapper_add_local(getf, "_val", "VALUE _val");
 
@@ -2224,8 +2230,8 @@
 
     Wrapper_print(getf, f_wrappers);
 
-    if (!is_assignable(n)) {
-      setfname = NewString("NULL");
+    if (!assignable) {
+      setfname = NewString("(rb_gvar_setter_t *)NULL");
     } else {
       /* create setter */
       String* docs = docstring(n, AUTODOC_SETTER);
@@ -2235,8 +2241,12 @@
       String *setname = Swig_name_set(NSPACE_TODO, iname);
       setfname = Swig_name_wrapper(setname);
       Setattr(n, "wrap:name", setfname);
-      Printv(setf->def, "SWIGINTERN VALUE\n", setfname, "(VALUE self, ", NIL);
-      Printf(setf->def, "VALUE _val) {");
+      Printf(setf->def, "SWIGINTERN ");
+      if (use_virtual_var) {
+        Printv(setf->def, "void\n", setfname, "(VALUE _val, ID id, VALUE *data) {", NIL);
+      } else {
+        Printv(setf->def, "VALUE\n", setfname, "(VALUE self, VALUE _val) {", NIL);
+      }
       tm = Swig_typemap_lookup("varin", n, name, 0);
       if (tm) {
 	Replaceall(tm, "$input", "_val");
@@ -2247,28 +2257,31 @@
       } else {
 	Swig_warning(WARN_TYPEMAP_VARIN_UNDEF, input_file, line_number, "Unable to set variable of type %s\n", SwigType_str(t, 0));
       }
-      Printv(setf->code, tab4, "return _val;\n", NIL);
-      Printf(setf->code, "fail:\n");
-      Printv(setf->code, tab4, "return Qnil;\n", NIL);
+      if (use_virtual_var) {
+        Printf(setf->code, "fail:\n");
+        Printv(setf->code, tab4, "return;\n", NIL);
+      } else {
+        Printv(setf->code, tab4, "return _val;\n", NIL);
+        Printf(setf->code, "fail:\n");
+        Printv(setf->code, tab4, "return Qnil;\n", NIL);
+      }
       Printf(setf->code, "}\n");
       Wrapper_print(setf, f_wrappers);
       Delete(setname);
     }
 
-    /* define accessor method */
-    if (CPlusPlus) {
-      Insert(getfname, 0, "VALUEFUNC(");
-      Append(getfname, ")");
-      Insert(setfname, 0, "VALUEFUNC(");
-      Append(setfname, ")");
-    }
+    /* define accessor methods */
+    Insert(getfname, 0, "VALUEFUNC(");
+    Append(getfname, ")");
+    Insert(setfname, 0, (use_virtual_var) ? "SWIG_RUBY_VOID_ANYARGS_FUNC(" : "VALUEFUNC(");
+    Append(setfname, ")");
 
     String *s = NewString("");
     switch (current) {
     case STATIC_VAR:
       /* C++ class variable */
       Printv(s, tab4, "rb_define_singleton_method(", klass->vname, ", \"", klass->strip(iname), "\", ", getfname, ", 0);\n", NIL);
-      if (!GetFlag(n, "feature:immutable")) {
+      if (assignable) {
 	Printv(s, tab4, "rb_define_singleton_method(", klass->vname, ", \"", klass->strip(iname), "=\", ", setfname, ", 1);\n", NIL);
       }
       Printv(klass->init, s, NIL);
@@ -2279,14 +2292,11 @@
       assert(current == NO_CPP);
       if (!useGlobalModule) {
 	Printv(s, tab4, "rb_define_singleton_method(", modvar, ", \"", iname, "\", ", getfname, ", 0);\n", NIL);
-	if (!GetFlag(n, "feature:immutable")) {
+	if (assignable) {
 	  Printv(s, tab4, "rb_define_singleton_method(", modvar, ", \"", iname, "=\", ", setfname, ", 1);\n", NIL);
 	}
       } else {
-	Printv(s, tab4, "rb_define_global_method(\"", iname, "\", ", getfname, ", 0);\n", NIL);
-	if (!GetFlag(n, "feature:immutable")) {
-	  Printv(s, tab4, "rb_define_global_method(\"", iname, "=\", ", setfname, ", 1);\n", NIL);
-	}
+	Printv(s, tab4, "rb_define_virtual_variable(\"$", iname, "\", ", getfname, ", ", setfname, ");\n", NIL);
       }
       Printv(f_init, s, NIL);
       Delete(s);
diff --git a/Tools/travis-linux-install.sh b/Tools/travis-linux-install.sh
index 37ef841..c8347d2 100755
--- a/Tools/travis-linux-install.sh
+++ b/Tools/travis-linux-install.sh
@@ -23,8 +23,8 @@
 		travis_retry sudo apt-get -qq install mono-devel
 		;;
 	"d")
-		travis_retry wget http://downloads.dlang.org/releases/2014/dmd_2.066.0-0_amd64.deb
-		travis_retry sudo dpkg -i dmd_2.066.0-0_amd64.deb
+		travis_retry wget http://downloads.dlang.org/releases/2.x/${VER}/dmd_${VER}-0_amd64.deb
+		travis_retry sudo dpkg -i dmd_${VER}-0_amd64.deb
 		;;
 	"go")
 		if [[ "$VER" ]]; then
@@ -71,21 +71,7 @@
 		travis_retry sudo apt-get -qq install ocaml camlp4
 		;;
 	"octave")
-		if [[ -z "$VER" ]]; then
-			travis_retry sudo apt-get -qq install liboctave-dev
-		else
-			# Travis adds external PPAs which contain newer versions of packages
-			# than in baseline trusty. These newer packages prevent some of the
-			# Octave packages in ppa:kwwette/octave, which rely on the older
-			# packages in trusty, from installing. To prevent these kind of
-			# interactions arising, clean out all external PPAs added by Travis
-			# before installing Octave
-			sudo rm -rf /etc/apt/sources.list.d/*
-			travis_retry sudo apt-get -qq update
-			travis_retry sudo add-apt-repository -y ppa:kwwette/octaves
-			travis_retry sudo apt-get -qq update
-			travis_retry sudo apt-get -qq install liboctave${VER}-dev
-		fi
+		travis_retry sudo apt-get -qq install liboctave-dev
 		;;
 	"php")
 		travis_retry sudo add-apt-repository -y ppa:ondrej/php
@@ -109,6 +95,12 @@
 		travis_retry sudo apt-get -qq install r-base
 		;;
 	"ruby")
+		if [[ "$VER" == "2.7" ]]; then
+			# Ruby 2.7 support is currently only rvm master (30 Dec 2019)
+			travis_retry rvm get master
+			rvm reload
+			rvm list known
+		fi
 		if [[ "$VER" ]]; then
 			travis_retry rvm install $VER
 		fi
diff --git a/appveyor.yml b/appveyor.yml
index 42eaa36..f87cefd 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -16,10 +16,10 @@
   - SWIGLANG: python
     VSVER: 14
     VER: 27
-  - SWIGLANG: python
-    VSVER: 14
-    VER: 36
-    PY3: 3
+# - SWIGLANG: python
+#   VSVER: 14
+#   VER: 36
+#   PY3: 3
   - SWIGLANG: python
     OSVARIANT: cygwin
   - SWIGLANG: python
diff --git a/configure.ac b/configure.ac
index 5432743..b4cadef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
 dnl The macros which aren't shipped with the autotools are stored in the
 dnl Tools/config directory in .m4 files.
 
-AC_INIT([swig],[4.0.1],[http://www.swig.org])
+AC_INIT([swig],[4.0.2],[http://www.swig.org])
 AC_PREREQ(2.60)
 
 AC_CONFIG_SRCDIR([Source/Swig/swig.h])
@@ -1348,6 +1348,33 @@
   JAVAC="$JAVACBIN"
 fi
 
+# Check Java version: we require Java 9 or later for Doxygen tests.
+if test -n "$JAVAC"; then
+    AC_MSG_CHECKING(if java version is 9 or greater)
+    javac_version=`"$JAVAC" -version 2>&1`
+    java_version_num=`echo $javac_version | sed -n 's/^javac //p'`
+    if test -z "$java_version_num"; then
+        AC_MSG_WARN([unknown format for Java version returned by "$JAVAC" ($javac_version)])
+        JAVA_SKIP_DOXYGEN_TEST_CASES=1
+        AC_MSG_RESULT(unknown)
+    else
+        dnl Until Java 8 version number was in format "1.x", starting from
+        dnl Java 9 it's just "x".
+        case $java_version_num in
+            1.*)
+                JAVA_SKIP_DOXYGEN_TEST_CASES=1
+                AC_MSG_RESULT([no, disabling Doxygen tests])
+                ;;
+
+            *)
+                AC_MSG_RESULT(yes)
+                ;;
+        esac
+    fi
+
+    AC_SUBST(JAVA_SKIP_DOXYGEN_TEST_CASES)
+fi
+
 AC_MSG_CHECKING(for java include file jni.h)
 AC_ARG_WITH(javaincl, [  --with-javaincl=path    Set location of Java include directory], [JAVAINCDIR="$withval"], [JAVAINCDIR=])
 
@@ -1408,15 +1435,6 @@
   fi
 fi
 
-# Javadoc support required for the Java test-suite is available by default in jdk9+ and in tools.jar in earlier jdk versions
-AC_MSG_CHECKING(for java tools.jar)
-if test -n "$JAVA_HOME" && test -r "$JAVA_HOME/lib/tools.jar" ; then
-  JAVA_TOOLS_JAR="$JAVA_HOME/lib/tools.jar"
-  AC_MSG_RESULT([$JAVA_TOOLS_JAR])
-else
-  AC_MSG_RESULT(not found)
-fi
-
 case $host in
 *-*-cygwin*)
         # TODO: Only use this flag if the compiler supports it, later versions of gcc no longer have it
@@ -1483,7 +1501,6 @@
 AC_SUBST(JAVAC)
 AC_SUBST(JAVAINC)
 AC_SUBST(JAVA_CLASSPATH_SEP)
-AC_SUBST(JAVA_TOOLS_JAR)
 AC_SUBST(JAVADYNAMICLINKING)
 AC_SUBST(JAVALIBRARYPREFIX)
 AC_SUBST(JAVASO)
@@ -2370,11 +2387,6 @@
 if test x"${GOBIN}" = xno; then
   AC_MSG_NOTICE([Disabling Go])
   GO=
-  GOC=
-  GO1=false
-  GO12=false
-  GO13=false
-  GO15=false
   GOGCC=false
   GCCGO=
   GOOPT=
@@ -2390,30 +2402,17 @@
 
   GOGCC=false
   GCCGO=
-  GO1=false
-  GO12=false
-  GO13=false
-  GO15=false
   GOOPT=
   GCCGOOPT=
   GOVERSIONOPTION=
 
   if test -n "$GO" ; then
-    GO1=true
     GOVERSIONOPTION=version
     go_version=$($GO $GOVERSIONOPTION | sed -e 's/go version //')
-    case "$go_version" in
-    go1 | go1.[[01234]] | go1.[[01234]].*)
-      GOC=$(sh -c "$(go env) && echo \$GOCHAR")c
-      ;;
-    *)
-      GOC=compile
-      ;;
-    esac
     AC_MSG_CHECKING([whether go version is too old])
     case $go_version in
-    go1.1.* | go1.1 | go1.0 | go1.0.* | go1 )
-      AC_MSG_RESULT([yes - minimum version is 1.2])
+    go1.[012]*)
+      AC_MSG_RESULT([yes - minimum version is 1.3])
       GO=
       GOOPT="-intgosize 32"
       ;;
@@ -2429,20 +2428,6 @@
       esac
       ;;
     esac
-    case $go_version in
-    go1.0 | go1.0.* | go1 | go1.1 | go1.1.*)
-      GOOPT="$GOOPT -use-shlib"
-      ;;
-    go1.2 | go1.2.*)
-      GO12=true
-      ;;
-    go1.3 | go1.3.* | go1.4 | go1.4.*)
-      GO13=true
-      ;;
-    *)
-      GO15=true
-      ;;
-    esac
   fi
 
   AC_CHECK_PROGS(GCCGO, gccgo)