aboutsummaryrefslogtreecommitdiff
path: root/Examples/test-suite/java
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/test-suite/java')
-rw-r--r--Examples/test-suite/java/CommentParser.java141
-rw-r--r--Examples/test-suite/java/Makefile.in14
-rw-r--r--Examples/test-suite/java/abstract_inherit_using_runme.java24
-rw-r--r--Examples/test-suite/java/allprotected_runme.java13
-rw-r--r--Examples/test-suite/java/argcargvtest_runme.java56
-rw-r--r--Examples/test-suite/java/assign_const_runme.java98
-rw-r--r--Examples/test-suite/java/assign_reference_runme.java89
-rw-r--r--Examples/test-suite/java/catches_strings_runme.java41
-rw-r--r--Examples/test-suite/java/constructor_copy_non_const_runme.java30
-rw-r--r--Examples/test-suite/java/copyctor_runme.java27
-rw-r--r--Examples/test-suite/java/cpp11_assign_delete_runme.java118
-rw-r--r--Examples/test-suite/java/cpp11_assign_rvalue_reference_runme.java89
-rw-r--r--Examples/test-suite/java/cpp11_brackets_expression_runme.java24
-rw-r--r--Examples/test-suite/java/cpp11_copyctor_delete_runme.java29
-rw-r--r--Examples/test-suite/java/cpp11_default_delete_runme.java28
-rw-r--r--Examples/test-suite/java/cpp11_director_using_constructor_runme.java323
-rw-r--r--Examples/test-suite/java/cpp11_inheriting_constructors_runme.java27
-rw-r--r--Examples/test-suite/java/cpp11_move_only_runme.java51
-rw-r--r--Examples/test-suite/java/cpp11_move_only_valuewrapper_runme.java44
-rw-r--r--Examples/test-suite/java/cpp11_move_typemaps_runme.java51
-rw-r--r--Examples/test-suite/java/cpp11_rvalue_reference_move_runme.java97
-rw-r--r--Examples/test-suite/java/cpp11_shared_ptr_template_upcast_runme.java24
-rw-r--r--Examples/test-suite/java/cpp11_std_unique_ptr_runme.java146
-rw-r--r--Examples/test-suite/java/cpp11_template_parameters_decltype_runme.java45
-rw-r--r--Examples/test-suite/java/cpp11_template_templated_methods_runme.java81
-rw-r--r--Examples/test-suite/java/cpp11_using_constructor_runme.java170
-rw-r--r--Examples/test-suite/java/cpp17_director_string_view_runme.java58
-rw-r--r--Examples/test-suite/java/cpp17_enable_if_t_runme.java19
-rw-r--r--Examples/test-suite/java/cpp17_string_view_runme.java105
-rw-r--r--Examples/test-suite/java/director_classes_runme.java18
-rw-r--r--Examples/test-suite/java/director_default_runme.java31
-rw-r--r--Examples/test-suite/java/director_pass_by_value_runme.java2
-rw-r--r--Examples/test-suite/java/director_property_runme.java66
-rw-r--r--Examples/test-suite/java/director_string_runme.java10
-rw-r--r--Examples/test-suite/java/director_using_member_scopes_runme.java64
-rw-r--r--Examples/test-suite/java/doxygen_alias_runme.java8
-rw-r--r--Examples/test-suite/java/doxygen_basic_notranslate_runme.java12
-rw-r--r--Examples/test-suite/java/doxygen_basic_translate_runme.java19
-rw-r--r--Examples/test-suite/java/doxygen_basic_translate_style2_runme.java12
-rw-r--r--Examples/test-suite/java/doxygen_basic_translate_style3_runme.java93
-rw-r--r--Examples/test-suite/java/doxygen_code_blocks_runme.java75
-rw-r--r--Examples/test-suite/java/doxygen_ignore_runme.java8
-rw-r--r--Examples/test-suite/java/doxygen_misc_constructs_runme.java105
-rw-r--r--Examples/test-suite/java/doxygen_nested_class_runme.java12
-rw-r--r--Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java12
-rw-r--r--Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java12
-rw-r--r--Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java12
-rw-r--r--Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java12
-rw-r--r--Examples/test-suite/java/doxygen_parsing_runme.java34
-rw-r--r--Examples/test-suite/java/doxygen_translate_all_tags_runme.java23
-rw-r--r--Examples/test-suite/java/doxygen_translate_links_runme.java12
-rw-r--r--Examples/test-suite/java/doxygen_translate_runme.java15
-rw-r--r--Examples/test-suite/java/friends_runme.java23
-rw-r--r--Examples/test-suite/java/java_typemaps_proxy_runme.java9
-rw-r--r--Examples/test-suite/java/li_boost_shared_ptr_runme.java2
-rw-r--r--Examples/test-suite/java/li_constraints_runme.java77
-rw-r--r--Examples/test-suite/java/li_std_auto_ptr_runme.java138
-rw-r--r--Examples/test-suite/java/li_std_string_runme.java13
-rw-r--r--Examples/test-suite/java/multiple_inheritance_abstract_runme.java10
-rw-r--r--Examples/test-suite/java/multiple_inheritance_interfaces_runme.java12
-rw-r--r--Examples/test-suite/java/multiple_inheritance_nspace_runme.java9
-rw-r--r--Examples/test-suite/java/multiple_inheritance_overload_runme.java65
-rw-r--r--Examples/test-suite/java/multiple_inheritance_shared_ptr_runme.java9
-rw-r--r--Examples/test-suite/java/private_assign_runme.java20
-rw-r--r--Examples/test-suite/java/rname_runme.java2
-rw-r--r--Examples/test-suite/java/special_variable_macros_runme.java4
-rw-r--r--Examples/test-suite/java/template_construct_runme.java24
-rw-r--r--Examples/test-suite/java/template_function_parm_runme.java25
-rw-r--r--Examples/test-suite/java/template_nested_flat_runme.java35
-rw-r--r--Examples/test-suite/java/template_partial_specialization_more_runme.java49
-rw-r--r--Examples/test-suite/java/template_partial_specialization_typedef_runme.java35
-rw-r--r--Examples/test-suite/java/template_specialization_using_declaration_runme.java45
-rw-r--r--Examples/test-suite/java/template_template_parameters_runme.java22
-rw-r--r--Examples/test-suite/java/template_template_template_parameters_runme.java36
-rw-r--r--Examples/test-suite/java/template_templated_constructors_runme.java10
-rw-r--r--Examples/test-suite/java/template_type_collapse_runme.java26
-rw-r--r--Examples/test-suite/java/template_using_member_default_arg_runme.java22
-rw-r--r--Examples/test-suite/java/typemap_out_optimal_runme.java12
-rw-r--r--Examples/test-suite/java/using_member_multiple_inherit_runme.java46
79 files changed, 3247 insertions, 262 deletions
diff --git a/Examples/test-suite/java/CommentParser.java b/Examples/test-suite/java/CommentParser.java
index 7dc6d591d..197405938 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.BufferedWriter;
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 @@ public class CommentParser {
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 @@ public class CommentParser {
}
- private void printKeys(Map<String, String> map) {
+ private static void printKeys(Map<String, String> map) {
Set<String> keys = map.keySet();
for (String key : keys) {
@@ -143,7 +220,7 @@ public class CommentParser {
Iterator< Entry<String, String> > it = m_parsedComments.entrySet().iterator();
- while (it.hasNext()) {
+ while (it.hasNext()) {
Entry<String, String> e = (Entry<String, String>) it.next();
String commentText = e.getValue();
@@ -154,6 +231,15 @@ public class CommentParser {
}
}
+ 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 @@ public class CommentParser {
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 2e788fa07..83335d4d4 100644
--- a/Examples/test-suite/java/Makefile.in
+++ b/Examples/test-suite/java/Makefile.in
@@ -9,7 +9,12 @@ JAVAFLAGS = @JAVAFLAGS@
JAVA_CLASSPATH_SEP = @JAVA_CLASSPATH_SEP@
JAVA_TOOLS_JAR = @JAVA_TOOLS_JAR@
SCRIPTSUFFIX = _runme.java
+SKIP_DOXYGEN_TEST_CASES = @JAVA_SKIP_DOXYGEN_TEST_CASES@
+HAVE_CXX11 = @HAVE_CXX11@
+HAVE_CXX14 = @HAVE_CXX14@
+HAVE_CXX17 = @HAVE_CXX17@
+HAVE_CXX20 = @HAVE_CXX20@
srcdir = @srcdir@
top_srcdir = ../@top_srcdir@
top_builddir = ../@top_builddir@
@@ -43,15 +48,17 @@ CPP_TEST_CASES = \
java_throws \
java_typemaps_proxy \
java_typemaps_typewrapper \
+ nested_scope \
li_std_list \
- li_std_map \
li_std_set \
# li_boost_intrusive_ptr
CPP11_TEST_CASES = \
cpp11_shared_ptr_const \
+ cpp11_shared_ptr_crtp_upcast \
cpp11_shared_ptr_nullptr_in_containers \
cpp11_shared_ptr_overload \
+ cpp11_shared_ptr_template_upcast \
cpp11_shared_ptr_upcast \
cpp11_std_unordered_map \
cpp11_std_unordered_set \
@@ -108,13 +115,11 @@ setup = \
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
@@ -132,6 +137,7 @@ run_testcase = \
@if [ -d $(JAVA_PACKAGE) ]; then \
rm -rf $(JAVA_PACKAGE); \
fi
+ @rm -f $*_runme.class
clean:
@rm -f *.class hs_err*.log
diff --git a/Examples/test-suite/java/abstract_inherit_using_runme.java b/Examples/test-suite/java/abstract_inherit_using_runme.java
new file mode 100644
index 000000000..e4ec0bcef
--- /dev/null
+++ b/Examples/test-suite/java/abstract_inherit_using_runme.java
@@ -0,0 +1,24 @@
+
+import abstract_inherit_using.*;
+
+public class abstract_inherit_using_runme {
+
+ static {
+ try {
+ System.loadLibrary("abstract_inherit_using");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ ConcreteDerived1 cd1 = new ConcreteDerived1();
+ cd1.f(1234);
+ cd1.f("one");
+ ConcreteDerived2 cd2 = new ConcreteDerived2();
+ cd2.f(1234);
+ cd2.f("one");
+ }
+}
diff --git a/Examples/test-suite/java/allprotected_runme.java b/Examples/test-suite/java/allprotected_runme.java
index aa5413a95..864feb45b 100644
--- a/Examples/test-suite/java/allprotected_runme.java
+++ b/Examples/test-suite/java/allprotected_runme.java
@@ -14,6 +14,9 @@ public class allprotected_runme {
{
MyProtectedBase mpb = new MyProtectedBase("MyProtectedBase");
mpb.accessProtected();
+
+ MyAllProtectedBottom mapb = new MyAllProtectedBottom();
+ mapb.callProtectedMethods();
}
}
@@ -72,3 +75,13 @@ class MyProtectedBase extends ProtectedBase
}
}
+class MyAllProtectedBottom extends AllProtectedBottom
+{
+ void callProtectedMethods() {
+ usingOverloaded();
+ usingOverloaded(99);
+ usingSingle();
+ doSomething();
+ doSomething(99);
+ }
+}
diff --git a/Examples/test-suite/java/argcargvtest_runme.java b/Examples/test-suite/java/argcargvtest_runme.java
new file mode 100644
index 000000000..376b368ab
--- /dev/null
+++ b/Examples/test-suite/java/argcargvtest_runme.java
@@ -0,0 +1,56 @@
+import argcargvtest.*;
+
+public class argcargvtest_runme {
+
+ static {
+ try {
+ System.loadLibrary("argcargvtest");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ argcargvtest test = new argcargvtest();
+
+ String[] largs = {"hi", "hola", "hello"};
+ if (test.mainc(largs) != 3)
+ throw new RuntimeException("bad main typemap");
+
+ String[] targs = {"hi", "hola"};
+ if (!test.mainv(targs, 0).equals("hi"))
+ throw new RuntimeException("bad main typemap");
+ if (!test.mainv(targs, 1).equals("hola"))
+ throw new RuntimeException("bad main typemap");
+ if (!test.mainv(targs, 2).equals("<<NULL>>"))
+ throw new RuntimeException("bad main typemap");
+
+// For dynamically typed languages we test this throws an exception or similar
+// at runtime, but for Java this doesn't even compile (but we can't easily
+// test for that here).
+// test.mainv("hello", 1);
+
+ test.initializeApp(largs);
+
+ // Check that an empty array works.
+ String[] empty_args = {};
+ if (test.mainc(empty_args) != 0)
+ throw new RuntimeException("bad main typemap");
+ if (!test.mainv(empty_args, 0).equals("<<NULL>>"))
+ throw new RuntimeException("bad main typemap");
+
+ // Check that empty strings are handled.
+ String[] empty_string = {"hello", "", "world"};
+ if (test.mainc(empty_string) != 3)
+ throw new RuntimeException("bad main typemap");
+ if (!test.mainv(empty_string, 0).equals("hello"))
+ throw new RuntimeException("bad main typemap");
+ if (!test.mainv(empty_string, 1).equals(""))
+ throw new RuntimeException("bad main typemap");
+ if (!test.mainv(empty_string, 2).equals("world"))
+ throw new RuntimeException("bad main typemap");
+ if (!test.mainv(empty_string, 3).equals("<<NULL>>"))
+ throw new RuntimeException("bad main typemap");
+ }
+}
diff --git a/Examples/test-suite/java/assign_const_runme.java b/Examples/test-suite/java/assign_const_runme.java
new file mode 100644
index 000000000..6035af717
--- /dev/null
+++ b/Examples/test-suite/java/assign_const_runme.java
@@ -0,0 +1,98 @@
+
+import assign_const.*;
+
+public class assign_const_runme {
+
+ static {
+ try {
+ System.loadLibrary("assign_const");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ MemberVars mv = new MemberVars();
+
+ // (1) Test directly non-assignable member variables
+ // These will only have getters
+ AssignValue a1 = mv.getMemberValue();
+ AssignArray a2 = mv.getMemberArray();
+ AssignPtr a3 = mv.getMemberPtr();
+ AssignMatrix a4 = mv.getMemberMatrix();
+
+ // (2) Test indirectly non-assignable member variables via inheritance
+ InheritedMemberVars imv = new InheritedMemberVars();
+ // These will only have getters
+ AssignValueDerived aa4 = imv.getMemberValueDerived();
+ AssignArrayDerived aa5 = imv.getMemberArrayDerived();
+ AssignPtrDerived aa6 = imv.getMemberPtrDerived();
+ AssignMatrixDerived aa7 = imv.getMemberMatrixDerived();
+
+ AssignValueDerived sa4 = InheritedMemberVars.getStaticMemberValueDerived();
+ AssignArrayDerived sa5 = InheritedMemberVars.getStaticMemberArrayDerived();
+ AssignPtrDerived sa6 = InheritedMemberVars.getStaticMemberPtrDerived();
+ AssignMatrixDerived sa7 = InheritedMemberVars.getStaticMemberMatrixDerived();
+
+ AssignValueDerived ga4 = assign_const.getGlobalValueDerived();
+ AssignArrayDerived ga5 = assign_const.getGlobalArrayDerived();
+ AssignPtrDerived ga6 = assign_const.getGlobalPtrDerived();
+ AssignMatrixDerived ga7 = assign_const.getGlobalMatrixDerived();
+
+ // These will have getters and setters
+ AssignValueDerivedSettable a7 = imv.getMemberValueDerivedSettable();
+ imv.setMemberValueDerivedSettable(a7);
+ AssignArrayDerivedSettable a8 = imv.getMemberArrayDerivedSettable();
+ imv.setMemberArrayDerivedSettable(a8);
+ AssignPtrDerivedSettable a9 = imv.getMemberPtrDerivedSettable();
+ imv.setMemberPtrDerivedSettable(a9);
+ AssignMatrixDerivedSettable a10 = imv.getMemberMatrixDerivedSettable();
+ imv.setMemberMatrixDerivedSettable(a10);
+
+ AssignValueDerivedSettable saa7 = InheritedMemberVars.getStaticMemberValueDerivedSettable();
+ InheritedMemberVars.setStaticMemberValueDerivedSettable(saa7);
+ AssignArrayDerivedSettable saa8 = InheritedMemberVars.getStaticMemberArrayDerivedSettable();
+ InheritedMemberVars.setStaticMemberArrayDerivedSettable(saa8);
+ AssignPtrDerivedSettable saa9 = InheritedMemberVars.getStaticMemberPtrDerivedSettable();
+ InheritedMemberVars.setStaticMemberPtrDerivedSettable(saa9);
+ AssignMatrixDerivedSettable saa10 = InheritedMemberVars.getStaticMemberMatrixDerivedSettable();
+ InheritedMemberVars.setStaticMemberMatrixDerivedSettable(saa10);
+
+ AssignValueDerivedSettable gaa7 = assign_const.getGlobalValueDerivedSettable();
+ assign_const.setGlobalValueDerivedSettable(gaa7);
+ AssignArrayDerivedSettable gaa8 = assign_const.getGlobalArrayDerivedSettable();
+ assign_const.setGlobalArrayDerivedSettable(gaa8);
+ AssignPtrDerivedSettable gaa9 = assign_const.getGlobalPtrDerivedSettable();
+ assign_const.setGlobalPtrDerivedSettable(gaa9);
+ AssignMatrixDerivedSettable gaa10 = assign_const.getGlobalMatrixDerivedSettable();
+ assign_const.setGlobalMatrixDerivedSettable(gaa10);
+
+ // (3) Test indirectly non-assignable member variables via classes that themselves have non-assignable member variables
+ MembersMemberVars m = new MembersMemberVars();
+
+ // These will only have getters
+ MemberValueVar mpv1 = m.getMemberValue();
+ MemberArrayVar mpv2 = m.getMemberArray();
+ MemberPtrVar mpv3 = m.getMemberPtr();
+ MemberMatrixVar mpv4 = m.getMemberMatrix();
+
+ MemberValueVar smpv1 = StaticMembersMemberVars.getStaticMemberValue();
+ MemberArrayVar smpv2 = StaticMembersMemberVars.getStaticMemberArray();
+ MemberPtrVar smpv3 = StaticMembersMemberVars.getStaticMemberPtr();
+ MemberMatrixVar smpv4 = StaticMembersMemberVars.getStaticMemberMatrix();
+
+ MemberValueVar gmpv1 = assign_const.getGlobalMemberValue();
+ MemberArrayVar gmpv2 = assign_const.getGlobalMemberArray();
+ MemberPtrVar gmpv3 = assign_const.getGlobalMemberPtr();
+ MemberMatrixVar gmpv4 = assign_const.getGlobalMemberMatrix();
+
+ // Setters and getters available
+ StaticMembersMemberVarsHolder smmvh = new StaticMembersMemberVarsHolder();
+ StaticMembersMemberVars member = smmvh.getMember();
+ smmvh.setMember(member);
+
+ StaticMembersMemberVars smmv = assign_const.getGlobalStaticMembersMemberVars();
+ assign_const.setGlobalStaticMembersMemberVars(smmv);
+ }
+}
diff --git a/Examples/test-suite/java/assign_reference_runme.java b/Examples/test-suite/java/assign_reference_runme.java
new file mode 100644
index 000000000..113250a74
--- /dev/null
+++ b/Examples/test-suite/java/assign_reference_runme.java
@@ -0,0 +1,89 @@
+
+import assign_reference.*;
+
+public class assign_reference_runme {
+
+ static {
+ try {
+ System.loadLibrary("assign_reference");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ AssignPublic ap = new AssignPublic();
+ SWIGTYPE_p_int pint = ap.getPublicMember();
+ ap.setPublicMember(assign_reference.getGlobalIntRef());
+
+ MemberVars mv = new MemberVars();
+
+ // (1) Test directly non-assignable member variables
+ // These will only have getters
+ AssignPublic a1 = mv.getMemberPublic();
+ AssignProtected a2 = mv.getMemberProtected();
+ AssignPrivate a3 = mv.getMemberPrivate();
+
+ // (2) Test indirectly non-assignable member variables via inheritance
+ InheritedMemberVars imv = new InheritedMemberVars();
+ // These will only have getters
+ AssignPublicDerived a4 = imv.getMemberPublicDerived();
+ AssignProtectedDerived a5 = imv.getMemberProtectedDerived();
+ AssignPrivateDerived a6 = imv.getMemberPrivateDerived();
+
+ AssignPublicDerived sa4 = InheritedMemberVars.getStaticMemberPublicDerived();
+ AssignProtectedDerived sa5 = InheritedMemberVars.getStaticMemberProtectedDerived();
+ AssignPrivateDerived sa6 = InheritedMemberVars.getStaticMemberPrivateDerived();
+
+ AssignPublicDerived ga4 = assign_reference.getGlobalPublicDerived();
+ AssignProtectedDerived ga5 = assign_reference.getGlobalProtectedDerived();
+ AssignPrivateDerived ga6 = assign_reference.getGlobalPrivateDerived();
+
+ // These will have getters and setters
+ AssignPublicDerivedSettable a7 = imv.getMemberPublicDerivedSettable();
+ imv.setMemberPublicDerivedSettable(a7);
+ AssignProtectedDerivedSettable a8 = imv.getMemberProtectedDerivedSettable();
+ imv.setMemberProtectedDerivedSettable(a8);
+ AssignPrivateDerivedSettable a9 = imv.getMemberPrivateDerivedSettable();
+ imv.setMemberPrivateDerivedSettable(a9);
+
+ AssignPublicDerivedSettable sa7 = InheritedMemberVars.getStaticMemberPublicDerivedSettable();
+ InheritedMemberVars.setStaticMemberPublicDerivedSettable(sa7);
+ AssignProtectedDerivedSettable sa8 = InheritedMemberVars.getStaticMemberProtectedDerivedSettable();
+ InheritedMemberVars.setStaticMemberProtectedDerivedSettable(sa8);
+ AssignPrivateDerivedSettable sa9 = InheritedMemberVars.getStaticMemberPrivateDerivedSettable();
+ InheritedMemberVars.setStaticMemberPrivateDerivedSettable(sa9);
+
+ AssignPublicDerivedSettable ga7 = assign_reference.getGlobalPublicDerivedSettable();
+ assign_reference.setGlobalPublicDerivedSettable(ga7);
+ AssignProtectedDerivedSettable ga8 = assign_reference.getGlobalProtectedDerivedSettable();
+ assign_reference.setGlobalProtectedDerivedSettable(ga8);
+ AssignPrivateDerivedSettable ga9 = assign_reference.getGlobalPrivateDerivedSettable();
+ assign_reference.setGlobalPrivateDerivedSettable(ga9);
+
+ // (3) Test indirectly non-assignable member variables via classes that themselves have non-assignable member variables
+ MembersMemberVars m = new MembersMemberVars();
+
+ // These will only have getters
+ MemberPublicVar mpv1 = m.getMemberPublic();
+ MemberProtectedVar mpv2 = m.getMemberProtected();
+ MemberPrivateVar mpv3 = m.getMemberPrivate();
+
+ MemberPublicVar smpv1 = StaticMembersMemberVars.getStaticMemberPublic();
+ MemberProtectedVar smpv2 = StaticMembersMemberVars.getStaticMemberProtected();
+ MemberPrivateVar smpv3 = StaticMembersMemberVars.getStaticMemberPrivate();
+
+ MemberPublicVar gmpv1 = assign_reference.getGlobalMemberPublic();
+ MemberProtectedVar gmpv2 = assign_reference.getGlobalMemberProtected();
+ MemberPrivateVar gmpv3 = assign_reference.getGlobalMemberPrivate();
+
+ // Setters and getters available
+ StaticMembersMemberVarsHolder smmvh = new StaticMembersMemberVarsHolder();
+ StaticMembersMemberVars member = smmvh.getMember();
+ smmvh.setMember(member);
+
+ StaticMembersMemberVars smmv = assign_reference.getGlobalStaticMembersMemberVars();
+ assign_reference.setGlobalStaticMembersMemberVars(smmv);
+ }
+}
diff --git a/Examples/test-suite/java/catches_strings_runme.java b/Examples/test-suite/java/catches_strings_runme.java
new file mode 100644
index 000000000..75e0cf043
--- /dev/null
+++ b/Examples/test-suite/java/catches_strings_runme.java
@@ -0,0 +1,41 @@
+import catches_strings.*;
+
+public class catches_strings_runme {
+ static {
+ try {
+ System.loadLibrary("catches_strings");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) throws Throwable
+ {
+ {
+ boolean exception_thrown = false;
+ try {
+ StringsThrower.charstring();
+ } catch (RuntimeException e) {
+ if (!e.getMessage().contains("charstring message"))
+ throw new RuntimeException("incorrect exception message");
+ exception_thrown = true;
+ }
+ if (!exception_thrown)
+ throw new RuntimeException("Should have thrown an exception");
+ }
+
+ {
+ boolean exception_thrown = false;
+ try {
+ StringsThrower.stdstring();
+ } catch (RuntimeException e) {
+ if (!e.getMessage().contains("stdstring message"))
+ throw new RuntimeException("incorrect exception message");
+ exception_thrown = true;
+ }
+ if (!exception_thrown)
+ throw new RuntimeException("Should have thrown an exception");
+ }
+ }
+}
diff --git a/Examples/test-suite/java/constructor_copy_non_const_runme.java b/Examples/test-suite/java/constructor_copy_non_const_runme.java
new file mode 100644
index 000000000..8ed86f769
--- /dev/null
+++ b/Examples/test-suite/java/constructor_copy_non_const_runme.java
@@ -0,0 +1,30 @@
+import constructor_copy_non_const.*;
+
+public class constructor_copy_non_const_runme {
+
+ static {
+ try {
+ System.loadLibrary("constructor_copy_non_const");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ {
+ CCBase2 ccb2 = new CCBase2(new CCBase2());
+ CCDerived ccd = new CCDerived(new CCDerived());
+ CCMoreDerived ccmd = new CCMoreDerived(new CCMoreDerived());
+ CCMoreDerived2 ccmd2 = new CCMoreDerived2(new CCMoreDerived2());
+ CCMoreMoreDerived2 ccmmd2 = new CCMoreMoreDerived2(new CCMoreMoreDerived2());
+ }
+ {
+ // no copy ctor CCProtectedBase2
+ CCProtectedDerived ccd = new CCProtectedDerived(new CCProtectedDerived());
+ CCProtectedMoreDerived ccmd = new CCProtectedMoreDerived(new CCProtectedMoreDerived());
+ CCProtectedMoreDerived2 ccmd2 = new CCProtectedMoreDerived2(new CCProtectedMoreDerived2());
+ CCProtectedMoreMoreDerived2 ccmmd2 = new CCProtectedMoreMoreDerived2(new CCProtectedMoreMoreDerived2());
+ }
+ }
+}
diff --git a/Examples/test-suite/java/copyctor_runme.java b/Examples/test-suite/java/copyctor_runme.java
new file mode 100644
index 000000000..e30d0a5fc
--- /dev/null
+++ b/Examples/test-suite/java/copyctor_runme.java
@@ -0,0 +1,27 @@
+import copyctor.*;
+
+public class copyctor_runme {
+
+ static {
+ try {
+ System.loadLibrary("copyctor");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ Bar bar = new Bar();
+ bar = new Bar(bar);
+
+ Foo foo = new Foo();
+ foo = new Foo(bar);
+
+ Car car = new Car();
+
+ Hoo hoo = new Hoo();
+ hoo = new Hoo(bar);
+ hoo = new Hoo(car);
+ }
+}
diff --git a/Examples/test-suite/java/cpp11_assign_delete_runme.java b/Examples/test-suite/java/cpp11_assign_delete_runme.java
new file mode 100644
index 000000000..c15632457
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_assign_delete_runme.java
@@ -0,0 +1,118 @@
+
+import cpp11_assign_delete.*;
+
+public class cpp11_assign_delete_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_assign_delete");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ MemberVars mv = new MemberVars();
+ MemberArrayVars mav = new MemberArrayVars();
+
+ // (1) Test directly non-assignable member variables
+ // These will only have getters
+ AssignPublic a1 = mv.getMemberPublic();
+ AssignProtected a2 = mv.getMemberProtected();
+ AssignPrivate a3 = mv.getMemberPrivate();
+
+ AssignPublic ma1 = mav.getArrayMemberPublic();
+ AssignProtected ma2 = mav.getArrayMemberProtected();
+ AssignPrivate ma3 = mav.getArrayMemberPrivate();
+
+ // (2) Test indirectly non-assignable member variables via inheritance
+ InheritedMemberVars imv = new InheritedMemberVars();
+ // These will only have getters
+ AssignPublicDerived a4 = imv.getMemberPublicDerived();
+ AssignProtectedDerived a5 = imv.getMemberProtectedDerived();
+ AssignPrivateDerived a6 = imv.getMemberPrivateDerived();
+
+ AssignPublicDerived sa4 = InheritedMemberVars.getStaticMemberPublicDerived();
+ AssignProtectedDerived sa5 = InheritedMemberVars.getStaticMemberProtectedDerived();
+ AssignPrivateDerived sa6 = InheritedMemberVars.getStaticMemberPrivateDerived();
+
+ AssignPublicDerived ga4 = cpp11_assign_delete.getGlobalPublicDerived();
+ AssignProtectedDerived ga5 = cpp11_assign_delete.getGlobalProtectedDerived();
+ AssignPrivateDerived ga6 = cpp11_assign_delete.getGlobalPrivateDerived();
+
+ // These will have getters and setters
+ AssignPublicDerivedSettable a7 = imv.getMemberPublicDerivedSettable();
+ imv.setMemberPublicDerivedSettable(a7);
+ AssignProtectedDerivedSettable a8 = imv.getMemberProtectedDerivedSettable();
+ imv.setMemberProtectedDerivedSettable(a8);
+ AssignPrivateDerivedSettable a9 = imv.getMemberPrivateDerivedSettable();
+ imv.setMemberPrivateDerivedSettable(a9);
+
+ AssignPublicDerivedSettable sa7 = InheritedMemberVars.getStaticMemberPublicDerivedSettable();
+ InheritedMemberVars.setStaticMemberPublicDerivedSettable(sa7);
+ AssignProtectedDerivedSettable sa8 = InheritedMemberVars.getStaticMemberProtectedDerivedSettable();
+ InheritedMemberVars.setStaticMemberProtectedDerivedSettable(sa8);
+ AssignPrivateDerivedSettable sa9 = InheritedMemberVars.getStaticMemberPrivateDerivedSettable();
+ InheritedMemberVars.setStaticMemberPrivateDerivedSettable(sa9);
+
+ AssignPublicDerivedSettable ga7 = cpp11_assign_delete.getGlobalPublicDerivedSettable();
+ cpp11_assign_delete.setGlobalPublicDerivedSettable(ga7);
+ AssignProtectedDerivedSettable ga8 = cpp11_assign_delete.getGlobalProtectedDerivedSettable();
+ cpp11_assign_delete.setGlobalProtectedDerivedSettable(ga8);
+ AssignPrivateDerivedSettable ga9 = cpp11_assign_delete.getGlobalPrivateDerivedSettable();
+ cpp11_assign_delete.setGlobalPrivateDerivedSettable(ga9);
+
+ // (3) Test indirectly non-assignable member variables via classes that themselves have non-assignable member variables
+ {
+ MembersMemberVars m = new MembersMemberVars();
+
+ // These will only have getters
+ MemberPublicVar mpv1 = m.getMemberPublic();
+ MemberProtectedVar mpv2 = m.getMemberProtected();
+ MemberPrivateVar mpv3 = m.getMemberPrivate();
+
+ MemberPublicVar smpv1 = StaticMembersMemberVars.getStaticMemberPublic();
+ MemberProtectedVar smpv2 = StaticMembersMemberVars.getStaticMemberProtected();
+ MemberPrivateVar smpv3 = StaticMembersMemberVars.getStaticMemberPrivate();
+
+ MemberPublicVar gmpv1 = cpp11_assign_delete.getGlobalMemberPublic();
+ MemberProtectedVar gmpv2 = cpp11_assign_delete.getGlobalMemberProtected();
+ MemberPrivateVar gmpv3 = cpp11_assign_delete.getGlobalMemberPrivate();
+
+ // Setters and getters available
+ StaticMembersMemberVarsHolder smmvh = new StaticMembersMemberVarsHolder();
+ StaticMembersMemberVars member = smmvh.getMember();
+ smmvh.setMember(member);
+
+ StaticMembersMemberVars smmv = cpp11_assign_delete.getGlobalStaticMembersMemberVars();
+ cpp11_assign_delete.setGlobalStaticMembersMemberVars(smmv);
+ }
+
+ // (4) Test indirectly non-assignable member variables via classes that themselves have non-assignable array member variables
+ {
+ MembersMemberArrayVars m = new MembersMemberArrayVars();
+
+ // These will only have getters
+ MemberPublicArrayVar mpv1 = m.getMemberPublic();
+ MemberProtectedArrayVar mpv2 = m.getMemberProtected();
+ MemberPrivateArrayVar mpv3 = m.getMemberPrivate();
+
+ MemberPublicArrayVar smpv1 = StaticMembersMemberArrayVars.getStaticMemberPublic();
+ MemberProtectedArrayVar smpv2 = StaticMembersMemberArrayVars.getStaticMemberProtected();
+ MemberPrivateArrayVar smpv3 = StaticMembersMemberArrayVars.getStaticMemberPrivate();
+
+ MemberPublicArrayVar gmpv1 = cpp11_assign_delete.getGlobalArrayMemberPublic();
+ MemberProtectedArrayVar gmpv2 = cpp11_assign_delete.getGlobalArrayMemberProtected();
+ MemberPrivateArrayVar gmpv3 = cpp11_assign_delete.getGlobalArrayMemberPrivate();
+
+ // Setters and getters available
+ StaticMembersMemberArrayVarsHolder smmvh = new StaticMembersMemberArrayVarsHolder();
+ StaticMembersMemberArrayVars member = smmvh.getMember();
+ smmvh.setMember(member);
+
+ StaticMembersMemberArrayVars smmv = cpp11_assign_delete.getGlobalStaticMembersMemberArrayVars();
+ cpp11_assign_delete.setGlobalStaticMembersMemberArrayVars(smmv);
+ }
+ }
+}
diff --git a/Examples/test-suite/java/cpp11_assign_rvalue_reference_runme.java b/Examples/test-suite/java/cpp11_assign_rvalue_reference_runme.java
new file mode 100644
index 000000000..87c06222e
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_assign_rvalue_reference_runme.java
@@ -0,0 +1,89 @@
+
+import cpp11_assign_rvalue_reference.*;
+
+public class cpp11_assign_rvalue_reference_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_assign_rvalue_reference");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ AssignPublic ap = new AssignPublic();
+ SWIGTYPE_p_int pint = ap.getPublicMember();
+ ap.setPublicMember(cpp11_assign_rvalue_reference.getAnIntRValueRef());
+
+ MemberVars mv = new MemberVars();
+
+ // (1) Test directly non-assignable member variables
+ // These will only have getters
+ AssignPublic a1 = mv.getMemberPublic();
+ AssignProtected a2 = mv.getMemberProtected();
+ AssignPrivate a3 = mv.getMemberPrivate();
+
+ // (2) Test indirectly non-assignable member variables via inheritance
+ InheritedMemberVars imv = new InheritedMemberVars();
+ // These will only have getters
+ AssignPublicDerived a4 = imv.getMemberPublicDerived();
+ AssignProtectedDerived a5 = imv.getMemberProtectedDerived();
+ AssignPrivateDerived a6 = imv.getMemberPrivateDerived();
+
+ AssignPublicDerived sa4 = InheritedMemberVars.getStaticMemberPublicDerived();
+ AssignProtectedDerived sa5 = InheritedMemberVars.getStaticMemberProtectedDerived();
+ AssignPrivateDerived sa6 = InheritedMemberVars.getStaticMemberPrivateDerived();
+
+ AssignPublicDerived ga4 = cpp11_assign_rvalue_reference.getGlobalPublicDerived();
+ AssignProtectedDerived ga5 = cpp11_assign_rvalue_reference.getGlobalProtectedDerived();
+ AssignPrivateDerived ga6 = cpp11_assign_rvalue_reference.getGlobalPrivateDerived();
+
+ // These will have getters and setters
+ AssignPublicDerivedSettable a7 = imv.getMemberPublicDerivedSettable();
+ imv.setMemberPublicDerivedSettable(a7);
+ AssignProtectedDerivedSettable a8 = imv.getMemberProtectedDerivedSettable();
+ imv.setMemberProtectedDerivedSettable(a8);
+ AssignPrivateDerivedSettable a9 = imv.getMemberPrivateDerivedSettable();
+ imv.setMemberPrivateDerivedSettable(a9);
+
+ AssignPublicDerivedSettable sa7 = InheritedMemberVars.getStaticMemberPublicDerivedSettable();
+ InheritedMemberVars.setStaticMemberPublicDerivedSettable(sa7);
+ AssignProtectedDerivedSettable sa8 = InheritedMemberVars.getStaticMemberProtectedDerivedSettable();
+ InheritedMemberVars.setStaticMemberProtectedDerivedSettable(sa8);
+ AssignPrivateDerivedSettable sa9 = InheritedMemberVars.getStaticMemberPrivateDerivedSettable();
+ InheritedMemberVars.setStaticMemberPrivateDerivedSettable(sa9);
+
+ AssignPublicDerivedSettable ga7 = cpp11_assign_rvalue_reference.getGlobalPublicDerivedSettable();
+ cpp11_assign_rvalue_reference.setGlobalPublicDerivedSettable(ga7);
+ AssignProtectedDerivedSettable ga8 = cpp11_assign_rvalue_reference.getGlobalProtectedDerivedSettable();
+ cpp11_assign_rvalue_reference.setGlobalProtectedDerivedSettable(ga8);
+ AssignPrivateDerivedSettable ga9 = cpp11_assign_rvalue_reference.getGlobalPrivateDerivedSettable();
+ cpp11_assign_rvalue_reference.setGlobalPrivateDerivedSettable(ga9);
+
+ // (3) Test indirectly non-assignable member variables via classes that themselves have non-assignable member variables
+ MembersMemberVars m = new MembersMemberVars();
+
+ // These will only have getters
+ MemberPublicVar mpv1 = m.getMemberPublic();
+ MemberProtectedVar mpv2 = m.getMemberProtected();
+ MemberPrivateVar mpv3 = m.getMemberPrivate();
+
+ MemberPublicVar smpv1 = StaticMembersMemberVars.getStaticMemberPublic();
+ MemberProtectedVar smpv2 = StaticMembersMemberVars.getStaticMemberProtected();
+ MemberPrivateVar smpv3 = StaticMembersMemberVars.getStaticMemberPrivate();
+
+ MemberPublicVar gmpv1 = cpp11_assign_rvalue_reference.getGlobalMemberPublic();
+ MemberProtectedVar gmpv2 = cpp11_assign_rvalue_reference.getGlobalMemberProtected();
+ MemberPrivateVar gmpv3 = cpp11_assign_rvalue_reference.getGlobalMemberPrivate();
+
+ // Setters and getters available
+ StaticMembersMemberVarsHolder smmvh = new StaticMembersMemberVarsHolder();
+ StaticMembersMemberVars member = smmvh.getMember();
+ smmvh.setMember(member);
+
+ StaticMembersMemberVars smmv = cpp11_assign_rvalue_reference.getGlobalStaticMembersMemberVars();
+ cpp11_assign_rvalue_reference.setGlobalStaticMembersMemberVars(smmv);
+ }
+}
diff --git a/Examples/test-suite/java/cpp11_brackets_expression_runme.java b/Examples/test-suite/java/cpp11_brackets_expression_runme.java
new file mode 100644
index 000000000..fdd8e00ac
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_brackets_expression_runme.java
@@ -0,0 +1,24 @@
+import cpp11_brackets_expression.*;
+
+public class cpp11_brackets_expression_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_brackets_expression");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ long x = Piece.kMaxSize;
+ x = Piece.SimpleAsYouExpect123;
+ x = Piece.Just123;
+ x = cpp11_brackets_expression.getKMaxSizeGlobal();
+
+ x = cpp11_brackets_expression.getKMaxSizeGlobal();
+ x = cpp11_brackets_expression.global_as_you_expect(123);
+ x = cpp11_brackets_expression.global_one_two_three();
+ }
+}
diff --git a/Examples/test-suite/java/cpp11_copyctor_delete_runme.java b/Examples/test-suite/java/cpp11_copyctor_delete_runme.java
new file mode 100644
index 000000000..ed9d28904
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_copyctor_delete_runme.java
@@ -0,0 +1,29 @@
+import cpp11_copyctor_delete.*;
+
+public class cpp11_copyctor_delete_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_copyctor_delete");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ // check copy constructors are generated
+ new CopyCtorDeletedPublic1(CopyCtorDeletedPublic1.make());
+ new CopyCtorDeletedProtected1(CopyCtorDeletedProtected1.make());
+ new CopyCtorDeletedPrivate1(CopyCtorDeletedPrivate1.make());
+
+ new DeletedPublic4();
+ new DeletedPublic5();
+ new CopyCtorDeletedPublic4();
+ new CopyCtorDeletedPublic5();
+
+ new StackOnly1();
+ new CopyCtorStackOnly1(new CopyCtorStackOnly1());
+ }
+}
diff --git a/Examples/test-suite/java/cpp11_default_delete_runme.java b/Examples/test-suite/java/cpp11_default_delete_runme.java
new file mode 100644
index 000000000..73d151a91
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_default_delete_runme.java
@@ -0,0 +1,28 @@
+import cpp11_default_delete.*;
+
+public class cpp11_default_delete_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_default_delete");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ sometype st = new sometype(22.2);
+ sometype.take(st);
+ st = sometype.make(33.3);
+
+ sometype2 st2 = new sometype2(22.2);
+ sometype2.take(st2);
+ st2 = sometype2.make(33.3);
+
+ sometype3 st3 = sometype3.make(22);
+ sometype3.take(st3);
+ st3 = sometype3.make(33);
+ }
+}
+
diff --git a/Examples/test-suite/java/cpp11_director_using_constructor_runme.java b/Examples/test-suite/java/cpp11_director_using_constructor_runme.java
new file mode 100644
index 000000000..e1508a975
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_director_using_constructor_runme.java
@@ -0,0 +1,323 @@
+
+import cpp11_director_using_constructor.*;
+
+public class cpp11_director_using_constructor_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_director_using_constructor");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ // This is a copy of cpp11_using_constructor_runme.java for testing that the expected constructors can be called
+
+ // Public base constructors
+ new PublicDerived1(0, "hi").meth();
+ new PublicDerived2().meth();
+ new PublicDerived2(0, "hi").meth();
+ new PublicDerived3().meth();
+ new PublicDerived3(0, "hi").meth();
+ new PublicDerived4().meth();
+ new PublicDerived5().meth();
+
+ // Protected base constructors
+ // Cannot test most of these as the constructors are protected
+ new ProtectedDerived5();
+
+ // Mix of public and overloaded constructors
+ new MixedDerived1a(0, "hi").meth();
+ new MixedDerived1a().meth();
+ new MixedDerived1b(0, "hi").meth();
+ new MixedDerived1b().meth();
+
+ new MixedDerived2a(0, "hi").meth();
+ new MixedDerived2a().meth();
+ new MixedDerived2b(0, "hi").meth();
+ new MixedDerived2b().meth();
+
+ new MixedDerived2c(0, "hi").meth();
+ new MixedDerived2c().meth();
+ new MixedDerived2c(0).meth();
+
+ new MixedDerived2d(0, "hi").meth();
+ new MixedDerived2d().meth();
+ new MixedDerived2d(0).meth();
+
+ new MixedDerived3a(0, "hi").meth();
+ new MixedDerived3a().meth();
+ new MixedDerived3b(0, "hi").meth();
+ new MixedDerived3b().meth();
+
+ new MixedDerived3c(0, "hi").meth();
+ new MixedDerived3c().meth();
+ new MixedDerived3c(0).meth();
+
+ new MixedDerived3d(0, "hi").meth();
+ new MixedDerived3d().meth();
+ new MixedDerived3d(0).meth();
+
+ new MixedDerived4a(0, "hi").meth();
+ new MixedDerived4a().meth();
+ new MixedDerived4b(0, "hi").meth();
+ new MixedDerived4b().meth();
+
+ new MixedDerived4c().meth();
+ new MixedDerived4c(0).meth();
+
+ new MixedDerived4d().meth();
+ new MixedDerived4d(0).meth();
+
+ new MixedDerived4e().meth();
+
+ new MixedDerived4f().meth();
+
+ // Mix of protected base constructors and overloading
+ new ProotDerived1a().meth();
+
+ new ProotDerived1b(0, "hi").meth();
+ new ProotDerived1b().meth();
+
+ new ProotDerived1c(0, "hi").meth();
+ new ProotDerived1c().meth();
+
+ new ProotDerived1d(0).meth();
+ new ProotDerived1d().meth();
+
+ new ProotDerived1e(0).meth();
+ new ProotDerived1e().meth();
+
+ new ProotDerived2a(0, "hi").meth();
+
+ new ProotDerived2b(0, "hi").meth();
+
+ new ProotDerived2c(0, "hi").meth();
+ new ProotDerived2c().meth();
+
+ new ProotDerived2d(0, "hi").meth();
+ new ProotDerived2d().meth();
+
+ new ProotDerived2e(0, "hi").meth();
+ new ProotDerived2e().meth();
+
+ new ProotDerived2f(0, "hi").meth();
+ new ProotDerived2f().meth();
+ new ProotDerived2f(0).meth();
+
+ // Deeper inheritance chain
+ DeepBase3 db3 = new DeepBase3(11);
+ db3 = new DeepBase3(11, 22);
+ db3 = new DeepBase3(11, 22, 33);
+ DeepProtectedBase3 dbp3 = new DeepProtectedBase3(11, 22, 33);
+
+ // Missing base
+ new HiddenDerived1();
+
+ // Templates and public base constructors (derive from non-template)
+ new TemplatePublicDerived1Int(0, "hi").meth();
+ new TemplatePublicDerived2Int().meth();
+ new TemplatePublicDerived2Int(0, "hi").meth();
+ new TemplatePublicDerived3Int().meth();
+ new TemplatePublicDerived3Int(0, "hi").meth();
+ new TemplatePublicDerived4Int().meth();
+ new TemplatePublicDerived5Int().meth();
+
+ // Templates and public base constructors (derive from template)
+ new TemplPublicDerived1Int(0, "hi").meth();
+ new TemplPublicDerived2Int().meth();
+ new TemplPublicDerived2Int(0, "hi").meth();
+ new TemplPublicDerived3Int().meth();
+ new TemplPublicDerived3Int(0, "hi").meth();
+ new TemplPublicDerived4Int().meth();
+ new TemplPublicDerived5Int().meth();
+ new TemplPublicDerived6Int(0, "hi").meth();
+ new TemplPublicDerived6Int().meth();
+
+ // Templated constructors (public)
+ TemplateConstructor1Base tcb = new TemplateConstructor1Base(0, "hi");
+ tcb = new TemplateConstructor1Base("hi", "hi");
+ tcb = new TemplateConstructor1Base(11.1, "hi");
+ tcb.normal_method();
+ tcb.template_method(0, "hi");
+ tcb.template_method("hey", "ho");
+
+ TemplateConstructor1Derived tcd1 = new TemplateConstructor1Derived(0, "hi");
+ tcd1 = new TemplateConstructor1Derived("hi", "hi");
+ tcd1 = new TemplateConstructor1Derived(11.1, "hi");
+ // Not the best test as these are also in the base class, hence use also introspection below
+ tcd1.normal_method();
+ tcd1.template_method(0, "hi");
+ tcd1.template_method("hey", "ho");
+
+ // Templated methods
+ // Introspection to make sure these are actually generated in the derived class
+ try {
+ TemplateConstructor1Derived.class.getDeclaredMethod("normal_method", (java.lang.Class[])null);
+ TemplateConstructor1Derived.class.getDeclaredMethod("template_method", new java.lang.Class[]{String.class, String.class});
+ TemplateConstructor1Derived.class.getDeclaredMethod("template_method", new java.lang.Class[]{int.class, String.class});
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
+ }
+
+ // Templated constructors (protected)
+ TemplateConstructor2Derived tcd2 = new TemplateConstructor2Derived();
+ tcd2.normal_method();
+ tcd2.template_method(0, "hi");
+ tcd2.template_method("hey", "ho");
+ }
+
+ //
+ // Additional tests compared to cpp11_using_constructor test
+ //
+ // Protected constructors, check both protected and public constructors can be called from a derived class
+ class cpp11_director_using_constructor_MyProtectedBase1 extends ProtectedBase1 {
+ public cpp11_director_using_constructor_MyProtectedBase1(int i, String s) {
+ super(i, s);
+ }
+ }
+ class cpp11_director_using_constructor_MyProtectedDerived1 extends ProtectedDerived1 {
+ public cpp11_director_using_constructor_MyProtectedDerived1(int i, String s) {
+ super(i, s);
+ }
+ }
+ class cpp11_director_using_constructor_MyProtectedBase2 extends ProtectedBase2 {
+ public cpp11_director_using_constructor_MyProtectedBase2(int i, String s) {
+ super(i, s);
+ }
+ public cpp11_director_using_constructor_MyProtectedBase2() {
+ super();
+ }
+ }
+ class cpp11_director_using_constructor_MyProtectedDerived2 extends ProtectedDerived2 {
+ public cpp11_director_using_constructor_MyProtectedDerived2(int i, String s) {
+ super(i, s);
+ }
+ public cpp11_director_using_constructor_MyProtectedDerived2() {
+ super();
+ }
+ }
+ class cpp11_director_using_constructor_MyProtectedBase3 extends ProtectedBase3 {
+ public cpp11_director_using_constructor_MyProtectedBase3(int i, String s) {
+ super(i, s);
+ }
+ public cpp11_director_using_constructor_MyProtectedBase3() {
+ super();
+ }
+ }
+ class cpp11_director_using_constructor_MyProtectedDerived3 extends ProtectedDerived3 {
+ public cpp11_director_using_constructor_MyProtectedDerived3(int i, String s) {
+ super(i, s);
+ }
+ public cpp11_director_using_constructor_MyProtectedDerived3() {
+ super();
+ }
+ }
+ class cpp11_director_using_constructor_MyProtectedBase4 extends ProtectedBase4 {
+ public cpp11_director_using_constructor_MyProtectedBase4() {
+ super();
+ }
+ }
+ class cpp11_director_using_constructor_MyProtectedDerived4 extends ProtectedDerived4 {
+ public cpp11_director_using_constructor_MyProtectedDerived4() {
+ super();
+ }
+ }
+ class cpp11_director_using_constructor_MyProtectedBase5 extends ProtectedBase5 {
+ public cpp11_director_using_constructor_MyProtectedBase5() {
+ super();
+ }
+ }
+ class cpp11_director_using_constructor_MyProtectedDerived5 extends ProtectedDerived5 {
+ public cpp11_director_using_constructor_MyProtectedDerived5() {
+ super();
+ }
+ }
+
+ // Protected constructors, just check the protected constructors can be called from a derived class
+ class cpp11_director_using_constructor_MyProotBase1 extends ProotBase1 {
+ public cpp11_director_using_constructor_MyProotBase1(int i, String s) {
+ super(i, s);
+ }
+ }
+ class cpp11_director_using_constructor_MyProotDerived1a extends ProotDerived1a {
+ public cpp11_director_using_constructor_MyProotDerived1a(int i, String s) {
+ super(i, s);
+ }
+ }
+ class cpp11_director_using_constructor_MyProotDerived1d extends ProotDerived1d {
+ public cpp11_director_using_constructor_MyProotDerived1d(int i, String s) {
+ super(i, s);
+ }
+ }
+ class cpp11_director_using_constructor_MyProotDerived1e extends ProotDerived1e {
+ public cpp11_director_using_constructor_MyProotDerived1e(int i, String s) {
+ super(i, s);
+ }
+ }
+
+ // Protected constructors, check both protected and public constructors can be called from a derived class
+ class cpp11_director_using_constructor_MyProotBase2 extends ProotBase2 {
+ public cpp11_director_using_constructor_MyProotBase2(int i, String s) {
+ super(i, s);
+ }
+ public cpp11_director_using_constructor_MyProotBase2() {
+ super();
+ }
+ }
+ class cpp11_director_using_constructor_MyProotDerived2a extends ProotDerived2a {
+ public cpp11_director_using_constructor_MyProotDerived2a(int i, String s) {
+ super(i, s);
+ }
+ public cpp11_director_using_constructor_MyProotDerived2a() {
+ super();
+ }
+ }
+ class cpp11_director_using_constructor_MyProotDerived2b extends ProotDerived2b {
+ public cpp11_director_using_constructor_MyProotDerived2b(int i, String s) {
+ super(i, s);
+ }
+ public cpp11_director_using_constructor_MyProotDerived2b() {
+ super();
+ }
+ }
+ class cpp11_director_using_constructor_MyProotDerived2c extends ProotDerived2c {
+ public cpp11_director_using_constructor_MyProotDerived2c(int i, String s) {
+ super(i, s);
+ }
+ public cpp11_director_using_constructor_MyProotDerived2c() {
+ super();
+ }
+ }
+ class cpp11_director_using_constructor_MyProotDerived2d extends ProotDerived2d {
+ public cpp11_director_using_constructor_MyProotDerived2d(int i, String s) {
+ super(i, s);
+ }
+ public cpp11_director_using_constructor_MyProotDerived2d() {
+ super();
+ }
+ }
+ class cpp11_director_using_constructor_MyProotDerived2e extends ProotDerived2e {
+ public cpp11_director_using_constructor_MyProotDerived2e(int i, String s) {
+ super(i, s);
+ }
+ public cpp11_director_using_constructor_MyProotDerived2e() {
+ super();
+ }
+ }
+ class cpp11_director_using_constructor_MyProotDerived2f extends ProotDerived2f {
+ public cpp11_director_using_constructor_MyProotDerived2f(int i, String s) {
+ super(i, s);
+ }
+ public cpp11_director_using_constructor_MyProotDerived2f() {
+ super();
+ }
+ public cpp11_director_using_constructor_MyProotDerived2f(int i) {
+ super(i);
+ }
+ }
+
+
+}
diff --git a/Examples/test-suite/java/cpp11_inheriting_constructors_runme.java b/Examples/test-suite/java/cpp11_inheriting_constructors_runme.java
new file mode 100644
index 000000000..5f00c64a4
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_inheriting_constructors_runme.java
@@ -0,0 +1,27 @@
+import cpp11_inheriting_constructors.*;
+
+public class cpp11_inheriting_constructors_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_inheriting_constructors");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ // Constructor inheritance via using declaration
+ DerivedClass d = new DerivedClass(10);
+ if (d.retrieveValue() != 10)
+ throw new RuntimeException("retrieveValue() failed");
+
+ // Member initialization at the site of the declaration
+ SomeClass s = new SomeClass();
+ if (s.getValue() != 5)
+ throw new RuntimeException("s.value failed");
+ }
+}
+
+
diff --git a/Examples/test-suite/java/cpp11_move_only_runme.java b/Examples/test-suite/java/cpp11_move_only_runme.java
new file mode 100644
index 000000000..8f0f2acef
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_move_only_runme.java
@@ -0,0 +1,51 @@
+
+import cpp11_move_only.*;
+
+public class cpp11_move_only_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_move_only");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+
+ // Output
+ {
+ Counter.reset_counts();
+ MoveOnly mo = MoveOnly.create();
+ mo.delete();
+ Counter.check_counts(1, 0, 0, 2, 0, 3);
+ }
+
+ {
+ Counter.reset_counts();
+ MovableCopyable mo = MovableCopyable.create();
+ mo.delete();
+ Counter.check_counts(2, 1, 0, 0, 1, 3);
+ }
+
+ // Move semantics not used
+ {
+ Counter.reset_counts();
+ MovableCopyable mo = MovableCopyable.createConst();
+ mo.delete();
+ Counter.check_counts(2, 1, 1, 0, 0, 3);
+ }
+
+ // Input
+ {
+ Counter.reset_counts();
+ MovableCopyable mo = new MovableCopyable(222);
+ Counter.check_counts(1, 0, 0, 0, 0, 0);
+ MovableCopyable.take(mo);
+ Counter.check_counts(2, 0, 1, 1, 0, 2);
+ mo.delete();
+ Counter.check_counts(2, 0, 1, 1, 0, 3);
+ }
+ }
+}
diff --git a/Examples/test-suite/java/cpp11_move_only_valuewrapper_runme.java b/Examples/test-suite/java/cpp11_move_only_valuewrapper_runme.java
new file mode 100644
index 000000000..c857a7b81
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_move_only_valuewrapper_runme.java
@@ -0,0 +1,44 @@
+import cpp11_move_only_valuewrapper.*;
+
+public class cpp11_move_only_valuewrapper_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_move_only_valuewrapper");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ Counter.reset_counts();
+ {
+ XXX xxx = cpp11_move_only_valuewrapper.createXXX();
+ xxx.delete();
+ }
+ if (cpp11_move_only_valuewrapper.has_cplusplus11())
+ // Was (1, 2, 0, 0, 0, 3) before SwigValueWrapper::operator=(T &&) was added.
+ // Was (1, 1, 0, 1, 0, 3) before SwigValueWrapper::operator T&&() was added with new "out" typemaps
+ Counter.check_counts(1, 0, 0, 2, 0, 3);
+ Counter.reset_counts();
+ {
+ XXX xxx = cpp11_move_only_valuewrapper.createXXX2();
+ xxx.delete();
+ }
+ if (cpp11_move_only_valuewrapper.has_cplusplus11())
+ Counter.check_counts(1, 0, 0, 2, 0, 3);
+ cpp11_move_only_valuewrapper.test1();
+ cpp11_move_only_valuewrapper.test2();
+ cpp11_move_only_valuewrapper.test3();
+ cpp11_move_only_valuewrapper.test4();
+ cpp11_move_only_valuewrapper.test5();
+ cpp11_move_only_valuewrapper.test6();
+
+ // Tests SwigValueWrapper, std::unique_ptr (SWIG not parsing a type that is move-only)
+ Counter.reset_counts();
+ SWIGTYPE_p_std__unique_ptrT_XXX_t ptr = cpp11_move_only_valuewrapper.makeUniqueXXX();
+ cpp11_move_only_valuewrapper.cleanup(ptr);
+ Counter.check_counts(1, 0, 0, 0, 0, 1);
+ }
+}
diff --git a/Examples/test-suite/java/cpp11_move_typemaps_runme.java b/Examples/test-suite/java/cpp11_move_typemaps_runme.java
new file mode 100644
index 000000000..1b5fd2e6c
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_move_typemaps_runme.java
@@ -0,0 +1,51 @@
+
+import cpp11_move_typemaps.*;
+
+public class cpp11_move_typemaps_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_move_typemaps");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ {
+ Counter.reset_counts();
+ MoveOnly mo = new MoveOnly(111);
+ Counter.check_counts(1, 0, 0, 0, 0, 0);
+ MoveOnly.take(mo);
+ Counter.check_counts(1, 0, 0, 1, 0, 2);
+ mo.delete();
+ }
+ Counter.check_counts(1, 0, 0, 1, 0, 2);
+
+ {
+ Counter.reset_counts();
+ MovableCopyable mo = new MovableCopyable(111);
+ Counter.check_counts(1, 0, 0, 0, 0, 0);
+ MovableCopyable.take(mo);
+ Counter.check_counts(1, 0, 0, 1, 0, 2);
+ mo.delete();
+ }
+ Counter.check_counts(1, 0, 0, 1, 0, 2);
+
+ {
+ MoveOnly mo = new MoveOnly(222);
+ MoveOnly.take(mo);
+ boolean exception_thrown = false;
+ try {
+ MoveOnly.take(mo);
+ } catch (RuntimeException e) {
+ if (!e.getMessage().contains("Cannot release ownership as memory is not owned"))
+ throw new RuntimeException("incorrect exception message");
+ exception_thrown = true;
+ }
+ if (!exception_thrown)
+ throw new RuntimeException("double usage of take should have been an error");
+ }
+ }
+}
diff --git a/Examples/test-suite/java/cpp11_rvalue_reference_move_runme.java b/Examples/test-suite/java/cpp11_rvalue_reference_move_runme.java
new file mode 100644
index 000000000..70ba2432f
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_rvalue_reference_move_runme.java
@@ -0,0 +1,97 @@
+
+import cpp11_rvalue_reference_move.*;
+
+public class cpp11_rvalue_reference_move_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_rvalue_reference_move");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+
+ {
+ // Function containing rvalue reference parameter
+ Counter.reset_counts();
+ MovableCopyable mo = new MovableCopyable(222);
+ Counter.check_counts(1, 0, 0, 0, 0, 0);
+ MovableCopyable.movein(mo);
+ Counter.check_counts(1, 0, 0, 1, 0, 2);
+ if (!MovableCopyable.is_nullptr(mo))
+ throw new RuntimeException("is_nullptr failed");
+ mo.delete();
+ Counter.check_counts(1, 0, 0, 1, 0, 2);
+ }
+
+ {
+ // Move constructor test
+ Counter.reset_counts();
+ MovableCopyable mo = new MovableCopyable(222);
+ Counter.check_counts(1, 0, 0, 0, 0, 0);
+ MovableCopyable mo_moved = new MovableCopyable(mo);
+ Counter.check_counts(1, 0, 0, 1, 0, 1);
+ if (!MovableCopyable.is_nullptr(mo))
+ throw new RuntimeException("is_nullptr failed");
+ mo.delete();
+ Counter.check_counts(1, 0, 0, 1, 0, 1);
+ mo_moved.delete();
+ Counter.check_counts(1, 0, 0, 1, 0, 2);
+ }
+
+ {
+ // Move assignment operator test
+ Counter.reset_counts();
+ MovableCopyable mo111 = new MovableCopyable(111);
+ MovableCopyable mo222 = new MovableCopyable(222);
+ Counter.check_counts(2, 0, 0, 0, 0, 0);
+ mo111.MoveAssign(mo222);
+ Counter.check_counts(2, 0, 0, 0, 1, 1);
+ if (!MovableCopyable.is_nullptr(mo222))
+ throw new RuntimeException("is_nullptr failed");
+ mo222.delete();
+ Counter.check_counts(2, 0, 0, 0, 1, 1);
+ mo111.delete();
+ Counter.check_counts(2, 0, 0, 0, 1, 2);
+ }
+
+ {
+ // null check
+ Counter.reset_counts();
+ boolean exception_thrown = false;
+ try {
+ MovableCopyable.movein(null);
+ } catch (NullPointerException e) {
+ if (!e.getMessage().contains("MovableCopyable && is null"))
+ throw new RuntimeException("incorrect exception message");
+ exception_thrown = true;
+ }
+ if (!exception_thrown)
+ throw new RuntimeException("Should have thrown null error");
+ Counter.check_counts(0, 0, 0, 0, 0, 0);
+ }
+
+ {
+ // output
+ Counter.reset_counts();
+ MovableCopyable mc = MovableCopyable.moveout(1234);
+ Counter.check_counts(2, 0, 0, 0, 1, 1);
+ MovableCopyable.check_numbers_match(mc, 1234);
+
+ boolean exception_thrown = false;
+ try {
+ MovableCopyable.movein(mc);
+ } catch (RuntimeException e) {
+ if (!e.getMessage().contains("Cannot release ownership as memory is not owned"))
+ throw new RuntimeException("incorrect exception message");
+ exception_thrown = true;
+ }
+ if (!exception_thrown)
+ throw new RuntimeException("Should have thrown 'Cannot release ownership as memory is not owned' error");
+ Counter.check_counts(2, 0, 0, 0, 1, 1);
+ }
+ }
+}
diff --git a/Examples/test-suite/java/cpp11_shared_ptr_template_upcast_runme.java b/Examples/test-suite/java/cpp11_shared_ptr_template_upcast_runme.java
new file mode 100644
index 000000000..2826f580d
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_shared_ptr_template_upcast_runme.java
@@ -0,0 +1,24 @@
+// This is the cpp11_shared_ptr_template_upcast runtime testcase. It checks that SWIG generates the appropriate upcasted shared_ptr type for a template instantiation deriving from a base class.
+// For this case, the expected behavior is: given a cptr with underlying type shared_ptr<Printable<Derived> >, PrintableDerived_SWIGSmartPtrUpcast returns a cptr with
+// underlying type std::shared_ptr< Derived >, where Printable<Derived> inherits from Derived.
+
+import cpp11_shared_ptr_template_upcast.*;
+
+public class cpp11_shared_ptr_template_upcast_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_shared_ptr_template_upcast");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ PrintableDerived pd = cpp11_shared_ptr_template_upcast.MakePrintableDerived(20);
+ pd.GetResult();
+ pd.GetFormatted();
+ }
+}
+
diff --git a/Examples/test-suite/java/cpp11_std_unique_ptr_runme.java b/Examples/test-suite/java/cpp11_std_unique_ptr_runme.java
new file mode 100644
index 000000000..f90ef7041
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_std_unique_ptr_runme.java
@@ -0,0 +1,146 @@
+import cpp11_std_unique_ptr.*;
+
+public class cpp11_std_unique_ptr_runme {
+ static {
+ try {
+ System.loadLibrary("cpp11_std_unique_ptr");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ private static void WaitForGC()
+ {
+ System.gc();
+ System.runFinalization();
+ try {
+ java.lang.Thread.sleep(10);
+ } catch (java.lang.InterruptedException e) {
+ }
+ }
+
+ private static void checkCount(int expected_count) {
+ int actual_count = Klass.getTotal_count();
+ if (actual_count != expected_count)
+ throw new RuntimeException("Counts incorrect, expected:" + expected_count + " actual:" + actual_count);
+ }
+
+ public static void main(String argv[]) throws Throwable
+ {
+ // Test raw pointer handling involving virtual inheritance
+ {
+ KlassInheritance kini = new KlassInheritance("KlassInheritanceInput");
+ checkCount(1);
+ String s = cpp11_std_unique_ptr.useKlassRawPtr(kini);
+ if (!s.equals("KlassInheritanceInput"))
+ throw new RuntimeException("Incorrect string: " + s);
+ kini.delete();
+ checkCount(0);
+ }
+
+ // unique_ptr as input
+ {
+ Klass kin = new Klass("KlassInput");
+ checkCount(1);
+ String s = cpp11_std_unique_ptr.takeKlassUniquePtr(kin);
+ checkCount(0);
+ if (!s.equals("KlassInput"))
+ throw new RuntimeException("Incorrect string: " + s);
+ if (!cpp11_std_unique_ptr.is_nullptr(kin))
+ throw new RuntimeException("is_nullptr failed");
+ kin.delete(); // Should not fail, even though already deleted
+ checkCount(0);
+ }
+
+ {
+ Klass kin = new Klass("KlassInput");
+ checkCount(1);
+ String s = cpp11_std_unique_ptr.takeKlassUniquePtr(kin);
+ checkCount(0);
+ if (!s.equals("KlassInput"))
+ throw new RuntimeException("Incorrect string: " + s);
+ if (!cpp11_std_unique_ptr.is_nullptr(kin))
+ throw new RuntimeException("is_nullptr failed");
+ boolean exception_thrown = false;
+ try {
+ cpp11_std_unique_ptr.takeKlassUniquePtr(kin);
+ } catch (RuntimeException e) {
+ if (!e.getMessage().contains("Cannot release ownership as memory is not owned"))
+ throw new RuntimeException("incorrect exception message");
+ exception_thrown = true;
+ }
+ if (!exception_thrown)
+ throw new RuntimeException("double usage of takeKlassUniquePtr should have been an error");
+ kin.delete(); // Should not fail, even though already deleted
+ checkCount(0);
+ }
+
+ {
+ Klass kin = new Klass("KlassInput");
+ boolean exception_thrown = false;
+ Klass notowned = cpp11_std_unique_ptr.get_not_owned_ptr(kin);
+ try {
+ cpp11_std_unique_ptr.takeKlassUniquePtr(notowned);
+ } catch (RuntimeException e) {
+ if (!e.getMessage().contains("Cannot release ownership as memory is not owned"))
+ throw new RuntimeException("incorrect exception message");
+ exception_thrown = true;
+ }
+ if (!exception_thrown)
+ throw new RuntimeException("Should have thrown 'Cannot release ownership as memory is not owned' error");
+ checkCount(1);
+ kin.delete();
+ checkCount(0);
+ }
+
+ {
+ KlassInheritance kini = new KlassInheritance("KlassInheritanceInput");
+ checkCount(1);
+ String s = cpp11_std_unique_ptr.takeKlassUniquePtr(kini);
+ checkCount(0);
+ if (!s.equals("KlassInheritanceInput"))
+ throw new RuntimeException("Incorrect string: " + s);
+ if (!cpp11_std_unique_ptr.is_nullptr(kini))
+ throw new RuntimeException("is_nullptr failed");
+ kini.delete(); // Should not fail, even though already deleted
+ checkCount(0);
+ }
+
+ cpp11_std_unique_ptr.takeKlassUniquePtr(null);
+ cpp11_std_unique_ptr.takeKlassUniquePtr(cpp11_std_unique_ptr.make_null());
+ checkCount(0);
+
+ // overloaded parameters
+ if (cpp11_std_unique_ptr.overloadTest() != 0)
+ throw new RuntimeException("overloadTest failed");
+ if (cpp11_std_unique_ptr.overloadTest(null) != 1)
+ throw new RuntimeException("overloadTest failed");
+ if (cpp11_std_unique_ptr.overloadTest(new Klass("over")) != 1)
+ throw new RuntimeException("overloadTest failed");
+ checkCount(0);
+
+
+ // unique_ptr as output
+ Klass k1 = cpp11_std_unique_ptr.makeKlassUniquePtr("first");
+ if (!k1.getLabel().equals("first"))
+ throw new RuntimeException("wrong object label");
+
+ Klass k2 = cpp11_std_unique_ptr.makeKlassUniquePtr("second");
+ checkCount(2);
+
+ k1.delete();
+ k1 = null;
+ checkCount(1);
+
+ if (!k2.getLabel().equals("second"))
+ throw new RuntimeException("wrong object label");
+
+ k2.delete();
+ k2 = null;
+ checkCount(0);
+
+ if (cpp11_std_unique_ptr.makeNullUniquePtr() != null)
+ throw new RuntimeException("null failure");
+ }
+}
diff --git a/Examples/test-suite/java/cpp11_template_parameters_decltype_runme.java b/Examples/test-suite/java/cpp11_template_parameters_decltype_runme.java
new file mode 100644
index 000000000..dd5fc2d25
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_template_parameters_decltype_runme.java
@@ -0,0 +1,45 @@
+import cpp11_template_parameters_decltype.*;
+
+public class cpp11_template_parameters_decltype_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_template_parameters_decltype");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ boolean show = false; // for debugging
+
+ cpp11_template_parameters_decltype.tester(show);
+ Json json0 = new Json("hi");
+ if (json0.getCtor() != 0)
+ throw new RuntimeException("json0 failed");
+ if (json0.mmm("bye") != 100)
+ throw new RuntimeException("json0.mmm failed");
+
+ Converter converter = new Converter();
+ Json json1 = new Json(converter);
+ if (json1.getCtor() != 1)
+ throw new RuntimeException("json1 failed");
+ if (json1.mmm(converter) != 101)
+ throw new RuntimeException("json1.mmm failed");
+
+ MapStringString myMapStringString = new MapStringString();
+ Json json2 = new Json(myMapStringString);
+ if (json2.getCtor() != 2)
+ throw new RuntimeException("json2 failed");
+ if (json2.mmm(myMapStringString) != 102)
+ throw new RuntimeException("json2.mmm failed");
+
+ VectorString myVectorString = new VectorString();
+ Json json3 = new Json(myVectorString);
+ if (json3.getCtor() != 3)
+ throw new RuntimeException("json3 failed");
+ if (json3.mmm(myVectorString) != 103)
+ throw new RuntimeException("json3.mmm failed");
+ }
+}
diff --git a/Examples/test-suite/java/cpp11_template_templated_methods_runme.java b/Examples/test-suite/java/cpp11_template_templated_methods_runme.java
new file mode 100644
index 000000000..dd087a040
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_template_templated_methods_runme.java
@@ -0,0 +1,81 @@
+
+import cpp11_template_templated_methods.*;
+
+public class cpp11_template_templated_methods_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_template_templated_methods");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ // assign test
+ {
+ OctetVector ov = new OctetVector();
+ octet o = new octet(111);
+ ov.add(o);
+ SimpleContainer sc = new SimpleContainer(ov);
+ OctetResourceLimitedVector orlv = new OctetResourceLimitedVector();
+ orlv.assign(sc.begin(), sc.end());
+ OctetVector collection = orlv.getCollection();
+ if (collection.size() != 1)
+ throw new RuntimeException("wrong size");
+ octet oo = collection.get(0);
+ if (oo.getNum() != 111)
+ throw new RuntimeException("wrong val");
+ }
+ // assign_and_append test
+ {
+ OctetVector ov = new OctetVector();
+ octet o = new octet(222);
+ ov.add(o);
+ SimpleContainer sc = new SimpleContainer(ov);
+ OctetResourceLimitedVector orlv = new OctetResourceLimitedVector();
+ octet final_octet = new octet(333);
+ orlv.assign_and_append(sc.begin(), sc.end(), final_octet);
+ OctetVector collection = orlv.getCollection();
+ if (collection.size() != 2)
+ throw new RuntimeException("wrong size");
+ octet oo = collection.get(0);
+ if (oo.getNum() != 222)
+ throw new RuntimeException("wrong val");
+ oo = collection.get(1);
+ if (oo.getNum() != 333)
+ throw new RuntimeException("wrong finalval");
+ }
+ // emplace_back test
+ {
+ OctetVector ov = new OctetVector();
+ octet o = new octet(222);
+ ov.add(o);
+ SimpleContainer sc = new SimpleContainer(ov);
+ OctetResourceLimitedVector orlv = new OctetResourceLimitedVector();
+ octet final_octet = new octet(444);
+ orlv.emplace_back(final_octet);
+ orlv.emplace_back();
+ orlv.emplace_back(555);
+ OctetVector collection = orlv.getCollection();
+ if (collection.size() != 3)
+ throw new RuntimeException("wrong size");
+ octet oo = collection.get(0);
+ if (oo.getNum() != 444)
+ throw new RuntimeException("wrong value 0");
+ oo = collection.get(1);
+ if (oo.getNum() != 0)
+ throw new RuntimeException("wrong value 1");
+ oo = collection.get(2);
+ if (oo.getNum() != 555)
+ throw new RuntimeException("wrong value 2");
+ }
+ // Variadic templated constructor in template
+ {
+ OctetResourceLimitedVector orlv = new OctetResourceLimitedVector(999);
+ octet o = new octet(888);
+ OctetResourceLimitedVector orlv2 = new OctetResourceLimitedVector(o);
+ }
+ }
+}
diff --git a/Examples/test-suite/java/cpp11_using_constructor_runme.java b/Examples/test-suite/java/cpp11_using_constructor_runme.java
new file mode 100644
index 000000000..fca19f19b
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_using_constructor_runme.java
@@ -0,0 +1,170 @@
+
+import cpp11_using_constructor.*;
+import java.lang.reflect.*;
+
+public class cpp11_using_constructor_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_using_constructor");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ // Public base constructors
+ new PublicDerived1(0, "hi").meth();
+ new PublicDerived2().meth();
+ new PublicDerived2(0, "hi").meth();
+ new PublicDerived3().meth();
+ new PublicDerived3(0, "hi").meth();
+ new PublicDerived4().meth();
+ new PublicDerived5().meth();
+
+ // Protected base constructors
+ // Cannot test most of these as the constructors are protected
+ new ProtectedDerived5();
+
+ // Mix of public and overloaded constructors
+ new MixedDerived1a(0, "hi").meth();
+ new MixedDerived1a().meth();
+ new MixedDerived1b(0, "hi").meth();
+ new MixedDerived1b().meth();
+
+ new MixedDerived2a(0, "hi").meth();
+ new MixedDerived2a().meth();
+ new MixedDerived2b(0, "hi").meth();
+ new MixedDerived2b().meth();
+
+ new MixedDerived2c(0, "hi").meth();
+ new MixedDerived2c().meth();
+ new MixedDerived2c(0).meth();
+
+ new MixedDerived2d(0, "hi").meth();
+ new MixedDerived2d().meth();
+ new MixedDerived2d(0).meth();
+
+ new MixedDerived3a(0, "hi").meth();
+ new MixedDerived3a().meth();
+ new MixedDerived3b(0, "hi").meth();
+ new MixedDerived3b().meth();
+
+ new MixedDerived3c(0, "hi").meth();
+ new MixedDerived3c().meth();
+ new MixedDerived3c(0).meth();
+
+ new MixedDerived3d(0, "hi").meth();
+ new MixedDerived3d().meth();
+ new MixedDerived3d(0).meth();
+
+ new MixedDerived4a(0, "hi").meth();
+ new MixedDerived4a().meth();
+ new MixedDerived4b(0, "hi").meth();
+ new MixedDerived4b().meth();
+
+ new MixedDerived4c().meth();
+ new MixedDerived4c(0).meth();
+
+ new MixedDerived4d().meth();
+ new MixedDerived4d(0).meth();
+
+ new MixedDerived4e().meth();
+
+ new MixedDerived4f().meth();
+
+ // Mix of protected base constructors and overloading
+ new ProotDerived1a().meth();
+
+ new ProotDerived1b(0, "hi").meth();
+ new ProotDerived1b().meth();
+
+ new ProotDerived1c(0, "hi").meth();
+ new ProotDerived1c().meth();
+
+ new ProotDerived1d(0).meth();
+ new ProotDerived1d().meth();
+
+ new ProotDerived1e(0).meth();
+ new ProotDerived1e().meth();
+
+ new ProotDerived2a(0, "hi").meth();
+
+ new ProotDerived2b(0, "hi").meth();
+
+ new ProotDerived2c(0, "hi").meth();
+ new ProotDerived2c().meth();
+
+ new ProotDerived2d(0, "hi").meth();
+ new ProotDerived2d().meth();
+
+ new ProotDerived2e(0, "hi").meth();
+ new ProotDerived2e().meth();
+
+ new ProotDerived2f(0, "hi").meth();
+ new ProotDerived2f().meth();
+ new ProotDerived2f(0).meth();
+
+ // Deeper inheritance chain
+ DeepBase3 db3 = new DeepBase3(11);
+ db3 = new DeepBase3(11, 22);
+ db3 = new DeepBase3(11, 22, 33);
+ DeepProtectedBase3 dbp3 = new DeepProtectedBase3(11, 22, 33);
+
+ // Missing base
+ new HiddenDerived1();
+
+ // Templates and public base constructors (derive from non-template)
+ new TemplatePublicDerived1Int(0, "hi").meth();
+ new TemplatePublicDerived2Int().meth();
+ new TemplatePublicDerived2Int(0, "hi").meth();
+ new TemplatePublicDerived3Int().meth();
+ new TemplatePublicDerived3Int(0, "hi").meth();
+ new TemplatePublicDerived4Int().meth();
+ new TemplatePublicDerived5Int().meth();
+
+ // Templates and public base constructors (derive from template)
+ new TemplPublicDerived1Int(0, "hi").meth();
+ new TemplPublicDerived2Int().meth();
+ new TemplPublicDerived2Int(0, "hi").meth();
+ new TemplPublicDerived3Int().meth();
+ new TemplPublicDerived3Int(0, "hi").meth();
+ new TemplPublicDerived4Int().meth();
+ new TemplPublicDerived5Int().meth();
+ new TemplPublicDerived6Int(0, "hi").meth();
+ new TemplPublicDerived6Int().meth();
+
+ // Templated constructors (public)
+ TemplateConstructor1Base tcb = new TemplateConstructor1Base(0, "hi");
+ tcb = new TemplateConstructor1Base("hi", "hi");
+ tcb = new TemplateConstructor1Base(11.1, "hi");
+ tcb.normal_method();
+ tcb.template_method(0, "hi");
+ tcb.template_method("hey", "ho");
+
+ TemplateConstructor1Derived tcd1 = new TemplateConstructor1Derived(0, "hi");
+ tcd1 = new TemplateConstructor1Derived("hi", "hi");
+ tcd1 = new TemplateConstructor1Derived(11.1, "hi");
+ // Not the best test as these are also in the base class, hence use also introspection below
+ tcd1.normal_method();
+ tcd1.template_method(0, "hi");
+ tcd1.template_method("hey", "ho");
+
+ // Templated methods
+ // Introspection to make sure these are actually generated in the derived class
+ try {
+ TemplateConstructor1Derived.class.getDeclaredMethod("normal_method", (java.lang.Class[])null);
+ TemplateConstructor1Derived.class.getDeclaredMethod("template_method", new java.lang.Class[]{String.class, String.class});
+ TemplateConstructor1Derived.class.getDeclaredMethod("template_method", new java.lang.Class[]{int.class, String.class});
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
+ }
+
+ // Templated constructors (protected)
+ TemplateConstructor2Derived tcd2 = new TemplateConstructor2Derived();
+ tcd2.normal_method();
+ tcd2.template_method(0, "hi");
+ tcd2.template_method("hey", "ho");
+ }
+}
diff --git a/Examples/test-suite/java/cpp17_director_string_view_runme.java b/Examples/test-suite/java/cpp17_director_string_view_runme.java
new file mode 100644
index 000000000..9ca411208
--- /dev/null
+++ b/Examples/test-suite/java/cpp17_director_string_view_runme.java
@@ -0,0 +1,58 @@
+
+import cpp17_director_string_view.*;
+
+public class cpp17_director_string_view_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp17_director_string_view");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+
+ String s;
+
+ cpp17_director_string_view_A c = new cpp17_director_string_view_A("hi");
+ for (int i=0; i<3; i++) {
+ s = c.call_get(i);
+ if (!s.equals(Integer.valueOf(i).toString())) throw new RuntimeException("cpp17_director_string_view_A.get(" + i + ") failed. Got:" + s);
+ }
+
+ cpp17_director_string_view_B b = new cpp17_director_string_view_B("hello");
+
+ s = b.get_first();
+ if (!s.equals("cpp17_director_string_view_B.get_first")) throw new RuntimeException("get_first() failed");
+
+ s = b.call_get_first();
+ if (!s.equals("cpp17_director_string_view_B.get_first")) throw new RuntimeException("call_get_first() failed");
+
+ s = b.call_get(0);
+ if (!s.equals("cpp17_director_string_view_B.get: hello")) throw new RuntimeException("get(0) failed");
+ }
+}
+
+class cpp17_director_string_view_B extends A {
+ public cpp17_director_string_view_B(String first) {
+ super(first);
+ }
+ public String get_first() {
+ return "cpp17_director_string_view_B.get_first";
+ }
+
+ public String get(int n) {
+ return "cpp17_director_string_view_B.get: " + super.get(n);
+ }
+}
+
+class cpp17_director_string_view_A extends A {
+ public cpp17_director_string_view_A(String first) {
+ super(first);
+ }
+ public String get(int n) {
+ return Integer.valueOf(n).toString();
+ }
+}
diff --git a/Examples/test-suite/java/cpp17_enable_if_t_runme.java b/Examples/test-suite/java/cpp17_enable_if_t_runme.java
new file mode 100644
index 000000000..25569f303
--- /dev/null
+++ b/Examples/test-suite/java/cpp17_enable_if_t_runme.java
@@ -0,0 +1,19 @@
+import cpp17_enable_if_t.*;
+
+public class cpp17_enable_if_t_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp17_enable_if_t");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ if (cpp17_enable_if_t.enableif5(10, 20) != 30)
+ throw new RuntimeException("enableif5 not working");
+ }
+}
diff --git a/Examples/test-suite/java/cpp17_string_view_runme.java b/Examples/test-suite/java/cpp17_string_view_runme.java
new file mode 100644
index 000000000..6636a52da
--- /dev/null
+++ b/Examples/test-suite/java/cpp17_string_view_runme.java
@@ -0,0 +1,105 @@
+import cpp17_string_view.*;
+
+public class cpp17_string_view_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp17_string_view");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) throws Throwable
+ {
+ // Checking expected use of %typemap(in) std::string_view {}
+ cpp17_string_view.test_value("Fee");
+
+ // Checking expected result of %typemap(out) std::string_view {}
+ if (!cpp17_string_view.test_value("Fi").equals("Fi"))
+ throw new RuntimeException("Test 1 failed");
+
+ // Verify type-checking for %typemap(in) std::string_view {}
+ try {
+ cpp17_string_view.test_value(null);
+ throw new RuntimeException("Test 2 failed");
+ } catch (NullPointerException e) {
+ }
+
+ // Checking expected use of %typemap(in) const std::string_view & {}
+ cpp17_string_view.test_const_reference("Fo");
+
+ // Checking expected result of %typemap(out) const std::string_view& {}
+ if (!cpp17_string_view.test_const_reference("Fum").equals("Fum"))
+ throw new RuntimeException("Test 3 failed");
+
+ // Verify type-checking for %typemap(in) const std::string_view & {}
+ try {
+ cpp17_string_view.test_const_reference(null);
+ throw new RuntimeException("Test 4 failed");
+ } catch (NullPointerException e) {
+ }
+
+ //
+ // Input and output typemaps for pointers and non-const references to
+ // std::string_view are *not* supported; the following tests confirm
+ // that none of these cases are slipping through.
+ //
+
+ SWIGTYPE_p_std__string_view stringPtr = null;
+
+ stringPtr = cpp17_string_view.test_pointer_out();
+
+ cpp17_string_view.test_pointer(stringPtr);
+
+ stringPtr = cpp17_string_view.test_const_pointer_out();
+
+ cpp17_string_view.test_const_pointer(stringPtr);
+
+ stringPtr = cpp17_string_view.test_reference_out();
+
+ cpp17_string_view.test_reference(stringPtr);
+
+ // Check throw exception specification
+ try {
+ cpp17_string_view.test_throw();
+ throw new Throwable("Test 5 failed");
+ } catch (RuntimeException e) {
+ if (!e.getMessage().equals("test_throw message"))
+ throw new Exception("Test 5 string check: " + e.getMessage());
+ }
+ try {
+ cpp17_string_view.test_const_reference_throw();
+ throw new Throwable("Test 6 failed");
+ } catch (RuntimeException e) {
+ if (!e.getMessage().equals("test_const_reference_throw message"))
+ throw new Exception("Test 6 string check: " + e.getMessage());
+ }
+
+ // Global variables
+ if (!cpp17_string_view.getConstGlobalString().equals("const global string"))
+ throw new Exception("ConstGlobalString test");
+
+ // Member variables
+ Structure myStructure = new Structure();
+ if (!myStructure.getConstMemberString().equals("const member string"))
+ throw new Exception("ConstMemberString test");
+
+ if (!Structure.getConstStaticMemberString().equals("const static member string"))
+ throw new Exception("ConstStaticMemberString test");
+
+ if (!cpp17_string_view.stdstringview_empty().equals(""))
+ throw new Exception("stdstringview_empty test");
+ if (!cpp17_string_view.c_empty().equals(""))
+ throw new Exception("c_empty test");
+ if (cpp17_string_view.c_null() != null)
+ throw new Exception("c_null test");
+ if (cpp17_string_view.get_null(cpp17_string_view.c_null()) != null)
+ throw new Exception("get_null c_null test");
+ if (!cpp17_string_view.get_null(cpp17_string_view.c_empty()).equals("non-null"))
+ throw new Exception("get_null c_empty test");
+ if (!cpp17_string_view.get_null(cpp17_string_view.stdstringview_empty()).equals("non-null"))
+ throw new Exception("get_null stdstringview_empty test");
+ }
+}
diff --git a/Examples/test-suite/java/director_classes_runme.java b/Examples/test-suite/java/director_classes_runme.java
index 5992b5dd9..292cded7f 100644
--- a/Examples/test-suite/java/director_classes_runme.java
+++ b/Examples/test-suite/java/director_classes_runme.java
@@ -21,8 +21,8 @@ Base - FullyOverloaded(int 10)
Base - FullyOverloaded(bool 1)
Base - SemiOverloaded(int -678)
Base - SemiOverloaded(bool 1)
-Base - DefaultParms(10, 2.2)
-Base - DefaultParms(10, 1.1)
+Base - DefaultParms(10, 2.25)
+Base - DefaultParms(10, 1.125)
--------------------------------
Derived - Val(444.555)
Derived - Ref(444.555)
@@ -32,8 +32,8 @@ Derived - FullyOverloaded(int 10)
Derived - FullyOverloaded(bool 1)
Derived - SemiOverloaded(int -678)
Base - SemiOverloaded(bool 1)
-Derived - DefaultParms(10, 2.2)
-Derived - DefaultParms(10, 1.1)
+Derived - DefaultParms(10, 2.25)
+Derived - DefaultParms(10, 1.125)
--------------------------------
JavaDerived - Val(444.555)
JavaDerived - Ref(444.555)
@@ -43,8 +43,8 @@ JavaDerived - FullyOverloaded(int 10)
JavaDerived - FullyOverloaded(bool True)
JavaDerived - SemiOverloaded(-678)
Base - SemiOverloaded(bool 1)
-JavaDerived - DefaultParms(10, 2.2)
-JavaDerived - DefaultParms(10, 1.1)
+JavaDerived - DefaultParms(10, 2.25)
+JavaDerived - DefaultParms(10, 1.125)
------------ Finish ------------
*/
@@ -128,7 +128,7 @@ public class director_classes_runme {
if (!myCaller.SemiOverloadedCall(true).equals("Base" + "::SemiOverloaded(bool)")) throw new RuntimeException("failed");
// Default parameters methods test
- if (!(myCaller.DefaultParmsCall(10, 2.2)).equals(baseSimpleName + "::DefaultParms(int, double)")) throw new RuntimeException("failed");
+ if (!(myCaller.DefaultParmsCall(10, 2.25)).equals(baseSimpleName + "::DefaultParms(int, double)")) throw new RuntimeException("failed");
if (myBase instanceof JavaDerived) { // special handling for Java derived classes, there is no way to do this any other way
if (!myCaller.DefaultParmsCall(10).equals(baseSimpleName + "::DefaultParms(int, double)")) throw new RuntimeException("failed");
} else {
@@ -205,12 +205,12 @@ class JavaDerived extends Base
// Note the following method can never be called from unmanaged code.
// It is here only for code that calls it directly from managed code.
// But should always be defined to ensure behaviour is consistent
- // independent of where DefaultParsms is called from (managed or unmanaged code).
+ // independent of where DefaultParams is called from (managed or unmanaged code).
// Note this method can never be called from unmanaged code
public String DefaultParms(int x)
{
if (director_classes.getPrintDebug()) System.out.println("JavaDerived - DefaultParms(" + x + ")");
- return DefaultParms(x, 1.1/*use C++ default here*/);
+ return DefaultParms(x, 1.125/*use C++ default here*/);
}
}
diff --git a/Examples/test-suite/java/director_default_runme.java b/Examples/test-suite/java/director_default_runme.java
index b71e45e25..1ab13237a 100644
--- a/Examples/test-suite/java/director_default_runme.java
+++ b/Examples/test-suite/java/director_default_runme.java
@@ -16,22 +16,29 @@ public class director_default_runme {
{
director_default_MyFoo a = new director_default_MyFoo();
a = new director_default_MyFoo(10);
+ a.delete();
}
- director_default_MyFoo a = new director_default_MyFoo();
- if (!a.GetMsg().equals("director_default_MyFoo-default")) {
- throw new RuntimeException ( "Test 1 failed" );
- }
- if (!a.GetMsg("boo").equals("director_default_MyFoo-boo")) {
- throw new RuntimeException ( "Test 2 failed" );
+ {
+ director_default_MyFoo a = new director_default_MyFoo();
+ if (!a.GetMsg().equals("director_default_MyFoo-default")) {
+ throw new RuntimeException ( "Test 1 failed" );
+ }
+ if (!a.GetMsg("boo").equals("director_default_MyFoo-boo")) {
+ throw new RuntimeException ( "Test 2 failed" );
+ }
+ a.delete();
}
- Foo b = new Foo();
- if (!b.GetMsg().equals("Foo-default")) {
- throw new RuntimeException ( "Test 1 failed" );
- }
- if (!b.GetMsg("boo").equals("Foo-boo")) {
- throw new RuntimeException ( "Test 2 failed" );
+ {
+ Foo b = new Foo();
+ if (!b.GetMsg().equals("Foo-default")) {
+ throw new RuntimeException ( "Test 1 failed" );
+ }
+ if (!b.GetMsg("boo").equals("Foo-boo")) {
+ throw new RuntimeException ( "Test 2 failed" );
+ }
+ b.delete();
}
}
diff --git a/Examples/test-suite/java/director_pass_by_value_runme.java b/Examples/test-suite/java/director_pass_by_value_runme.java
index 24ded2ccf..1d34c3b55 100644
--- a/Examples/test-suite/java/director_pass_by_value_runme.java
+++ b/Examples/test-suite/java/director_pass_by_value_runme.java
@@ -32,6 +32,8 @@ public class director_pass_by_value_runme {
break;
};
}
+ if (director_pass_by_value.has_cplusplus11())
+ Counter.check_counts(1, 0, 0, 1, 0, 1); // check move constructor called and just one destructor
// bug was the passByVal 'global' object was destroyed after the call to virtualMethod had finished.
int ret = director_pass_by_value_runme.passByVal.getVal();
if (ret != 0x12345678)
diff --git a/Examples/test-suite/java/director_property_runme.java b/Examples/test-suite/java/director_property_runme.java
new file mode 100644
index 000000000..cc8727740
--- /dev/null
+++ b/Examples/test-suite/java/director_property_runme.java
@@ -0,0 +1,66 @@
+
+import director_property.*;
+
+public class director_property_runme {
+
+ static {
+ try {
+ System.loadLibrary("director_property");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+
+ {
+ Foo a = new director_property_MyFoo();
+ if (!a.getA().equals("")) {
+ throw new RuntimeException( "Test failed" );
+ }
+ a.setA("Hello");
+ if (!a.getA().equals("Hello set from MyFoo")) {
+ throw new RuntimeException( "Test failed" );
+ }
+ a.setAByRef("Hello");
+ if (!a.getA().equals("Hello setAByRef from MyFoo")) {
+ throw new RuntimeException( "Test failed" );
+ }
+ a.delete();
+ }
+
+ {
+ Foo a_original = new director_property_MyFoo();
+ Foo a = Foo.get_self(a_original);
+ if (!a.getA().equals("")) {
+ throw new RuntimeException( "Test failed" );
+ }
+ a.setA("Hello");
+ if (!a.getA().equals("Hello set from MyFoo")) {
+ throw new RuntimeException( "Test failed" );
+ }
+ a.setAByRef("Hello");
+ if (!a.getA().equals("Hello setAByRef from MyFoo")) {
+ throw new RuntimeException( "Test failed" );
+ }
+ a.delete();
+ }
+ }
+}
+
+class director_property_MyFoo extends Foo {
+ public director_property_MyFoo() {
+ super();
+ }
+ @Override
+ public void setA(String a) {
+ super.setA(a + " set from MyFoo");
+ }
+ @Override
+ public void setAByRef(String a) {
+ super.setA(a + " setAByRef from MyFoo");
+ }
+}
+
+
diff --git a/Examples/test-suite/java/director_string_runme.java b/Examples/test-suite/java/director_string_runme.java
index a6ed67100..f69070757 100644
--- a/Examples/test-suite/java/director_string_runme.java
+++ b/Examples/test-suite/java/director_string_runme.java
@@ -19,11 +19,14 @@ public class director_string_runme {
director_string_A c = new director_string_A("hi");
for (int i=0; i<3; i++) {
s = c.call_get(i);
- if (!s.equals(new Integer(i).toString())) throw new RuntimeException("director_string_A.get(" + i + ") failed. Got:" + s);
+ if (!s.equals(Integer.valueOf(i).toString())) throw new RuntimeException("director_string_A.get(" + i + ") failed. Got:" + s);
}
director_string_B b = new director_string_B("hello");
+ s = b.get_first();
+ if (!s.equals("director_string_B.get_first")) throw new RuntimeException("get_first() failed");
+
s = b.call_get_first();
if (!s.equals("director_string_B.get_first")) throw new RuntimeException("call_get_first() failed");
@@ -39,7 +42,7 @@ class director_string_B extends A {
public String get_first() {
return "director_string_B.get_first";
}
-
+
public String get(int n) {
return "director_string_B.get: " + super.get(n);
}
@@ -50,7 +53,6 @@ class director_string_A extends A {
super(first);
}
public String get(int n) {
- return new Integer(n).toString();
+ return Integer.valueOf(n).toString();
}
}
-
diff --git a/Examples/test-suite/java/director_using_member_scopes_runme.java b/Examples/test-suite/java/director_using_member_scopes_runme.java
new file mode 100644
index 000000000..d500014e6
--- /dev/null
+++ b/Examples/test-suite/java/director_using_member_scopes_runme.java
@@ -0,0 +1,64 @@
+
+import director_using_member_scopes.*;
+
+public class director_using_member_scopes_runme {
+
+ static {
+ try {
+ System.loadLibrary("director_using_member_scopes");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ NativeWindowType nwt = new NativeWindowType();
+
+ {
+ director_using_member_scopes_MyApplicationContextSDL a = new director_using_member_scopes_MyApplicationContextSDL();
+
+ if (ApplicationContextBase.call_setWindowGrab(a, nwt, true) != 100)
+ throw new RuntimeException("failed");
+
+ if (ApplicationContextSDL.call_setWindowGrab(a, nwt, true) != 100)
+ throw new RuntimeException("failed");
+ }
+
+ {
+ director_using_member_scopes_MyACSDL a = new director_using_member_scopes_MyACSDL();
+
+ if (ACB.call_setWindowGrab(a, nwt, true) != 100)
+ throw new RuntimeException("failed");
+ if (ACB.call_setWindowGrab(a, "hi", 0) != 200)
+ throw new RuntimeException("failed");
+
+ if (ACSDL.call_setWindowGrab(a, nwt, true) != 100)
+ throw new RuntimeException("failed");
+ if (ACSDL.call_setWindowGrab(a, "hi", 0) != 200)
+ throw new RuntimeException("failed");
+ }
+ }
+}
+
+class director_using_member_scopes_MyApplicationContextSDL extends ApplicationContextSDL {
+ @Override
+ public int setWindowGrab(NativeWindowType win, boolean grab)
+ {
+ return 100;
+ }
+}
+
+class director_using_member_scopes_MyACSDL extends ACSDL {
+ @Override
+ public int setWindowGrab(NativeWindowType win, boolean grab)
+ {
+ return 100;
+ }
+
+ @Override
+ public int setWindowGrab(String s, int val)
+ {
+ return 200;
+ }
+}
diff --git a/Examples/test-suite/java/doxygen_alias_runme.java b/Examples/test-suite/java/doxygen_alias_runme.java
index e21ed6d19..98cd97752 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 class doxygen_alias_runme {
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 @@ public class doxygen_alias_runme {
" @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 e3d9b0279..621cc9eef 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 class doxygen_basic_notranslate_runme {
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 @@ public class doxygen_basic_notranslate_runme {
"");
// 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 ab343b560..c64262a67 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 class doxygen_basic_translate_runme {
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>();
@@ -94,8 +86,15 @@ public class doxygen_basic_translate_runme {
" @param x Horizontal coordinate.\n" +
" @return Arc tangent of <code>y/x</code>.\n" +
"");
+ wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function8()",
+ " Test variadic function\n" +
+ "");
+
+ wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function9(int)",
+ " Test unnamed argument\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_basic_translate_style2_runme.java b/Examples/test-suite/java/doxygen_basic_translate_style2_runme.java
index 05e51cff8..28cf2daba 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 class doxygen_basic_translate_style2_runme {
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 @@ public class doxygen_basic_translate_style2_runme {
"");
// 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_style3_runme.java b/Examples/test-suite/java/doxygen_basic_translate_style3_runme.java
new file mode 100644
index 000000000..a0953644a
--- /dev/null
+++ b/Examples/test-suite/java/doxygen_basic_translate_style3_runme.java
@@ -0,0 +1,93 @@
+
+import doxygen_basic_translate_style3.*;
+import java.util.HashMap;
+
+public class doxygen_basic_translate_style3_runme {
+ static {
+ try {
+ System.loadLibrary("doxygen_basic_translate_style3");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ CommentParser.parse("doxygen_basic_translate_style3");
+
+ HashMap<String, String> wantedComments = new HashMap<String, String>();
+
+ wantedComments.put("doxygen_basic_translate_style3.doxygen_basic_translate_style3.function()",
+ " \n" +
+ " Brief description.\n" +
+ " \n" +
+ " The comment text.\n" +
+ " @author Some author\n" +
+ " @return Some number\n" +
+ " @see function2\n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style3.doxygen_basic_translate_style3.function2()",
+ " A test of a very very very very very very very very very very very very very very very very \n" +
+ " very very very very very long comment string. \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style3.doxygen_basic_translate_style3.function4()",
+ " A test of some mixed tag usage \n" +
+ " If: CONDITION {\n" +
+ " This <i>code </i>fragment shows us something . \n" +
+ " <p alt=\"Minuses: \">\n" +
+ " <li>it's senseless \n" +
+ " </li><li>it's stupid \n" +
+ " </li><li>it's null \n" +
+ " \n" +
+ " </li></p>Warning: This may not work as expected \n" +
+ " \n" +
+ " {@code \n" +
+ "int main() { while(true); } \n" +
+ "\n" +
+ "int testBlankLine() {} \n" +
+ " }\n" +
+ " }\n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style3.doxygen_basic_translate_style3.function3(int)",
+ " A test for overloaded functions \n" +
+ " This is function <b>one </b>\n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style3.doxygen_basic_translate_style3.function5(int)",
+ " This is a post comment. \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style3.doxygen_basic_translate_style3.function6(int)",
+ " Test for default args \n" +
+ " @param a Some parameter, default is 42" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style3.doxygen_basic_translate_style3.function6()",
+ " Test for default args \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style3.doxygen_basic_translate_style3.function7(doxygen_basic_translate_style3.SWIGTYPE_p_p_p_Shape)",
+ " Test for a parameter with difficult type \n" +
+ " (mostly for python) \n" +
+ " @param a Very strange param \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style3.doxygen_basic_translate_style3.function3(int, int)",
+ " A test for overloaded functions \n" +
+ " This is function <b>two </b>\n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style3.doxygen_basic_translate_style3.Atan2(double, double)",
+ " Multiple parameters test.\n" +
+ " \n" +
+ " @param y Vertical coordinate.\n" +
+ " @param x Horizontal coordinate.\n" +
+ " @return Arc tangent of <code>y/x</code>.\n" +
+ "");
+
+ // and ask the parser to check comments for us
+ System.exit(CommentParser.check(wantedComments));
+ }
+}
diff --git a/Examples/test-suite/java/doxygen_code_blocks_runme.java b/Examples/test-suite/java/doxygen_code_blocks_runme.java
new file mode 100644
index 000000000..8e8373b78
--- /dev/null
+++ b/Examples/test-suite/java/doxygen_code_blocks_runme.java
@@ -0,0 +1,75 @@
+
+import doxygen_code_blocks.*;
+import java.util.HashMap;
+
+public class doxygen_code_blocks_runme {
+ static {
+ try {
+ System.loadLibrary("doxygen_code_blocks");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ CommentParser.parse("doxygen_code_blocks");
+
+ HashMap<String, String> wantedComments = new HashMap<String, String>();
+
+ wantedComments.put("doxygen_code_blocks.doxygen_code_blocks.function()",
+ " Test for code blocks\n \n" +
+ " \n \n" +
+ " {@code \n" +
+ " simple code block \n" +
+ " }\n \n" +
+ " \n \n" +
+ " More advanced usage with C++ characters:\n \n" +
+ " {@code \n" +
+ " std::vector<int> first; // empty vector of ints \n" +
+ " std::vector<int> second (4,100); // four ints with value 100 \n" +
+ " std::vector<int> third (second.begin(),second.end()); // iterating through second \n" +
+ " std::vector<int> fourth (third); // a copy of third \n" +
+ " // the iterator constructor can also be used to construct from arrays: \n" +
+ " int myints[] = {16,2,77,29}; \n" +
+ " std::vector<int> fifth (myints, myints + sizeof(myints) / sizeof(int) ); \n" +
+ " \n" +
+ " std::cout << \"The contents of fifth are:\"; \n" +
+ " for (std::vector<int>::iterator it = fifth.begin(); it != fifth.end(); ++it) \n" +
+ " std::cout << \' \' << *it; \n" +
+ " std::cout << \'\\n\'; \n" +
+ " }\n \n" +
+ " \n \n" +
+ " A code block for C:\n \n" +
+ " {@code \n" +
+ " printf(\"hello world\"); \n" +
+ " }\n \n" +
+ " \n \n" +
+ " A code block for Java:\n \n" +
+ " {@code \n" +
+ " public class HelloWorld { \n" +
+ " public static void main(String[] args) { \n" +
+ " // Prints \"Hello, World\" to the terminal window. \n" +
+ " System.out.println(\"Hello, World\"); \n" +
+ " } \n" +
+ " } \n" +
+ " }\n \n" +
+ " \n \n" +
+ " A code block for python:\n \n" +
+ " {@code \n" +
+ " print(\'hello world\') \n" +
+ " }\n \n" +
+ " \n \n" +
+ " A python doctest example:\n \n" +
+ " {@code \n" +
+ " >>> 1 + 1 \n" +
+ " 2 \n" +
+ " } \n" +
+ " \n" +
+ "");
+
+ // and ask the parser to check comments for us
+ 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 6250ce525..29b6e0640 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 class doxygen_ignore_runme {
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 @@ public class doxygen_ignore_runme {
"\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 5d95bd565..3735042ce 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 class doxygen_misc_constructs_runme {
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>();
@@ -105,7 +97,7 @@ public class doxygen_misc_constructs_runme {
"\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENested",
- " Enum description.\n" +
+ " ENested description.\n" +
"\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENested.ONE",
@@ -117,6 +109,81 @@ public class doxygen_misc_constructs_runme {
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENested.THREE",
" desc of three\n");
+ wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOdd",
+ " ENestedOdd description.\n" +
+ "\n");
+
+ wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOdd.ODD_ONE",
+ " desc of odd_one\n");
+
+ wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOdd.ODD_TWO",
+ " desc of odd_two\n");
+
+ wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOdd.ODD_THREE",
+ " desc of odd_three\n");
+
+ wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOddPartial1",
+ " ENestedOddPartial1 description.\n" +
+ "\n");
+
+ wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOddPartial1.ODD_PARTIAL1_THREE",
+ " desc of odd_partial1_three\n");
+
+ wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOddPartial1.ODD_PARTIAL1_TWO",
+ " desc of odd_partial1_two\n");
+
+ wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOddPartial3",
+ " ENestedOddPartial3 description.\n" +
+ "\n");
+
+ wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOddPartial3.ODD_PARTIAL3_ONE",
+ " desc of odd_partial3_one\n");
+
+ wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOddPartial3.ODD_PARTIAL3_TWO",
+ " desc of odd_partial3_two\n");
+
+ wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.TESTENUM",
+ " Description for TESTENUM.\n" +
+ "\n");
+
+ wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.TESTENUM.TEST_NONE",
+ " something for none\n");
+
+ wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.TESTENUM.TEST_ONE",
+ " something for one\n");
+
+ wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.TESTENUM.TEST_TWO",
+ " something for two something more for two\n");
+
+ wantedComments.put("doxygen_misc_constructs.SIOBeam",
+ " SIOBeam struct description\n" +
+ "\n");
+
+ wantedComments.put("doxygen_misc_constructs.SIOBeam.testfunction(int, double, boolean)",
+ " testfunction - testing extra trailing doc comment <br>\n" +
+ " @param testf_aaa testfunction aaa parm <br>\n" +
+ " @param testf_bbb testfunction bbb parm <br>\n" +
+ " @param testf_ccc testfunction ccc parm testfunction more for two parm\n" +
+ "\n");
+
+ wantedComments.put("doxygen_misc_constructs.SIOBeam(java.lang.String, int, int)",
+ " Constructor for input from an existing SIO file<br>\n" +
+ " @param filename Name of input SIO file.<br>\n" +
+ " @param elevationOrder Interpolation order (0-3) in elevation<br>\n" +
+ " @param bearingOrder Interpolation order (0-3) in bearing\n" +
+ "\n");
+
+ wantedComments.put("doxygen_misc_constructs.SIOBeam(java.lang.String, int)",
+ " Constructor for input from an existing SIO file<br>\n" +
+ " @param filename Name of input SIO file.<br>\n" +
+ " @param elevationOrder Interpolation order (0-3) in elevation<br>\n" +
+ "\n");
+
+ wantedComments.put("doxygen_misc_constructs.SIOBeam(java.lang.String)",
+ " Constructor for input from an existing SIO file<br>\n" +
+ " @param filename Name of input SIO file.<br>\n" +
+ "\n");
+
wantedComments.put("doxygen_misc_constructs.StructWithReturnComment",
" @return This is a bad place for this tag, but it should be ignored.");
@@ -132,6 +199,16 @@ public class doxygen_misc_constructs_runme {
" <br>\n" +
" And this is not a list item any more.\n" +
"");
+
+ wantedComments.put("doxygen_misc_constructs.IncorrectlyDocumentedMembers",
+ " Incorrectly documented members, these should be post document comments, Github issue #1636");
+
+ wantedComments.put("doxygen_misc_constructs.IncorrectlyDocumentedMembers.setBbbb(int)",
+ " really for bbbb value");
+
+ wantedComments.put("doxygen_misc_constructs.IncorrectlyDocumentedMembers.getBbbb()",
+ " really for bbbb value");
+
wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.isNoSpaceValidA()",
" This comment without space after '*' is valid in Doxygen.\n" +
"\n" +
@@ -193,8 +270,14 @@ public class doxygen_misc_constructs_runme {
"\n" +
" @param fileName name of the log file\n");
+ wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.doc_ends_with_quote()",
+ "This doc comment ends with a quote: \"and that's ok\"");
+
+ wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.doc_with_triple_quotes()",
+ "This comment contains embedded triple-quoted string:\n" +
+ "\"\"\"How quaint\"\"\"");
// 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 3ffa796f0..e9d1a068e 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 class doxygen_nested_class_runme {
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 @@ public class doxygen_nested_class_runme {
" 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 ef1f06af5..6b1e2b08e 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 class doxygen_parsing_enums_proper_runme {
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 @@ public class doxygen_parsing_enums_proper_runme {
"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 85ec0cb55..1e0dd74ee 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 class doxygen_parsing_enums_simple_runme {
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 @@ public class doxygen_parsing_enums_simple_runme {
"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 4e5f4b489..7cf3b17ef 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 class doxygen_parsing_enums_typesafe_runme {
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 @@ public class doxygen_parsing_enums_typesafe_runme {
// 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 428649196..3a41fe56f 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 class doxygen_parsing_enums_typeunsafe_runme {
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 @@ public class doxygen_parsing_enums_typeunsafe_runme {
"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 d58b1f486..05828f226 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 class doxygen_parsing_runme {
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>();
@@ -53,6 +45,12 @@ public class doxygen_parsing_runme {
" The struct comment \n" +
" \n" +
"");
+ wantedComments.put("doxygen_parsing.SomeStruct.setWidth(int)",
+ "**immutable** image width in pixels \n" +
+ "");
+ wantedComments.put("doxygen_parsing.SomeStruct.getWidth()",
+ "**immutable** image width in pixels \n" +
+ "");
wantedComments.put("doxygen_parsing.doxygen_parsing.setSomeVar(int)",
" The var comment \n" +
" \n" +
@@ -134,8 +132,24 @@ public class doxygen_parsing_runme {
wantedComments.put("doxygen_parsing.doxygen_parsingConstants.CONSTANT_VALUE",
"The constant comment \n" +
"");
+ wantedComments.put("doxygen_parsing.Foo1636.getGroupmember1()",
+ "groupmember1 description");
+ wantedComments.put("doxygen_parsing.Foo1636.setGroupmember1(int)",
+ "groupmember1 description");
+ wantedComments.put("doxygen_parsing.Foo1636.getGroupmember2()",
+ "groupmember2 description");
+ wantedComments.put("doxygen_parsing.Foo1636.setGroupmember2(int)",
+ "groupmember2 description");
+ wantedComments.put("doxygen_parsing.Foo1750.getA()",
+ "");
+ wantedComments.put("doxygen_parsing.Foo1750.getB()",
+ "");
+ wantedComments.put("doxygen_parsing.Foo1750.setA(int)",
+ "");
+ wantedComments.put("doxygen_parsing.Foo1750.setB(int)",
+ "");
// 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 d5c533f4e..80087c65a 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 class doxygen_translate_all_tags_runme {
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>();
@@ -89,7 +81,7 @@ public class doxygen_translate_all_tags_runme {
" If not: SOMECONDITION {\n" +
" This is printed if not \n" +
" }\n" +
- " <img src=testImage.bmp alt=\"Hello, world!\" />\n" +
+ " <img src=\"testImage.bmp\" alt=\"Hello, world!\"/>\n" +
" Some text \n" +
" describing invariant. \n");
@@ -101,10 +93,10 @@ public class doxygen_translate_all_tags_runme {
" </li><li>With lots of items \n" +
" </li><li>lots of lots of items \n" +
" </li></ul> \n" +
- " {@link someMember Some description follows }\n" +
+ " {@link someMember Some description follows} with text after\n" +
" This will only appear in man\n");
- wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func07(int)",
+ wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func07(int, int, int, int)",
" Comment for <b>func07()</b>.\n" +
" Note: Here \n" +
" is the note! \n" +
@@ -115,7 +107,10 @@ public class doxygen_translate_all_tags_runme {
" The paragraph text. \n" +
" Maybe even multiline \n" +
" </p>\n" +
- " @param a the first param\n");
+ " @param a the first param\n" +
+ " @param b parameter with intent(in)\n" +
+ " @param c parameter with intent(out)\n" +
+ " @param d parameter with intent(in,out)\n");
wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func08(int)",
"<a id=\"someAnchor\"></a>\n" +
@@ -154,6 +149,6 @@ public class doxygen_translate_all_tags_runme {
" 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 6d74e16fe..afee4eac6 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 class doxygen_translate_links_runme {
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 @@ public class doxygen_translate_links_runme {
"");
// 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 55e5d23d3..c55c95150 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 class doxygen_translate_runme {
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>();
@@ -77,7 +69,8 @@ public class doxygen_translate_runme {
" This is printed if not}\n" +
" \n" +
" \n" +
- " <img src=testImage.bmp alt=\"Hello, world!\"/>\n" +
+ " <img src=\"testImage.bmp\" alt=\"Hello, world!\"/>\n" +
+ " <img src=\"test image.jpg\" alt=\"Test jpeg\"/>\n" +
" \n" +
" <ul> \n" +
" \n" +
@@ -274,6 +267,6 @@ public class doxygen_translate_runme {
"");
// 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/friends_runme.java b/Examples/test-suite/java/friends_runme.java
index 2dced9efa..165b0520e 100644
--- a/Examples/test-suite/java/friends_runme.java
+++ b/Examples/test-suite/java/friends_runme.java
@@ -11,6 +11,11 @@ public class friends_runme {
}
}
+ private static void check_equal(int a, int b) {
+ if (a != b)
+ throw new RuntimeException("Not equal " + a + " != " + b);
+ }
+
public static void main(String argv[]) throws Throwable
{
A a = new A(2);
@@ -32,7 +37,7 @@ public class friends_runme {
if (friends.mix(a,b) != 5)
throw new RuntimeException("failed");
- D_d di = new D_d(2);
+ D_i di = new D_i(2);
D_d dd = new D_d(3.3);
// incredible template overloading working just fine
@@ -48,6 +53,22 @@ public class friends_runme {
throw new RuntimeException("failed");
if (friends.get_val1(dd) != 1.3)
throw new RuntimeException("failed");
+
+ if (friends.chum_blah() != 1234)
+ throw new RuntimeException("failed");
+ if (friends.mate_blah() != 4321)
+ throw new RuntimeException("failed");
+
+ Foe foe = new Foe(111);
+ check_equal(friends.friend_definition(), 10);
+ check_equal(friends.friend_declaration(), 11);
+ check_equal(friends.friend_args_definition(foe), 111);
+ check_equal(friends.friend_args_declaration(foe), 111);
+
+ check_equal(friends.friend_definition_compiler(), 20);
+ check_equal(friends.friend_declaration_compiler(), 21);
+ check_equal(friends.friend_args_definition_compiler(foe), 111);
+ check_equal(friends.friend_args_declaration_compiler(foe), 111);
}
}
diff --git a/Examples/test-suite/java/java_typemaps_proxy_runme.java b/Examples/test-suite/java/java_typemaps_proxy_runme.java
index 67a083114..0caeb1c65 100644
--- a/Examples/test-suite/java/java_typemaps_proxy_runme.java
+++ b/Examples/test-suite/java/java_typemaps_proxy_runme.java
@@ -76,6 +76,15 @@ public class java_typemaps_proxy_runme {
java_typemaps_proxyJNI.Without_member_method(nullPtr, nullPtr);
java_typemaps_proxyJNI.delete_Without(nullPtr);
java_typemaps_proxyJNI.global_method_without(nullPtr);
+
+ // $imfuncname substitution
+ ProxyA pa = new ProxyA();
+ if (pa.imfuncname_test() != 123)
+ throw new RuntimeException("imfuncname_test is not 123");
+ if (ProxyA.imfuncname_static_test() != 234)
+ throw new RuntimeException("imfuncname_test is not 234");
+ if (java_typemaps_proxy.imfuncname_global_test() != 345)
+ throw new RuntimeException("imfuncname_test is not 345");
}
}
diff --git a/Examples/test-suite/java/li_boost_shared_ptr_runme.java b/Examples/test-suite/java/li_boost_shared_ptr_runme.java
index 64c356f8e..b513fade7 100644
--- a/Examples/test-suite/java/li_boost_shared_ptr_runme.java
+++ b/Examples/test-suite/java/li_boost_shared_ptr_runme.java
@@ -605,7 +605,7 @@ public class li_boost_shared_ptr_runme {
throw new RuntimeException("verify value failed. Expected: " + expected + " Got: " + got);
}
private void verifyCount(int expected, Klass k) {
- int got = li_boost_shared_ptr.use_count(k);
+ int got = (int)li_boost_shared_ptr.use_count(k);
if (expected != got)
throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got);
}
diff --git a/Examples/test-suite/java/li_constraints_runme.java b/Examples/test-suite/java/li_constraints_runme.java
new file mode 100644
index 000000000..85027e85a
--- /dev/null
+++ b/Examples/test-suite/java/li_constraints_runme.java
@@ -0,0 +1,77 @@
+
+import java.util.function.*;
+import li_constraints.*;
+
+public class li_constraints_runme {
+
+ static {
+ try {
+ System.loadLibrary("li_constraints");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void check_double(boolean except, Consumer<Double> f, double val, String ex) {
+ boolean actual = true;
+ boolean proper = false;
+ try {
+ f.accept(val);
+ } catch(RuntimeException e) {
+ actual = false;
+ proper = e.getMessage().equals(String.join(" ", "Expected", "a", ex, "value."));
+ }
+ if (actual) {
+ if (!except) {
+ throw new RuntimeException(String.join("", "function '", ex, "' with ", String.valueOf(val), " should perform an exception"));
+ }
+ } else {
+ if (except) {
+ throw new RuntimeException(String.join("", "function '", ex, "' with ", String.valueOf(val), " should not perform an exception"));
+ } else if (!proper) {
+ throw new RuntimeException(String.join("", "function '", ex, "' with ", String.valueOf(val), " should perform a proper exception"));
+ }
+ }
+ }
+
+ public static void main(String argv[]) {
+
+ Consumer<Double> func = v -> li_constraints.test_nonnegative(v);
+ check_double(true, func, 10, "non-negative");
+ check_double(true, func, 0, "non-negative");
+ check_double(false, func, -10, "non-negative");
+
+ func = v -> li_constraints.test_nonpositive(v);
+ check_double(false, func, 10, "non-positive");
+ check_double(true, func, 0, "non-positive");
+ check_double(true, func, -10, "non-positive");
+
+ func = v -> li_constraints.test_positive(v);
+ check_double(true, func, 10, "positive");
+ check_double(false, func, 0, "positive");
+ check_double(false, func, -10, "positive");
+
+ func = v -> li_constraints.test_negative(v);
+ check_double(false, func, 10, "negative");
+ check_double(false, func, 0, "negative");
+ check_double(true, func, -10, "negative");
+
+ func = v -> li_constraints.test_nonzero(v);
+ check_double(true, func, 10, "nonzero");
+ check_double(false, func, 0, "nonzero");
+ check_double(true, func, -10, "nonzero");
+
+ boolean have_exception = false;
+ try {
+ li_constraints.test_nonnull(null);
+ } catch(Exception e) {
+ have_exception = e.getMessage().equals("Received a NULL pointer.");
+ }
+ if (!have_exception) {
+ throw new RuntimeException("test_nonnull should perform proper exception with 'null' value");
+ }
+ SWIGTYPE_p_void nonnull = li_constraints.get_nonnull();
+ li_constraints.test_nonnull(nonnull);
+ }
+}
diff --git a/Examples/test-suite/java/li_std_auto_ptr_runme.java b/Examples/test-suite/java/li_std_auto_ptr_runme.java
index 50ed113a4..24e353ddc 100644
--- a/Examples/test-suite/java/li_std_auto_ptr_runme.java
+++ b/Examples/test-suite/java/li_std_auto_ptr_runme.java
@@ -20,49 +20,127 @@ public class li_std_auto_ptr_runme {
}
}
+ private static void checkCount(int expected_count) {
+ int actual_count = Klass.getTotal_count();
+ if (actual_count != expected_count)
+ throw new RuntimeException("Counts incorrect, expected:" + expected_count + " actual:" + actual_count);
+ }
+
public static void main(String argv[]) throws Throwable
{
+ // Test raw pointer handling involving virtual inheritance
+ {
+ KlassInheritance kini = new KlassInheritance("KlassInheritanceInput");
+ checkCount(1);
+ String s = li_std_auto_ptr.useKlassRawPtr(kini);
+ if (!s.equals("KlassInheritanceInput"))
+ throw new RuntimeException("Incorrect string: " + s);
+ kini.delete();
+ checkCount(0);
+ }
+
+ // auto_ptr as input
+ {
+ Klass kin = new Klass("KlassInput");
+ checkCount(1);
+ String s = li_std_auto_ptr.takeKlassAutoPtr(kin);
+ checkCount(0);
+ if (!s.equals("KlassInput"))
+ throw new RuntimeException("Incorrect string: " + s);
+ if (!li_std_auto_ptr.is_nullptr(kin))
+ throw new RuntimeException("is_nullptr failed");
+ kin.delete(); // Should not fail, even though already deleted
+ checkCount(0);
+ }
+
+ {
+ Klass kin = new Klass("KlassInput");
+ checkCount(1);
+ String s = li_std_auto_ptr.takeKlassAutoPtr(kin);
+ checkCount(0);
+ if (!s.equals("KlassInput"))
+ throw new RuntimeException("Incorrect string: " + s);
+ if (!li_std_auto_ptr.is_nullptr(kin))
+ throw new RuntimeException("is_nullptr failed");
+ boolean exception_thrown = false;
+ try {
+ li_std_auto_ptr.takeKlassAutoPtr(kin);
+ } catch (RuntimeException e) {
+ if (!e.getMessage().contains("Cannot release ownership as memory is not owned"))
+ throw new RuntimeException("incorrect exception message");
+ exception_thrown = true;
+ }
+ if (!exception_thrown)
+ throw new RuntimeException("double usage of takeKlassAutoPtr should have been an error");
+ kin.delete(); // Should not fail, even though already deleted
+ checkCount(0);
+ }
+
+ {
+ Klass kin = new Klass("KlassInput");
+ boolean exception_thrown = false;
+ Klass notowned = li_std_auto_ptr.get_not_owned_ptr(kin);
+ try {
+ li_std_auto_ptr.takeKlassAutoPtr(notowned);
+ } catch (RuntimeException e) {
+ if (!e.getMessage().contains("Cannot release ownership as memory is not owned"))
+ throw new RuntimeException("incorrect exception message");
+ exception_thrown = true;
+ }
+ if (!exception_thrown)
+ throw new RuntimeException("Should have thrown 'Cannot release ownership as memory is not owned' error");
+ checkCount(1);
+ kin.delete();
+ checkCount(0);
+ }
+
+ {
+ KlassInheritance kini = new KlassInheritance("KlassInheritanceInput");
+ checkCount(1);
+ String s = li_std_auto_ptr.takeKlassAutoPtr(kini);
+ checkCount(0);
+ if (!s.equals("KlassInheritanceInput"))
+ throw new RuntimeException("Incorrect string: " + s);
+ if (!li_std_auto_ptr.is_nullptr(kini))
+ throw new RuntimeException("is_nullptr failed");
+ kini.delete(); // Should not fail, even though already deleted
+ checkCount(0);
+ }
+
+ li_std_auto_ptr.takeKlassAutoPtr(null);
+ li_std_auto_ptr.takeKlassAutoPtr(li_std_auto_ptr.make_null());
+ checkCount(0);
+
+ // overloaded parameters
+ if (li_std_auto_ptr.overloadTest() != 0)
+ throw new RuntimeException("overloadTest failed");
+ if (li_std_auto_ptr.overloadTest(null) != 1)
+ throw new RuntimeException("overloadTest failed");
+ if (li_std_auto_ptr.overloadTest(new Klass("over")) != 1)
+ throw new RuntimeException("overloadTest failed");
+ checkCount(0);
+
+
+ // auto_ptr as output
Klass k1 = li_std_auto_ptr.makeKlassAutoPtr("first");
if (!k1.getLabel().equals("first"))
throw new RuntimeException("wrong object label");
Klass k2 = li_std_auto_ptr.makeKlassAutoPtr("second");
- if (Klass.getTotal_count() != 2)
- throw new RuntimeException("number of objects should be 2");
+ checkCount(2);
+ k1.delete();
k1 = null;
- {
- int countdown = 500;
- int expectedCount = 1;
- while (true) {
- WaitForGC();
- if (--countdown == 0)
- break;
- if (Klass.getTotal_count() == expectedCount)
- break;
- }
- int actualCount = Klass.getTotal_count();
- if (actualCount != expectedCount)
- System.err.println("GC failed to run (li_std_auto_ptr 1). Expected count: " + expectedCount + " Actual count: " + actualCount); // Finalizers are not guaranteed to be run and sometimes they just don't
- }
+ checkCount(1);
if (!k2.getLabel().equals("second"))
throw new RuntimeException("wrong object label");
+ k2.delete();
k2 = null;
- {
- int countdown = 500;
- int expectedCount = 0;
- while (true) {
- WaitForGC();
- if (--countdown == 0)
- break;
- if (Klass.getTotal_count() == expectedCount)
- break;
- };
- int actualCount = Klass.getTotal_count();
- if (actualCount != expectedCount)
- System.err.println("GC failed to run (li_std_auto_ptr 2). Expected count: " + expectedCount + " Actual count: " + actualCount); // Finalizers are not guaranteed to be run and sometimes they just don't
- }
+ checkCount(0);
+
+ if (li_std_auto_ptr.makeNullAutoPtr() != null)
+ throw new RuntimeException("null failure");
}
}
diff --git a/Examples/test-suite/java/li_std_string_runme.java b/Examples/test-suite/java/li_std_string_runme.java
index 1ee2a23c5..ffb9df9e6 100644
--- a/Examples/test-suite/java/li_std_string_runme.java
+++ b/Examples/test-suite/java/li_std_string_runme.java
@@ -104,5 +104,18 @@ public class li_std_string_runme {
throw new Exception("StaticMemberString2 test 2");
if (!Structure.getConstStaticMemberString().equals("const static member string"))
throw new Exception("ConstStaticMemberString test");
+
+ if (!li_std_string.stdstring_empty().equals(""))
+ throw new Exception("stdstring_empty test");
+ if (!li_std_string.c_empty().equals(""))
+ throw new Exception("c_empty test");
+ if (li_std_string.c_null() != null)
+ throw new Exception("c_null test");
+ if (li_std_string.get_null(li_std_string.c_null()) != null)
+ throw new Exception("get_null c_null test");
+ if (!li_std_string.get_null(li_std_string.c_empty()).equals("non-null"))
+ throw new Exception("get_null c_empty test");
+ if (!li_std_string.get_null(li_std_string.stdstring_empty()).equals("non-null"))
+ throw new Exception("get_null stdstring_empty test");
}
}
diff --git a/Examples/test-suite/java/multiple_inheritance_abstract_runme.java b/Examples/test-suite/java/multiple_inheritance_abstract_runme.java
index 1489d92a7..4230e7b9a 100644
--- a/Examples/test-suite/java/multiple_inheritance_abstract_runme.java
+++ b/Examples/test-suite/java/multiple_inheritance_abstract_runme.java
@@ -224,6 +224,7 @@ public class multiple_inheritance_abstract_runme {
check(multiple_inheritance_abstract.InputCPtrRefBottom1(b1)!=103+104, "InputCPtrRefBottom1() failed");
check(multiple_inheritance_abstract.InputCPtrRefBottom2(b2)!=206+205, "InputCPtrRefBottom2() failed");
check(multiple_inheritance_abstract.InputCPtrRefBottom3(b3)!=307+308+309, "InputCPtrRefBottom3() failed");
+
// Return pointers
check(multiple_inheritance_abstract.MakePtrDerived1_CBase1().cbase1y()!=3, "MakePtrDerived1_CBase1 failed");
check(multiple_inheritance_abstract.MakePtrDerived1_CBase2().cbase2()!=4, "MakePtrDerived1_CBase2 failed");
@@ -242,6 +243,15 @@ public class multiple_inheritance_abstract_runme {
check(multiple_inheritance_abstract.MakeRefDerived3_CBase1().cbase1y()!=7, "MakeRefDerived3_CBase1 failed");
check(multiple_inheritance_abstract.MakeRefDerived3_CBase2().cbase2()!=8, "MakeRefDerived3_CBase2 failed");
+ // Return const pointer references
+ check(multiple_inheritance_abstract.MakeConstPtrRefDerived1_CBase1().cbase1y()!=3, "MakeConstPtrRefDerived1_CBase1 failed");
+ check(multiple_inheritance_abstract.MakeConstPtrRefDerived1_CBase2().cbase2()!=4, "MakeConstPtrRefDerived1_CBase2 failed");
+ check(multiple_inheritance_abstract.MakeConstPtrRefDerived2_CBase1().cbase1y()!=6, "MakeConstPtrRefDerived2_CBase1 failed");
+ check(multiple_inheritance_abstract.MakeConstPtrRefDerived2_ABase1().abase1()!=5, "MakeConstPtrRefDerived2_ABase1 failed");
+ check(multiple_inheritance_abstract.MakeConstPtrRefDerived3_ABase1().abase1()!=9, "MakeConstPtrRefDerived3_ABase1 failed");
+ check(multiple_inheritance_abstract.MakeConstPtrRefDerived3_CBase1().cbase1y()!=7, "MakeConstPtrRefDerived3_CBase1 failed");
+ check(multiple_inheritance_abstract.MakeConstPtrRefDerived3_CBase2().cbase2()!=8, "MakeConstPtrRefDerived3_CBase2 failed");
+
// Return by value (sliced objects)
check(multiple_inheritance_abstract.MakeValDerived1_CBase1().cbase1y()!=1, "MakeValDerived1_CBase1 failed");
check(multiple_inheritance_abstract.MakeValDerived1_CBase2().cbase2()!=2, "MakeValDerived1_CBase2 failed");
diff --git a/Examples/test-suite/java/multiple_inheritance_interfaces_runme.java b/Examples/test-suite/java/multiple_inheritance_interfaces_runme.java
index 3f2b00000..df3e217fd 100644
--- a/Examples/test-suite/java/multiple_inheritance_interfaces_runme.java
+++ b/Examples/test-suite/java/multiple_inheritance_interfaces_runme.java
@@ -46,17 +46,17 @@ public class multiple_inheritance_interfaces_runme {
checkBaseAndInterfaces(IC.class, true, "", new String[] {"IA", "IB"});
checkBaseAndInterfaces(A.class, false, "", new String[] {"IA"});
checkBaseAndInterfaces(B.class, false, "", new String[] {"IB"});
- checkBaseAndInterfaces(C.class, false, "", new String[] {"IA", "IB", "IC"});
- checkBaseAndInterfaces(D.class, false, "", new String[] {"IA", "IB", "IC"});
+ checkBaseAndInterfaces(C.class, false, "", new String[] {"IC", "IA", "IB"});
+ checkBaseAndInterfaces(D.class, false, "", new String[] {"IC", "IA", "IB"});
checkBaseAndInterfaces(E.class, false, "D", new String[] {});
checkBaseAndInterfaces(IJ.class, true, "", new String[] {});
checkBaseAndInterfaces(IK.class, true, "", new String[] {"IJ"});
checkBaseAndInterfaces(IL.class, true, "", new String[] {"IK"});
checkBaseAndInterfaces(J.class, false, "", new String[] {"IJ"});
- checkBaseAndInterfaces(K.class, false, "", new String[] {"IJ", "IK"});
- checkBaseAndInterfaces(L.class, false, "", new String[] {"IJ", "IK", "IL"});
- checkBaseAndInterfaces(M.class, false, "", new String[] {"IJ", "IK", "IL"});
+ checkBaseAndInterfaces(K.class, false, "", new String[] {"IK", "IJ"});
+ checkBaseAndInterfaces(L.class, false, "", new String[] {"IL", "IK", "IJ"});
+ checkBaseAndInterfaces(M.class, false, "", new String[] {"IL", "IK", "IJ"});
checkBaseAndInterfaces(P.class, false, "", new String[] {});
checkBaseAndInterfaces(IQ.class, true, "", new String[] {});
@@ -74,5 +74,7 @@ public class multiple_inheritance_interfaces_runme {
d.ia(10);
d.ia("bye");
d.ia("bye", false);
+
+ UndesirablesSwigImpl.UndesiredStaticMethod(UndesirablesSwigImpl.UndesiredEnum.UndesiredEnum1);
}
}
diff --git a/Examples/test-suite/java/multiple_inheritance_nspace_runme.java b/Examples/test-suite/java/multiple_inheritance_nspace_runme.java
index 461c7a131..ed2d3377a 100644
--- a/Examples/test-suite/java/multiple_inheritance_nspace_runme.java
+++ b/Examples/test-suite/java/multiple_inheritance_nspace_runme.java
@@ -244,6 +244,15 @@ public class multiple_inheritance_nspace_runme {
check(multiple_inheritance_nspace.MakeRefDerived3_CBase1().cbase1y()!=7, "MakeRefDerived3_CBase1 failed");
check(multiple_inheritance_nspace.MakeRefDerived3_CBase2().cbase2()!=8, "MakeRefDerived3_CBase2 failed");
+ // Return const pointer references
+ check(multiple_inheritance_nspace.MakeConstPtrRefDerived1_CBase1().cbase1y()!=3, "MakeConstPtrRefDerived1_CBase1 failed");
+ check(multiple_inheritance_nspace.MakeConstPtrRefDerived1_CBase2().cbase2()!=4, "MakeConstPtrRefDerived1_CBase2 failed");
+ check(multiple_inheritance_nspace.MakeConstPtrRefDerived2_CBase1().cbase1y()!=6, "MakeConstPtrRefDerived2_CBase1 failed");
+ check(multiple_inheritance_nspace.MakeConstPtrRefDerived2_ABase1().abase1()!=5, "MakeConstPtrRefDerived2_ABase1 failed");
+ check(multiple_inheritance_nspace.MakeConstPtrRefDerived3_ABase1().abase1()!=9, "MakeConstPtrRefDerived3_ABase1 failed");
+ check(multiple_inheritance_nspace.MakeConstPtrRefDerived3_CBase1().cbase1y()!=7, "MakeConstPtrRefDerived3_CBase1 failed");
+ check(multiple_inheritance_nspace.MakeConstPtrRefDerived3_CBase2().cbase2()!=8, "MakeConstPtrRefDerived3_CBase2 failed");
+
// Return by value (sliced objects)
check(multiple_inheritance_nspace.MakeValDerived1_CBase1().cbase1y()!=1, "MakeValDerived1_CBase1 failed");
check(multiple_inheritance_nspace.MakeValDerived1_CBase2().cbase2()!=2, "MakeValDerived1_CBase2 failed");
diff --git a/Examples/test-suite/java/multiple_inheritance_overload_runme.java b/Examples/test-suite/java/multiple_inheritance_overload_runme.java
new file mode 100644
index 000000000..e516e7738
--- /dev/null
+++ b/Examples/test-suite/java/multiple_inheritance_overload_runme.java
@@ -0,0 +1,65 @@
+import multiple_inheritance_overload.*;
+
+public class multiple_inheritance_overload_runme {
+
+ static {
+ try {
+ System.loadLibrary("multiple_inheritance_overload");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void check(boolean fail, String msg) {
+ if (fail)
+ throw new RuntimeException(msg);
+ }
+
+ public static void main(String argv[]) {
+ int i = 0;
+ Base b1 = new Derived();
+ check(b1.Method(i) != 0, "b1.Method failed");
+ check(b1.MethodForRenaming(i) != 0, "b1.MethodForRenaming failed");
+ check(b1.MethodForRenamingConst(i) != 1, "b1.MethodForRenamingConst failed");
+ check(b1.MethodWarningSuppressed(i) != 0, "b1.MethodWarningSuppressed failed");
+ check(b1.NotVirtualMethod(i) != 0, "b1.NotVirtualMethod failed");
+ check(b1.SimilarOverloadedMethod(i) != 0, "b1.NotVirtualMethod failed");
+
+ Derived d1 = new Derived();
+ check(d1.Method(i) != 0, "d1.Method failed");
+ check(d1.MethodForRenaming(i) != 0, "d1.MethodForRenaming failed");
+ check(d1.MethodForRenamingConst(i) != 1, "d1.MethodForRenamingConst failed");
+ check(d1.MethodWarningSuppressed(i) != 0, "d1.MethodWarningSuppressed failed");
+ check(d1.NotVirtualMethod(i) != 0, "d1.NotVirtualMethod failed");
+ check(d1.SimilarOverloadedMethod(i) != 0, "d1.NotVirtualMethod failed");
+
+ check(d1.AnotherMethod(i) != 0, "d1.AnotherMethod failed");
+
+ Base db1 = BaseSwigImpl.in_out(d1);
+ check(db1.Method(i) != 0, "db1.Method failed");
+ check(db1.MethodForRenaming(i) != 0, "db1.MethodForRenaming failed");
+ check(db1.MethodForRenamingConst(i) != 1, "db1.MethodForRenamingConst failed");
+ check(db1.MethodWarningSuppressed(i) != 0, "db1.MethodWarningSuppressed failed");
+ check(db1.NotVirtualMethod(i) != 0, "db1.NotVirtualMethod failed");
+ check(db1.SimilarOverloadedMethod(i) != 0, "db1.NotVirtualMethod failed");
+
+ MoreDerived m1 = new MoreDerived();
+ check(m1.Method(i) != 0, "m1.Method failed");
+ check(m1.MethodForRenaming(i) != 0, "m1.MethodForRenaming failed");
+ check(m1.MethodForRenamingConst(i) != 1, "m1.MethodForRenamingConst failed");
+ check(m1.MethodWarningSuppressed(i) != 0, "m1.MethodWarningSuppressed failed");
+ check(m1.NotVirtualMethod(i) != 0, "m1.NotVirtualMethod failed");
+ check(m1.SimilarOverloadedMethod(i) != 0, "m1.NotVirtualMethod failed");
+
+ check(m1.AnotherMethod(i) != 0, "m1.AnotherMethod failed");
+
+ Base mb2 = BaseSwigImpl.in_out(m1);
+ check(mb2.Method(i) != 0, "mb2.Method failed");
+ check(mb2.MethodForRenaming(i) != 0, "mb2.MethodForRenaming failed");
+ check(mb2.MethodForRenamingConst(i) != 1, "mb2.MethodForRenamingConst failed");
+ check(mb2.MethodWarningSuppressed(i) != 0, "mb2.MethodWarningSuppressed failed");
+ check(mb2.NotVirtualMethod(i) != 0, "mb2.NotVirtualMethod failed");
+ check(mb2.SimilarOverloadedMethod(i) != 0, "mb2.NotVirtualMethod failed");
+ }
+}
diff --git a/Examples/test-suite/java/multiple_inheritance_shared_ptr_runme.java b/Examples/test-suite/java/multiple_inheritance_shared_ptr_runme.java
index 6472a911e..910913027 100644
--- a/Examples/test-suite/java/multiple_inheritance_shared_ptr_runme.java
+++ b/Examples/test-suite/java/multiple_inheritance_shared_ptr_runme.java
@@ -309,6 +309,15 @@ public class multiple_inheritance_shared_ptr_runme {
check(multiple_inheritance_shared_ptr.MakeRefDerived3_CBase1().cbase1y()!=7, "MakeRefDerived3_CBase1 failed");
check(multiple_inheritance_shared_ptr.MakeRefDerived3_CBase2().cbase2()!=8, "MakeRefDerived3_CBase2 failed");
+ // Return const pointer references
+ check(multiple_inheritance_shared_ptr.MakeConstPtrRefDerived1_CBase1().cbase1y()!=3, "MakeConstPtrRefDerived1_CBase1 failed");
+ check(multiple_inheritance_shared_ptr.MakeConstPtrRefDerived1_CBase2().cbase2()!=4, "MakeConstPtrRefDerived1_CBase2 failed");
+ check(multiple_inheritance_shared_ptr.MakeConstPtrRefDerived2_CBase1().cbase1y()!=6, "MakeConstPtrRefDerived2_CBase1 failed");
+ check(multiple_inheritance_shared_ptr.MakeConstPtrRefDerived2_ABase1().abase1()!=5, "MakeConstPtrRefDerived2_ABase1 failed");
+ check(multiple_inheritance_shared_ptr.MakeConstPtrRefDerived3_ABase1().abase1()!=9, "MakeConstPtrRefDerived3_ABase1 failed");
+ check(multiple_inheritance_shared_ptr.MakeConstPtrRefDerived3_CBase1().cbase1y()!=7, "MakeConstPtrRefDerived3_CBase1 failed");
+ check(multiple_inheritance_shared_ptr.MakeConstPtrRefDerived3_CBase2().cbase2()!=8, "MakeConstPtrRefDerived3_CBase2 failed");
+
// Return by value (sliced objects)
check(multiple_inheritance_shared_ptr.MakeValDerived1_CBase1().cbase1y()!=1, "MakeValDerived1_CBase1 failed");
check(multiple_inheritance_shared_ptr.MakeValDerived1_CBase2().cbase2()!=2, "MakeValDerived1_CBase2 failed");
diff --git a/Examples/test-suite/java/private_assign_runme.java b/Examples/test-suite/java/private_assign_runme.java
new file mode 100644
index 000000000..f214f9821
--- /dev/null
+++ b/Examples/test-suite/java/private_assign_runme.java
@@ -0,0 +1,20 @@
+import private_assign.*;
+
+public class private_assign_runme {
+
+ static {
+ try {
+ System.loadLibrary("private_assign");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ Three three = new Three();
+ TwoNotAssignableCopyable tn = three.getTwoNot();
+ TwoIsAssignableCopyable ti = three.getTwoIs();
+ three.setTwoIs(new TwoIsAssignableCopyable());
+ }
+}
diff --git a/Examples/test-suite/java/rname_runme.java b/Examples/test-suite/java/rname_runme.java
index dac0a1ecf..4af6581c2 100644
--- a/Examples/test-suite/java/rname_runme.java
+++ b/Examples/test-suite/java/rname_runme.java
@@ -25,7 +25,7 @@ public class rname_runme {
bar.foo_u((long)10);
RenamedBase base = new RenamedBase();
- base.fn(base, base, base);
+ base.fn1(base, base, base);
if (!base.newname(10.0).equals("Base"))
throw new RuntimeException("base.newname");
diff --git a/Examples/test-suite/java/special_variable_macros_runme.java b/Examples/test-suite/java/special_variable_macros_runme.java
index 1cd50e96e..c432c63d5 100644
--- a/Examples/test-suite/java/special_variable_macros_runme.java
+++ b/Examples/test-suite/java/special_variable_macros_runme.java
@@ -30,5 +30,9 @@ public class special_variable_macros_runme {
throw new RuntimeException("test failed");
NewName newName = NewName.factory("factoryname");
name = newName.getStoredName();
+ if (!special_variable_macros.makeStringInt("stringint", 999).equals("stringint"))
+ throw new RuntimeException("test failed");
+ if (!special_variable_macros.provideStringInt(999).equals("1000"))
+ throw new RuntimeException("test failed");
}
}
diff --git a/Examples/test-suite/java/template_construct_runme.java b/Examples/test-suite/java/template_construct_runme.java
new file mode 100644
index 000000000..c4e8e35d9
--- /dev/null
+++ b/Examples/test-suite/java/template_construct_runme.java
@@ -0,0 +1,24 @@
+
+import template_construct.*;
+
+public class template_construct_runme {
+
+ static {
+ try {
+ System.loadLibrary("template_construct");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ Foo_int fi = new Foo_int(0);
+ fi.delete();
+ Foo_short fs = new Foo_short();
+ fs.delete();
+ fs = new Foo_short();
+ fs.delete();
+ }
+}
+
diff --git a/Examples/test-suite/java/template_function_parm_runme.java b/Examples/test-suite/java/template_function_parm_runme.java
new file mode 100644
index 000000000..3c8f3d1a9
--- /dev/null
+++ b/Examples/test-suite/java/template_function_parm_runme.java
@@ -0,0 +1,25 @@
+import template_function_parm.*;
+
+public class template_function_parm_runme {
+
+ static {
+ try {
+ System.loadLibrary("template_function_parm");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ VectorInt vi = new VectorInt();
+ vi.add(10);
+ vi.add(20);
+ vi.add(30);
+
+ MyC myc = new MyC();
+ int sum = myc.take_function(template_function_parmConstants.accumulate_integers, vi);
+ if (sum != 60)
+ throw new RuntimeException("Expected sum of 60, got " + sum);
+ }
+}
diff --git a/Examples/test-suite/java/template_nested_flat_runme.java b/Examples/test-suite/java/template_nested_flat_runme.java
new file mode 100644
index 000000000..023c18590
--- /dev/null
+++ b/Examples/test-suite/java/template_nested_flat_runme.java
@@ -0,0 +1,35 @@
+
+import template_nested_flat.*;
+
+public class template_nested_flat_runme {
+
+ static {
+ try {
+ System.loadLibrary("template_nested_flat");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ new T_NormalTemplateNormalClass().tmethod(new NormalClass());
+ new OuterClass().T_OuterTMethodNormalClass(new NormalClass());
+
+ TemplateFuncs tf = new TemplateFuncs();
+ if (tf.T_TemplateFuncs1Int(-10) != -10)
+ throw new RuntimeException("it failed");
+ if (tf.T_TemplateFuncs2Double(-12.3) != -12.3)
+ throw new RuntimeException("it failed");
+
+ T_NestedOuterTemplateDouble tn = new T_NestedOuterTemplateDouble();
+ if (tn.hohum(-12.3) != -12.3)
+ throw new RuntimeException("it failed");
+ T_OuterClassInner1Int inner1 = new OuterClass().useInner1(new T_OuterClassInner1Int());
+ T_OuterClassInner2NormalClass inner2 = new T_OuterClassInner2NormalClass();
+ inner2.setEmbeddedVar(2);
+ T_OuterClassInner2NormalClass inner22 = new OuterClass().useInner2Again(inner2);
+ T_OuterClassInner1Double inner3 = new T_OuterClassInner1Double();
+ }
+}
+
diff --git a/Examples/test-suite/java/template_partial_specialization_more_runme.java b/Examples/test-suite/java/template_partial_specialization_more_runme.java
new file mode 100644
index 000000000..c990a1bc0
--- /dev/null
+++ b/Examples/test-suite/java/template_partial_specialization_more_runme.java
@@ -0,0 +1,49 @@
+import template_partial_specialization_more.*;
+
+public class template_partial_specialization_more_runme {
+
+ static {
+ try {
+ System.loadLibrary("template_partial_specialization_more");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ // (1)
+ VectInt vi = new VectInt();
+ int num = new FooVectIntDouble().partially_specialized(222);
+ new FooShortPtrDouble().pointer_specialize((short)0);
+ vi = new FooVectVectInt().partially_specialized(vi);
+
+ // (2)
+ new HeyInts().special_hey();
+
+ // (3)
+ new XX1().special1();
+ new XX2().special2();
+ new XX3().special3();
+
+ // (4)
+ new PartiallerPrimary().primary((short)0, (short)0);
+ new PartiallerSpecial().special(new PlainStruct(), 999, true);
+
+ // (5)
+ new LystDouble().primary(11.1, new AllocatorDouble());
+ new LystShort().primary((short)0, new AllocatorShort());
+ new LystPlainStructPtr().specialized1(new PlainStruct(), new AllocatorPlainStructPtr());
+ new LystDoublePtrPtr().specialized2(22.2, (SWIGTYPE_p_p_double)null);
+ new LystConstIntRef().specialized3(100);
+ new LystConstStringRef().specialized3("hello");
+
+ // (6)
+ SpecDoubleInt d = new SpecDoubleInt();
+ SpecStringInt i = new SpecStringInt();
+ d.spec_specialized(12.3);
+ i.spec_specialized("hi");
+ template_partial_specialization_more.UseSpec1(d, d);
+ template_partial_specialization_more.UseSpec2(i, i);
+ }
+}
diff --git a/Examples/test-suite/java/template_partial_specialization_typedef_runme.java b/Examples/test-suite/java/template_partial_specialization_typedef_runme.java
index 04653cdc0..008367c7a 100644
--- a/Examples/test-suite/java/template_partial_specialization_typedef_runme.java
+++ b/Examples/test-suite/java/template_partial_specialization_typedef_runme.java
@@ -12,12 +12,15 @@ public class template_partial_specialization_typedef_runme {
}
public static void main(String argv[]) {
+ double dub = 11.1;
+ Concrete concrete = new Concrete();
+
// One parameter tests
new A().a();
- new B().b();
- new C().c();
- new D().d();
- new E().e();
+ new B().b(); new B().bb(dub);
+ new C().c(); new C().cc(dub);
+ new D().d(); new D().dd(dub);
+ new E().e(); new E().ee(dub);
new F().f();
new G().g();
@@ -28,10 +31,10 @@ public class template_partial_specialization_typedef_runme {
new M().m();
new N().n();
- new BB().b();
- new BBB().b();
- new BBBB().b();
- new BBBBB().b();
+ new BB().b(); new BB().bb(true);
+ new BBB().b(); new BBB().bb('A');
+ new BBBB().b(); new BBBB().bb((short)12);
+ new BBBBB().b(); new BBBBB().bb(123);
new B1().b();
new B2().b();
@@ -40,18 +43,18 @@ public class template_partial_specialization_typedef_runme {
// Two parameter tests
new A_().a();
- new B_().b();
- new C_().c();
- new D_().d();
+ new B_().b(); new B_().bbb(dub);
+ new C_().c(); new C_().ccc(dub);
+ new D_().d(); new D_().ddd(123);
new E_().e();
new F_().f();
new G_().g();
- new C1_().c();
- new C2_().c();
- new C3_().c();
- new C4_().c();
- new B1_().b();
+ new C1_().c(); new C1_().ccc(concrete);
+ new C2_().c(); new C2_().ccc(concrete);
+ new C3_().c(); new C3_().ccc(concrete);
+ new C4_().c(); new C4_().ccc(concrete);
+ new B1_().b(); new B1_().bbb(concrete);
new E1_().e();
new E2_().e();
}
diff --git a/Examples/test-suite/java/template_specialization_using_declaration_runme.java b/Examples/test-suite/java/template_specialization_using_declaration_runme.java
new file mode 100644
index 000000000..133771b60
--- /dev/null
+++ b/Examples/test-suite/java/template_specialization_using_declaration_runme.java
@@ -0,0 +1,45 @@
+import template_specialization_using_declaration.*;
+
+public class template_specialization_using_declaration_runme {
+
+ static {
+ try {
+ System.loadLibrary("template_specialization_using_declaration");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+
+ ConcreteClass cc = new ConcreteClass(11);
+
+ // Base template tests
+ BaseTemplateString bs = new BaseTemplateString();
+ bs.method_primary("hi");
+
+ BaseTemplateConcreteClass cs = new BaseTemplateConcreteClass();
+ cs.method_specialization(cc);
+
+ BaseTemplateInt bi = new BaseTemplateInt();
+ bi.method_partial_specialization(22);
+
+
+ // Derived template tests
+ DerivedTemplateString ds = new DerivedTemplateString();
+ ds.method_primary("hi");
+ ds.method_primary_derived("hi");
+ ds.method_primary_hidden("hi");
+
+ DerivedTemplateConcreteClass dc = new DerivedTemplateConcreteClass();
+ dc.method_specialization(cc);
+ dc.method_specialization_derived(cc);
+ dc.method_specialization_hidden(cc);
+
+ DerivedTemplateInt di = new DerivedTemplateInt();
+ di.method_partial_specialization(22);
+ di.method_partial_specialization_derived(22);
+ di.method_partial_specialization_hidden(22);
+ }
+}
diff --git a/Examples/test-suite/java/template_template_parameters_runme.java b/Examples/test-suite/java/template_template_parameters_runme.java
index 42135b982..244e12985 100644
--- a/Examples/test-suite/java/template_template_parameters_runme.java
+++ b/Examples/test-suite/java/template_template_parameters_runme.java
@@ -14,15 +14,37 @@ public class template_template_parameters_runme {
}
public static void main(String argv[]) {
+ // Test part 1
ListFastBool listBool = new ListFastBool();
listBool.setItem(true);
+ boolean x_boolean = listBool.getAllotype();
if (listBool.getItem() != true)
throw new RuntimeException("Failed");
ListDefaultDouble listDouble = new ListDefaultDouble();
listDouble.setItem(10.2);
+ double x_double = listDouble.getAllotype();
if (listDouble.getItem() != 10.2)
throw new RuntimeException("Failed");
+
+ // Test part 2
+ FloatTestStruct floatTestStruct = new FloatTestStruct();
+ FloatContainer2 floatContainer2 = floatTestStruct.getX();
+ floatContainer2.setX(8.1f);
+ IntTestStruct intTestStruct = new IntTestStruct();
+ IntContainer1 intContainer1 = intTestStruct.getX();
+ intContainer1.setX(91);
+ if (intContainer1.getX() != 91)
+ throw new RuntimeException("Failed");
+ if (intTestStruct.getX().getX() != 91)
+ throw new RuntimeException("Failed");
+ IntTestStruct intTestStructReturned = template_template_parameters.TestStructContainer1Method(intTestStruct);
+ if (intTestStructReturned.getX().getX() != 101)
+ throw new RuntimeException("Failed");
+
+ // Test part 3
+ MyFootInt99 mfi99 = new MyFootInt99();
+ mfi99.OperatorPlusEquals(mfi99);
}
}
diff --git a/Examples/test-suite/java/template_template_template_parameters_runme.java b/Examples/test-suite/java/template_template_template_parameters_runme.java
new file mode 100644
index 000000000..519a9e068
--- /dev/null
+++ b/Examples/test-suite/java/template_template_template_parameters_runme.java
@@ -0,0 +1,36 @@
+
+
+import template_template_template_parameters.*;
+
+public class template_template_template_parameters_runme {
+
+ static {
+ try {
+ System.loadLibrary("template_template_template_parameters");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ CustomAttrs custom_attrs = new CustomAttrs();
+ AC ac = new AC();
+ BAC bac = new BAC();
+ CBAC cbac = new CBAC();
+ DBAC dbac = new DBAC();
+
+ custom_attrs = ac.getAttributes();
+ custom_attrs = bac.getAttributes();
+ custom_attrs = cbac.getAttributes();
+ custom_attrs = dbac.getAttributes();
+
+ bac.BMethod(custom_attrs, ac);
+ cbac.BMethod(custom_attrs, ac);
+ dbac.BMethod(custom_attrs, ac);
+
+ cbac.CMethod(custom_attrs, bac);
+ dbac.DMethod(custom_attrs, bac);
+ }
+}
+
diff --git a/Examples/test-suite/java/template_templated_constructors_runme.java b/Examples/test-suite/java/template_templated_constructors_runme.java
index cd3f31d21..ec20b9486 100644
--- a/Examples/test-suite/java/template_templated_constructors_runme.java
+++ b/Examples/test-suite/java/template_templated_constructors_runme.java
@@ -21,6 +21,16 @@ public class template_templated_constructors_runme {
TClass2Int tc2a = new TClass2Int();
TClass2Int tc2b = new TClass2Int(123.4);
+ DoublePair double_pair = new DoublePair(1.1, 2.2);
+ ShortPair short_pair = new ShortPair((short)0, (short)1);
+ StringPair string_pair = new StringPair("10", "11");
+ IntPair ip1 = new IntPair();
+ IntPair ip2 = new IntPair(20, 21);
+ IntPair ip3 = new IntPair(ip1);
+ IntPair ip4 = new IntPair(short_pair);
+ // These next two use IntPair constructors, unlike Python which requires factory function calls
+ IntPair ip5 = new IntPair(double_pair);
+ IntPair ip6 = new IntPair(string_pair);
}
}
diff --git a/Examples/test-suite/java/template_type_collapse_runme.java b/Examples/test-suite/java/template_type_collapse_runme.java
new file mode 100644
index 000000000..11c6c8c5e
--- /dev/null
+++ b/Examples/test-suite/java/template_type_collapse_runme.java
@@ -0,0 +1,26 @@
+import template_type_collapse.*;
+
+public class template_type_collapse_runme {
+
+ static {
+ try {
+ System.loadLibrary("template_type_collapse");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ int i = 1234;
+ ConsterInt ci = new DerivedConsterInt();
+ ci.cccc1(i);
+ ci.cccc2(i);
+ ci.cccc3(i);
+ ci.cccc4(i);
+
+ DerivedConsterInt dci = new DerivedConsterInt();
+ dci.dddd(i);
+ }
+}
+
diff --git a/Examples/test-suite/java/template_using_member_default_arg_runme.java b/Examples/test-suite/java/template_using_member_default_arg_runme.java
new file mode 100644
index 000000000..5939158ad
--- /dev/null
+++ b/Examples/test-suite/java/template_using_member_default_arg_runme.java
@@ -0,0 +1,22 @@
+import template_using_member_default_arg.*;
+
+public class template_using_member_default_arg_runme {
+
+ static {
+ try {
+ System.loadLibrary("template_using_member_default_arg");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ ThingADerivedInt a = new ThingADerivedInt();
+ a.describeA();
+ ThingBDerivedInt b = new ThingBDerivedInt();
+ b.describeB();
+ }
+}
+
+
diff --git a/Examples/test-suite/java/typemap_out_optimal_runme.java b/Examples/test-suite/java/typemap_out_optimal_runme.java
index 8a87f0c4b..254b0c6b6 100644
--- a/Examples/test-suite/java/typemap_out_optimal_runme.java
+++ b/Examples/test-suite/java/typemap_out_optimal_runme.java
@@ -12,10 +12,16 @@ public class typemap_out_optimal_runme {
}
}
- public static XX x = null;
public static void main(String argv[]) {
- XX.setDebug(false);
- x = XX.create();
+ XX.setTrace(false);
+ {
+ XX x = XX.create();
+ x.delete();
+ }
+ {
+ XX x = XX.createConst();
+ x.delete();
+ }
}
}
diff --git a/Examples/test-suite/java/using_member_multiple_inherit_runme.java b/Examples/test-suite/java/using_member_multiple_inherit_runme.java
new file mode 100644
index 000000000..769ba6ca5
--- /dev/null
+++ b/Examples/test-suite/java/using_member_multiple_inherit_runme.java
@@ -0,0 +1,46 @@
+import using_member_multiple_inherit.*;
+
+public class using_member_multiple_inherit_runme {
+ static {
+ try {
+ System.loadLibrary("using_member_multiple_inherit");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ // Single inheritance three deep, only using declarations
+ Susing3 s3 = new Susing3();
+ s3.usingmethod(11);
+
+ // Single inheritance three deep, overload using and methods
+ Using3 u3 = new Using3();
+ u3.usingmethod(11);
+ u3.usingmethod(11, 22);
+ u3.usingmethod(11, 22, 33);
+
+ Musing3 m3 = new Musing3();
+ m3.usingmethod(11);
+ m3.usingmethod(11, 22);
+ m3.usingmethod(11, 22, 33);
+
+ Dusing3 d3 = new Dusing3();
+ d3.usingmethod(11);
+ d3.usingmethod(11, 22);
+
+ // Multiple inheritance, multiple using declarations
+ MultMiddleA ma = new MultMiddleA();
+ ma.multmethod(123);
+ ma.multmethod("hi");
+ ma.multmethod(123, 234);
+
+ MultBottomB mb = new MultBottomB();
+ mb.multmethod(123);
+ mb.multmethod("hi");
+ mb.multmethod(123, 234);
+ mb.multmethod(123, 345, 567);
+ }
+}