Update Javadoc for libcobj/user_util#836
Update Javadoc for libcobj/user_util#836tsh-hashimoto wants to merge 2 commits intoopensourcecobol:developfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR replaces placeholder TODO Javadocs in libcobj/user_util with more complete Japanese documentation, mainly around the cobj-idx indexed-file utility (record I/O, CLI behaviors) and the cobj-api Java-file generator.
Changes:
- Document
RecordReader/RecordWriterresponsibilities and the stdin/file reader implementations for SEQUENTIAL / LINE SEQUENTIAL formats. - Expand
IndexedFileUtilMainmethod Javadocs for key parsing and subcommands (info,load,unload,migrate,unlock,create). - Add/clarify Javadocs in
cobj_api(input JSON path, generated files, and helper method behavior).
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
.../indexed_file/StdinRecordReader.java |
Adds class/inner-class Javadocs for stdin-based readers and the factory method. |
.../indexed_file/RecordWriter.java |
Documents the record output interface used by cobj-idx unload. |
.../indexed_file/RecordReader.java |
Documents the record input interface and its factory method for file vs stdin. |
.../indexed_file/IndexedFileUtilMain.java |
Subcommand and helper method Javadocs (key parsing, migrate/unlock, load/unload, create). |
.../indexed_file/FileSeqRecordReader.java |
Documents SEQUENTIAL file reading semantics (incl. trailing newline handling). |
.../indexed_file/FileLineSeqRecordReader.java |
Documents LINE SEQUENTIAL file reading semantics. |
.../indexed_file/ErrorLib.java |
Updates class/method descriptions for error reporting/exit codes. |
.../indexed_file/CobolFileKeyInfo.java |
Adds class/field/ctor documentation for key metadata. |
.../cobj_api/ApiFilesOptions.java |
Adds doc for the JSON input path field. |
.../cobj_api/ApiFiles.java |
Expands docs for generated files and helper output formatting behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
コードレビュー結論: ブロッキングな指摘事項はありません。 対象は
検討したが採用しなかった指摘 (参考)
🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
概要
libcobj/app/src/main/java/jp/osscons/opensourcecobol/libcobj/user_util配下の Javadoc を整備する。TODO: 準備中のままになっていた箇所や、簡素な英語コメントのみだった箇所を対象に、クラス・メソッド・フィールドの役割と引数・戻り値の意味を日本語で記述した。動作に影響する変更は含まない。直前の PR #825 (
libcobj/uiの Javadoc 更新) と同様の方針で、libcobj以下の Javadoc 整備を進めるものである。変更点
user_util/cobj_apiApiFiles.javajavaCreate/writeController/writeRecord/argPrintの Javadoc を書き直し、生成される<PROGRAM-ID>Controller.javaおよび<PROGRAM-ID>Record.javaの役割と、入力となる JSON ファイル(cobj -info-json-dirの出力)の関係を明記した。argPrintについてはisType/isRecordの組み合わせによる出力形式の違いを箇条書きで説明した。programIdの@paramを削除し、実際のシグネチャに合わせて記述を修正した。ApiFilesOptions.javafilePathフィールドに Javadoc を追加した。user_util/indexed_fileIndexedFileUtilMain.javamain/printHelpMessage/parseKeyOptions/processInfoCommand/processLoadCommand/processUnloadCommand/createCobolFileの Javadoc を整理し、サブコマンド (info/create/load/unload/migrate/unlock) との対応関係や戻り値の意味を明記した。parseKeyOptionsでは-kオプションの書式(offset,sizeのコロン区切り、先頭dで重複キー)と具体例を追記した。migrateIndexedFile/unlockIndexedFileに Javadoc を追加した。createCobolFileの@returnについて、戻り値の型がOptional<CobolFile>であることと、実装上は常に値を含むOptionalを返すことを明記した。CobolFileKeyInfo.java— クラス・フィールド・コンストラクタに Javadoc を追加した。ErrorLib.java— 各エラー出力メソッドの Javadoc を日本語化し、引数と戻り値(終了コード1)の意味を明記した。RecordReader.java/RecordWriter.java— インタフェースと各メソッドの Javadoc を追加し、cobj-idx load/unloadとの対応を記述した。RecordReader.getInstanceの実装選択ロジックについては、filePathの実在チェックではなくOptionalの presence を見ているという実装に合わせ「指定されている / 指定されていない」という表現で記述した。FileSeqRecordReader.java/FileLineSeqRecordReader.java— 対応する入力データ形式 (SEQUENTIAL / LINE SEQUENTIAL) と、コンストラクタ時点ではファイルを開かずopen()で開く挙動を明記した。StdinRecordReader.java— 基底クラスと内部クラス (StdinLineSeqReader/StdinSeqReader) の関係、StdinSeqReaderで入力長がrecordSizeの倍数でない場合の戻り値を追記した。StdinSeqReaderについては、実装がScanner#next()で空白区切りトークンをStringとして取得する形になっていることを踏まえ、バイナリストリームではなくトークンベースの読み込みである旨を明記した。その他
StdinRecordReaderの基底クラスでreadがnullを返している件(Copilot から指摘あり)については、RecordReaderの契約との不整合があり NPE の原因になり得るが、本 PR のスコープ(Javadoc 整備のみ)を外れるため別 PR で対応する。本 PR では現状の挙動をそのまま Javadoc に記すにとどめる。