Codec Interface to Abstract class, made all paths call parseImpl/writeImpl - #892
Codec Interface to Abstract class, made all paths call parseImpl/writeImpl#892ldintr wants to merge 5 commits into
Conversation
JUnit Test Report 523 files + 2 523 suites +2 31s ⏱️ +6s Results for commit 6ff8dd8. ± Comparison against base commit 6762bb6. This pull request removes 6 and adds 98 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
Integration Test Report 428 files ±0 428 suites ±0 16m 56s ⏱️ - 4m 9s Results for commit 6ff8dd8. ± Comparison against base commit 6762bb6. This pull request removes 2 and adds 2 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
anthony-swirldslabs
left a comment
There was a problem hiding this comment.
You want to add javadocs to any new protected/public methods. I also left a minor comment. Other than that, the changes look great. Thanks!
| default T parse(@NonNull ReadableSequentialData input, boolean strictMode, boolean parseUnknownFields, int maxDepth) | ||
| public final T parse( | ||
| @NonNull ReadableSequentialData input, boolean strictMode, boolean parseUnknownFields, int maxDepth) |
There was a problem hiding this comment.
Minor: I'd go as far as to actually nuke all the overloads that supply default argument values. In the current fix where these methods have simply been made final, the benefit of the code simplification is a bit small to my liking.
| return writeImpl(item, output, startOffset); | ||
| } | ||
|
|
||
| // some classes generate this overload, but not all |
There was a problem hiding this comment.
How come? Our codec generator here in PBJ is supposed to generate them (or not) unconditionally.
Also, you want to add javadocs to any public/protected methods that you introduce here.
There was a problem hiding this comment.
I looked into it and changed the comment to
CodecWriteByteArrayMethodGenerator.java generates this method for Codecs but not JsonCodecs
We provide a default implementation here so hand written codecs don't need to.
There was a problem hiding this comment.
Thanks! If that comment in code says exactly this verbatim, then that part would look good.
Description:
I didn't like how classes could have a 5 signature parse call a 3 signature overload ignoring some parameters (idr where I saw that, it was outside of obj). I would rather a consistent entry (which I'll use to call throwOnError in the future), and a consistent impl.
Here's a quick look. I may change (or rebase in the future) better javadoc.
Checklist
Comments
I noticed I couldn't make this final because sometimes a class overloads it and other times there's no impl
It seems like there's a chance they cane become inconsistent