Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API design: StructuralNode.getBlocks() may return null #761

Closed
jensnerche opened this issue Jan 28, 2019 · 2 comments
Closed

API design: StructuralNode.getBlocks() may return null #761

jensnerche opened this issue Jan 28, 2019 · 2 comments
Assignees

Comments

@jensnerche
Copy link

Returning 'null' for Collections or Arrays is widly seen as a Bad Practice in API design. Please consider returning an empty list of blocks instead. I saw it in org.asciidoctor.ast.impl.ListImpl
and org.asciidoctor.ast.impl.DescriptionListImpl implementations.

@mojavelinux
Copy link
Member

I'd be fine with returning an empty list. Even the Ruby API always returns a non-null object, so it's consistent.

@robertpanzer
Copy link
Member

I just saw that In Asciidoctor List#items is an alias for List#blocks.
I'll probably just mirror that behavior.

@robertpanzer robertpanzer self-assigned this Mar 8, 2019
robertpanzer added a commit that referenced this issue Mar 9, 2019
Fixes #761. Make List.blocks() and DefinitionList.blocks() delegate t…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants