-
Notifications
You must be signed in to change notification settings - Fork 6
Update javadoc for network module. #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a6c99ea
b3bfa5e
c8a2613
4576520
f0cf829
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| # Skill: Generate Javadoc | ||
|
|
||
| ## Purpose | ||
| Generate comprehensive Javadocs for public API interfaces and classes in a specified module, following consistent documentation standards. | ||
|
|
||
| ## Trigger | ||
| When the user asks to: | ||
| - Generate javadocs for a module | ||
| - Add documentation to public APIs | ||
| - Document interfaces/classes with `@since` tags | ||
|
|
||
| ## Requirements | ||
|
|
||
| ### What to Document | ||
| 1. **Public API interfaces and classes only** - files in main source packages | ||
| 2. **Skip implementation classes** - files in `impl/` packages are NOT documented | ||
| 3. **Skip test classes** - files in `src/test/` are NOT documented | ||
|
|
||
| ### Javadoc Standards | ||
| Each documented element must include: | ||
|
|
||
| 1. **Class/Interface level:** | ||
| - Short description of purpose | ||
| - `@param` for type parameters (if generic) | ||
| - `@author JavaSaBr` | ||
| - `@since 10.0.0` | ||
|
|
||
| 2. **Method level:** | ||
| - Short description for ALL methods | ||
| - `@param` and `@return` only for **non-trivial** methods | ||
| - `@since 10.0.0` | ||
| - `@throws` only when explicitly thrown | ||
|
|
||
| 3. **Constants/Fields:** | ||
| - Short description | ||
| - `@since 10.0.0` | ||
|
|
||
| ### Example Format | ||
|
|
||
| ```java | ||
| /** | ||
| * An immutable array interface that provides type-safe, indexed access to elements. | ||
| * | ||
| * @param <E> the type of elements in this array | ||
| * @author JavaSaBr | ||
| * @since 10.0.0 | ||
| */ | ||
| public interface Array<E> extends Iterable<E> { | ||
|
|
||
| /** | ||
| * Creates an empty immutable array of the specified type. | ||
| * | ||
| * @param <E> the type of elements | ||
| * @param type the component type of the array | ||
| * @return an empty immutable array | ||
| * @since 10.0.0 | ||
| */ | ||
| static <E> Array<E> empty(Class<? super E> type) { | ||
| // ... | ||
| } | ||
|
|
||
| /** | ||
| * Returns the number of elements in this array. | ||
| * | ||
| * @return the number of elements | ||
| * @since 10.0.0 | ||
| */ | ||
| int size(); | ||
|
|
||
| /** | ||
| * Returns the element at the specified index. | ||
| * | ||
| * @param index the index of the element to return | ||
| * @return the element at the specified index | ||
| * @throws IndexOutOfBoundsException if the index is out of range | ||
| * @since 10.0.0 | ||
| */ | ||
| E get(int index); | ||
| } | ||
| ``` | ||
|
|
||
| ## Execution Steps | ||
|
|
||
| 1. **Analyze module structure:** | ||
| ```bash | ||
| ls -la <module>/src/main/java/<package-path>/ | ||
| ``` | ||
|
|
||
| 2. **Identify public API files:** | ||
| - List all `.java` files in main packages | ||
| - Exclude `impl/` subdirectories | ||
| - Exclude `package-info.java` (optional to document) | ||
|
|
||
| 3. **Read each file** to understand existing documentation state | ||
|
|
||
| 4. **Add Javadocs** using `replace_string_in_file` tool: | ||
| - Add class-level Javadoc with description, `@author`, `@since` | ||
| - Add method-level Javadocs with description and `@since` | ||
| - Add `@param`/`@return` only for non-trivial methods | ||
|
|
||
| 5. **Validate changes:** | ||
| ```bash | ||
| ./gradlew :<module>:compileJava | ||
| ``` | ||
|
|
||
| 6. **Run full build:** | ||
| ```bash | ||
| ./gradlew :<module>:build | ||
| ``` | ||
|
|
||
| 7. **Update summary file** at `./summary.md` with documented files | ||
|
|
||
| ## Output | ||
| - All public API files documented with proper Javadocs | ||
| - Build passes successfully | ||
| - Summary file updated with documentation status | ||
|
|
||
| ## Notes | ||
| - Use existing code style from the project | ||
| - Preserve existing Javadocs that are already complete (just add `@since` if missing) | ||
| - Group related edits to minimize tool calls | ||
| - Check for errors after editing each file |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -33,7 +33,7 @@ public interface UnsafeMutableLongArray extends UnsafeLongArray, MutableLongArra | |||||||||||||||||||||
| * @return the removed value | ||||||||||||||||||||||
| * @since 10.0.0 | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
| long unsafeRemoveByInex(int index); | ||||||||||||||||||||||
| long unsafeRemoveByIndex(int index); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
|
||||||||||||||||||||||
| /** | |
| /** | |
| * @deprecated use {@link #unsafeRemoveByIndex(int)} instead. | |
| */ | |
| @Deprecated | |
| default long unsafeRemoveByInex(int index) { | |
| return unsafeRemoveByIndex(index); | |
| } | |
| /** |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,7 +61,7 @@ public boolean contains(int value) { | |
| @Override | ||
| public boolean containsAll(IntArray array) { | ||
| if (array.isEmpty()) { | ||
| return false; | ||
| return true; | ||
| } | ||
|
Comment on lines
62
to
65
|
||
|
|
||
| int[] wrapped = array.asUnsafe().wrapped(); | ||
|
|
@@ -77,7 +77,7 @@ public boolean containsAll(IntArray array) { | |
| @Override | ||
| public boolean containsAll(int[] array) { | ||
| if (array.length < 1) { | ||
| return false; | ||
| return true; | ||
| } | ||
| for (int value : array) { | ||
| if (!contains(value)) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,7 +61,7 @@ public boolean contains(long value) { | |
| @Override | ||
| public boolean containsAll(LongArray array) { | ||
| if (array.isEmpty()) { | ||
| return false; | ||
| return true; | ||
| } | ||
|
Comment on lines
62
to
65
|
||
| long[] wrapped = array.asUnsafe().wrapped(); | ||
| for (int i = 0, length = array.size(); i < length; i++) { | ||
|
|
@@ -75,7 +75,7 @@ public boolean containsAll(LongArray array) { | |
| @Override | ||
| public boolean containsAll(long[] array) { | ||
| if (array.length < 1) { | ||
| return false; | ||
| return true; | ||
| } | ||
| for (long value : array) { | ||
| if (!contains(value)) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -33,7 +33,7 @@ public static <E> Deque<E> linkedListBased() { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @return a new array based deque | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @since 10.0.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public static <E> Deque<E> arrayBasedBased(Class<? super E> type) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public static <E> Deque<E> arrayBased(Class<? super E> type) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return new DefaultArrayBasedDeque<>(type); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -46,7 +46,7 @@ public static <E> Deque<E> arrayBasedBased(Class<? super E> type) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @return a new array based deque | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @since 10.0.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public static <E> Deque<E> arrayBasedBased(Class<? super E> type, int capacity) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public static <E> Deque<E> arrayBased(Class<? super E> type, int capacity) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return new DefaultArrayBasedDeque<>(type, capacity); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
33
to
50
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |
| } | |
| /** | |
| * Creates a new deque backed by an array. | |
| * <p> | |
| * @deprecated Use {@link #arrayBased(Class)} instead. | |
| * | |
| * @param <E> the type of elements | |
| * @param type the component type of the array | |
| * @return a new array based deque | |
| */ | |
| @Deprecated | |
| public static <E> Deque<E> arrayBasedBased(Class<? super E> type) { | |
| return arrayBased(type); | |
| } | |
| /** | |
| * Creates a new deque backed by an array with initial capacity. | |
| * <p> | |
| * @deprecated Use {@link #arrayBased(Class, int)} instead. | |
| * | |
| * @param <E> the type of elements | |
| * @param type the component type of the array | |
| * @param capacity the initial capacity | |
| * @return a new array based deque | |
| */ | |
| @Deprecated | |
| public static <E> Deque<E> arrayBasedBased(Class<? super E> type, int capacity) { | |
| return arrayBased(type, capacity); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unsafeRemoveByInexwas renamed tounsafeRemoveByIndex, which is a breaking API change for downstream code calling the old method name. Consider keeping a@Deprecateddefault method namedunsafeRemoveByInex(int)that delegates tounsafeRemoveByIndex(int)to preserve source compatibility.