Closed and ajar protocols are not allowed to contain flexible two-way methods:
{% include “docs/reference/fidl/language/error-catalog/label/_bad.md” %}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/bad/fi-0115.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
Instead, mark the two-way method strict
instead of flexible
:
{% include “docs/reference/fidl/language/error-catalog/label/_good.md” %}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/good/fi-0115-a.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
Alternatively, mark the protocol open
instead of closed
or ajar
:
{% include “docs/reference/fidl/language/error-catalog/label/_good.md” %}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/good/fi-0115-b.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
This error exists because the purpose of the closed
(or ajar
) modifier is to make sure a method does not contain any flexible (two-way) methods. When first creating a protocol, you should carefully think about whether it should be closed, ajar, or open based on the evolvability properties you need from it.
See RFC-0138: Handling unknown interactions for more information about protocol modifiers.