SWIGTYPE && input typemaps now assume object has been moved - Java
Implementation tweak - better RAII. SWIGTYPE && null pointer check.
This commit is contained in:
parent
c10a84c775
commit
0634883089
2 changed files with 19 additions and 3 deletions
|
|
@ -56,5 +56,21 @@ public class cpp11_rvalue_reference_move_input_runme {
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -695,12 +695,12 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); }
|
|||
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null");
|
||||
return $null;
|
||||
} %}
|
||||
%typemap(in) SWIGTYPE && %{ $1 = *($&1_ltype)&$input;
|
||||
%typemap(in, fragment="<memory>") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) %{ $1 = *($&1_ltype)&$input;
|
||||
if (!$1) {
|
||||
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null");
|
||||
return $null;
|
||||
} %}
|
||||
%typemap(freearg) SWIGTYPE && %{ delete $1; %}
|
||||
}
|
||||
rvrdeleter.reset($1); %}
|
||||
%typemap(out) SWIGTYPE *
|
||||
%{ *($&1_ltype)&$result = $1; %}
|
||||
%typemap(out, fragment="SWIG_PackData", noblock=1) SWIGTYPE (CLASS::*) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue