Skip to content

Runtime checks of variable-length calls #924

@grlrrchapman

Description

@grlrrchapman

Accessing a variable length SBE property modifies the state of the auto-generated SBE classes by advancing an offset field. Client code has to access every variable length property exactly once, in order. It's common to pass around lists or strings whose length we can't know ahead of time; in such cases SBE client code is brittle and hard to debug.

Could you add in optional runtime checks that validate that getters / setters of variable-length properties are called in the correct order? These would do the following:

  • If enabled:
    • Register calls that access variable length properties
    • If variable length properties are accessed out of order, throw an exception with a diagnostic error message
  • In disabled:
    • Do nothing. Ideally, don't even compile the code which enforces the check

The checks would be either enabled / disabled at compile time. I would anticipate using them in debug builds (used in development work / some continuous integration plans) and disabling them in release builds (used in production), but other users might want to enable them in different contexts.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions