diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2018-06-27 16:25:53 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-06-28 13:51:20 +0000 |
commit | df434b9037d0c9b1bb105658980aca76dbe6a688 (patch) | |
tree | 1f78384d225e73241564a1df217ad251b85f18c0 | |
parent | 01551581d7fc4c5489aefba4d90ce0797a8af6b1 (diff) |
jvpp: pass tuple of classes to isinstance()
Change-Id: I887af26d7d6476d7d9e6fbaa671f923814aa03bb
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
-rwxr-xr-x | src/vpp-api/java/jvpp/gen/jvppgen/jni_common_gen.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/jni_common_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/jni_common_gen.py index 057427dfcfc..397b92b528f 100755 --- a/src/vpp-api/java/jvpp/gen/jvppgen/jni_common_gen.py +++ b/src/vpp-api/java/jvpp/gen/jvppgen/jni_common_gen.py @@ -56,7 +56,7 @@ def generate_j2c_field_swap(field, struct_ref_name): def _generate_j2c_array_swap(field, struct_ref_name): # TODO(VPP-1186): move the logic to JNI generators base_type = field.type.base_type - if isinstance(base_type, Class) or isinstance(base_type, Enum) or isinstance(base_type, Union): + if isinstance(base_type, (Class, Enum, Union)): return _generate_j2c_object_array_swap(field, struct_ref_name) elif base_type.is_swap_needed: return _generate_j2c_primitive_type_array_swap(field, struct_ref_name) @@ -184,7 +184,7 @@ def generate_c2j_swap(element, object_ref_name, struct_ref_name): def _generate_c2j_array_swap(msg_java_name, field, object_ref_name, struct_ref_name): # TODO(VPP-1186): move the logic to JNI generators base_type = field.type.base_type - if isinstance(base_type, Class) or isinstance(base_type, Union): + if isinstance(base_type, (Class, Union)): return _generate_c2j_object_array_swap(msg_java_name, field, object_ref_name, struct_ref_name) elif isinstance(base_type, Enum): return _generate_c2j_enum_array_swap(msg_java_name, field, object_ref_name, struct_ref_name) @@ -332,7 +332,7 @@ def _generate_c2j_scalar_swap(msg_java_name, field, object_ref_name, struct_ref_ field_type = field.type if field_type.is_swap_needed: # TODO(VPP-1186): move the logic to JNI generators - if isinstance(field_type, Class) or isinstance(field_type, Union): + if isinstance(field_type, (Class, Union)): return _generate_c2j_object_swap(msg_java_name, field, object_ref_name, struct_ref_name) elif isinstance(field_type, Enum): return _generate_c2j_enum_swap(msg_java_name, field, object_ref_name, struct_ref_name) |