Fix #1238798 - Directors using unsigned long long or any other type
marshalled across the JNI boundary using a Java class (where the jni typemap contains jobject). git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9434 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
66e0877ead
commit
e4e5063d3c
1 changed files with 32 additions and 30 deletions
|
|
@ -3092,13 +3092,32 @@ class JAVA : public Language {
|
|||
"No jtype typemap defined for %s\n", SwigType_str(returntype,0));
|
||||
}
|
||||
|
||||
String *cdesc = NULL;
|
||||
SwigType *covariant = Getattr(n,"covariant");
|
||||
SwigType *adjustedreturntype = covariant ? covariant : returntype;
|
||||
Parm *adjustedreturntypeparm = NewParmFromNode(adjustedreturntype, empty_str, n);
|
||||
|
||||
if ((tm = Swig_typemap_lookup_new("directorin", adjustedreturntypeparm, "", 0))
|
||||
&& (cdesc = Getattr(adjustedreturntypeparm, "tmap:directorin:descriptor"))) {
|
||||
|
||||
// Note that in the case of polymorphic (covariant) return types, the
|
||||
// method's return type is changed to be the base of the C++ return
|
||||
// type
|
||||
String *jnidesc_canon = canonicalizeJNIDescriptor(cdesc, adjustedreturntypeparm);
|
||||
Append(classret_desc, jnidesc_canon);
|
||||
Delete(jnidesc_canon);
|
||||
} else {
|
||||
Swig_warning(WARN_TYPEMAP_DIRECTORIN_UNDEF, input_file, line_number,
|
||||
"No or improper directorin typemap defined for %s\n", SwigType_str(returntype,0));
|
||||
output_director = false;
|
||||
}
|
||||
|
||||
/* Get the JNI field descriptor for this return type, add the JNI field descriptor
|
||||
to jniret_desc */
|
||||
|
||||
Parm *retpm = NewParmFromNode(returntype, empty_str, n);
|
||||
|
||||
if ((c_ret_type = Swig_typemap_lookup_new("jni", retpm, "", 0))) {
|
||||
String *jdesc;
|
||||
Parm *tp = NewParmFromNode(c_ret_type, empty_str, n);
|
||||
|
||||
if (!is_void && !ignored_method) {
|
||||
|
|
@ -3107,11 +3126,15 @@ class JAVA : public Language {
|
|||
Delete(jretval_decl);
|
||||
}
|
||||
|
||||
String *jdesc = NULL;
|
||||
if ((tm = Swig_typemap_lookup_new("directorin", tp, "", 0))
|
||||
&& (jdesc = Getattr(tp, "tmap:directorin:descriptor"))) {
|
||||
String *jnidesc_canon;
|
||||
|
||||
jnidesc_canon = canonicalizeJNIDescriptor(jdesc, tp);
|
||||
// Objects marshalled passing a Java class across JNI boundary use jobject - the nouse flag indicates this
|
||||
// We need the specific Java class name instead of the generic 'Ljava/lang/Object;'
|
||||
if (GetFlag(tp, "tmap:directorin:nouse"))
|
||||
jdesc = cdesc;
|
||||
String *jnidesc_canon = canonicalizeJNIDescriptor(jdesc, tp);
|
||||
Append(jniret_desc, jnidesc_canon);
|
||||
Delete(jnidesc_canon);
|
||||
} else {
|
||||
|
|
@ -3127,28 +3150,6 @@ class JAVA : public Language {
|
|||
output_director = false;
|
||||
}
|
||||
|
||||
String *jdesc;
|
||||
|
||||
SwigType *covariant = Getattr(n,"covariant");
|
||||
SwigType *adjustedreturntype = covariant ? covariant : returntype;
|
||||
Parm *adjustedreturntypeparm = NewParmFromNode(adjustedreturntype, empty_str, n);
|
||||
|
||||
if ((tm = Swig_typemap_lookup_new("directorin", adjustedreturntypeparm, "", 0))
|
||||
&& (jdesc = Getattr(adjustedreturntypeparm, "tmap:directorin:descriptor"))) {
|
||||
String *jnidesc_canon;
|
||||
|
||||
// Note that in the case of polymorphic (covariant) return types, the
|
||||
// method's return type is changed to be the base of the C++ return
|
||||
// type
|
||||
jnidesc_canon = canonicalizeJNIDescriptor(jdesc, adjustedreturntypeparm);
|
||||
Append(classret_desc, jnidesc_canon);
|
||||
Delete(jnidesc_canon);
|
||||
} else {
|
||||
Swig_warning(WARN_TYPEMAP_DIRECTORIN_UNDEF, input_file, line_number,
|
||||
"No or improper directorin typemap defined for %s\n", SwigType_str(returntype,0));
|
||||
output_director = false;
|
||||
}
|
||||
|
||||
Delete(adjustedreturntypeparm);
|
||||
Delete(retpm);
|
||||
}
|
||||
|
|
@ -3222,9 +3223,7 @@ class JAVA : public Language {
|
|||
|
||||
if ((tm = Swig_typemap_lookup_new("directorin", tp, "", 0))
|
||||
&& (jdesc = Getattr(tp, "tmap:directorin:descriptor"))) {
|
||||
String *jni_canon;
|
||||
|
||||
jni_canon = canonicalizeJNIDescriptor(jdesc, tp);
|
||||
String *jni_canon = canonicalizeJNIDescriptor(jdesc, tp);
|
||||
Append(jnidesc, jni_canon);
|
||||
Delete(jni_canon);
|
||||
Delete(tm);
|
||||
|
|
@ -3273,9 +3272,12 @@ class JAVA : public Language {
|
|||
&& (jdesc = Getattr(tp, "tmap:directorin:descriptor"))
|
||||
&& (tm = Getattr(p, "tmap:directorin"))
|
||||
&& (cdesc = Getattr(p, "tmap:directorin:descriptor"))) {
|
||||
String *jni_canon;
|
||||
|
||||
jni_canon = canonicalizeJNIDescriptor(jdesc, tp);
|
||||
// Objects marshalled by passing a Java class across the JNI boundary use jobject as the JNI type -
|
||||
// the nouse flag indicates this. We need the specific Java class name instead of the generic 'Ljava/lang/Object;'
|
||||
if (GetFlag(tp, "tmap:directorin:nouse"))
|
||||
jdesc = cdesc;
|
||||
String *jni_canon = canonicalizeJNIDescriptor(jdesc, tp);
|
||||
Append(jnidesc, jni_canon);
|
||||
Delete(jni_canon);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue