v2.5.x: Fixes #1096. Make Cell extend StructuralNode instead of ContentNode. #1101
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thank you for opening a pull request and contributing to AsciidoctorJ!
Please take a bit of time giving some details about your pull request:
Kind of change
Description
What is the goal of this pull request?
Similar to #1099 this PR makes org.asciidoctor.ast.Cell extend StructuralNode instead of ContentNode.
This matches also the class hierarchy in Asciidoctor Ruby.
That way, if Document.findBy() returns a Cell in the result list there will no longer be a ClassCastException.
How does it achieve that?
Are there any alternative ways to implement this?
Probably.
Are there any implications of this pull request? Anything a user must know?
I'd like to argue that this is an almost fully compatible change that doesn't even break binary compatibility: https://docs.oracle.com/javase/specs/jls/se7/html/jls-13.html
Someone might have been able to write code that would now break (
assert !StructuralNode.class.isInstance(cell)
), but that can be said for any bugfix.Please note that this PR is for the v2.5.x maintenance branch!!!
Issue
If this PR fixes an open issue, please add a line of the form:
Fixes #1096
Release notes
Please add a corresponding entry to the file CHANGELOG.adoc