refactor: remove dead AbstractBody.writeNotRead() - #3196
Conversation
Nothing has called writeNotRead() since 721428c (2020-10-13, "introduction of MessageObserver.bodyChunk()"). Before that commit, AbstractBody.write() picked between writeNotRead() and writeStreamed() on hasRelevantObservers(); it dropped the branch and now dispatches only to writeStreamed() or writeAlreadyRead(), leaving writeNotRead() orphaned as an abstract method every AbstractBody subclass still had to implement. Removes the declaration, all six overrides (Body, ChunkedBody, XmlDomBody, EmptyBody, StreamInfo.Http2Body, ServerSentEventsDemoStreamInterceptor's StreamingBody) and the stub in BodyTest. No helper becomes unused: StreamInfo's createByteArray() and removeDataFrame() are still called from readLocal(), and XmlDomBody's writeNotRead() only delegated to writeAlreadyRead(). No behaviour change - the removed code was unreachable. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (8)
💤 Files with no reviewable changes (8)
Included review availability: Your plan provides up to 4 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe change removes ChangesBody write-path simplification
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This deletion-only refactor removes an unreachable method and its overrides without changing runtime behavior; no actionable merge-blocking risk remains after normal checks and review. Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What
Removes
AbstractBody.writeNotRead(), all six overrides and the test stub. Deletion only, 79 lines.Why
Nothing has called it since
721428ca2(2020-10-13, "introduction of MessageObserver.bodyChunk()").Before that commit
AbstractBody.write()chose between the two paths:That commit dropped the branch —
writeStreamed()handles both cases now — andwrite()hasdispatched only to
writeStreamed()orwriteAlreadyRead()ever since.writeNotRead()stayedbehind as an abstract method that every
AbstractBodysubclass had to implement, in three caseswith a full body that could never run.
Removed
http/AbstractBody.javahttp/Body.javahttp/ChunkedBody.javatransport/http2/StreamInfo.javaHttp2Bodyoverride (20 lines)http/XmlDomBody.javawriteAlreadyRead()http/EmptyBody.javainterceptor/sse/ServerSentEventsDemoStreamInterceptor.javaStreamingBodyempty overridehttp/BodyTest.javaAbstractBodyNo helper is orphaned:
StreamInfo'screateByteArray()andremoveDataFrame()are still calledfrom
readLocal(), andBody'sBUFFER_SIZE/ChunkedBody'sreadChunkSize(),readByteArray()and
readTrailer()are all still used by the live paths.Verification
mvn -o -DskipTests install— BUILD SUCCESS across the whole reactor, so no caller existed in anymodule.
com.predic8.membrane.core.http— 293/293 green.com.predic8.membrane.core.transport— 126/126 green (1 pre-existing skip).ServerSentEventsDemoStreamInterceptorhas no unit test (it is covered bydistribution/tutorials/misc/Server-Sent-Events.yaml); itsStreamingBodyoverrideswrite()directly, so it never reached any of these methods, and only an empty body was deleted.
No behaviour change — the removed code was unreachable.
🤖 Generated with Claude Code
Summary by CodeRabbit