Skip to content

Commit

Permalink
Fix Java header generation for attributes with nullable list type. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Oct 25, 2023
1 parent f4e937f commit 3056577
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/py_matter_idl/matter_idl/generators/java/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,17 @@ def _CppType(field: Field, context: TypeLookupContext) -> str:
def DecodableJniType(field: Field, context: TypeLookupContext) -> str:
actual = _CppType(field, context)

needsConstRef = False
if field.is_list:
return f"const chip::app::DataModel::DecodableList<{actual}> &"
needsConstRef = True
actual = f"chip::app::DataModel::DecodableList<{actual}>"

if field.is_nullable:
return f"const chip::app::DataModel::Nullable<{actual}> &"
needsConstRef = True
actual = f"chip::app::DataModel::Nullable<{actual}>"

if needsConstRef:
actual = f"const {actual} &"

return actual

Expand Down

0 comments on commit 3056577

Please sign in to comment.