refactor(libcobj): minor maintainability cleanups around INDEXED file cursor#839
Draft
yutaro-sakamoto wants to merge 4 commits into
Draft
refactor(libcobj): minor maintainability cleanups around INDEXED file cursor#839yutaro-sakamoto wants to merge 4 commits into
yutaro-sakamoto wants to merge 4 commits into
Conversation
`IndexedCursor.close()` had an empty body, so every call site (`CobolIndexedFile.close_`, the cursor replacement path, the private `closeCursor()` helper, and `returnWith`) was a no-op. Drop the method along with its callers to remove dead code. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The method body was empty, so every invocation in CobolIndexedFile was a no-op. Remove the method, the private closeCursor() helper, and all remaining calls. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The field's set/reset were observable nowhere: the only read site was followed by an identical `!cursor.isPresent()` guard, so toggling the flag never affected the return value. Drop the field, its writes in `open_` / `write_` / `delete_`, and collapse the read site to the equivalent cursor-presence check. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
概要
INDEXED ファイル実装まわりの保守容易性を、ほんの少しだけ上げるための小規模なリファクタです。挙動の変更を意図したものではなく、純粋に内部の整理を目的としています。
変更内容
IndexedCursorの内部ヘルパーメソッド(fetchFirstRecord,fetchLastRecord,forwardNextRecord,backwardPrevRecord,fetchRecord,prevほか)にprivate修飾子を付与し、クラス外から呼ぶべきでないものを明示しました。IndexedCursor.close()は本体が空のメソッドだったため削除しました。呼び出し側だったCobolIndexedFileのclose_/returnWithおよび private なcloseCursor()ヘルパーからも、対応する呼び出しを除去しています。IndexedCursor.reloadCursor()はOptional.of(this)を返すだけの no-op であり、呼び出し側でも実質的にカーソル状態を再構築していなかったため削除しました。CobolIndexedFile.updateWhileReadingフィールドを削除しました。readNext_internal内の唯一の読み取り箇所は直後の!cursor.isPresent()ガードと等価な分岐だけを持っており、フラグの set/reset は返り値に観測可能な影響を与えていませんでした。同等の挙動になることをロジック追跡で確認済みです。Summary (English)
This PR contains a small set of refactors aimed at making the INDEXED file implementation slightly easier to maintain. No behavioral change is intended.
Changes
privatemodifiers to internal helper methods ofIndexedCursor(fetchFirstRecord,fetchLastRecord,forwardNextRecord,backwardPrevRecord,fetchRecord,prev, etc.) so that the externally-callable API surface becomes explicit.IndexedCursor.close(), which had an empty body. The call sites inCobolIndexedFile(close_,returnWith, and the smallcloseCursor()private helper that wrapped them) are removed accordingly.IndexedCursor.reloadCursor(), which was a no-op returningOptional.of(this); callers did not actually reconstruct cursor state with it.updateWhileReadingfield inCobolIndexedFile. The single read site inreadNext_internalwas immediately followed by an equivalent!cursor.isPresent()guard, so toggling the flag had no observable effect on the return value. The collapsed control flow has been verified to be equivalent by case analysis.