Skip to content

Commit f77d64d

Browse files
committed
update javadoc and instructions
1 parent 95ac4bc commit f77d64d

33 files changed

Lines changed: 114 additions & 55 deletions

.github/copilot-instructions.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,14 @@ Javadoc conventions
7575
- Omit javadoc for simple getters/setters (e.g., `getArch()`, `setArch(String)`); they are self-explanatory.
7676
- Omit obvious field comments that just repeat the field name (e.g., `/** The name. */ private String name;`).
7777
- Omit obvious constant comments (e.g., `/** The constant FOO. */ public static final String FOO = "foo";`).
78-
- Type parameter descriptions should be meaningful (e.g., `@param <T> the element type` not `@param <T> the type parameter`).
78+
- Type parameter descriptions should use consistent format: "the type of..." (e.g., `@param <T> the type of elements` not `@param <T> the element type`).
7979
- Do not generate javadoc for implementation classes (only interfaces and public API classes).
8080
- For `@see` tags, avoid duplicate references (e.g., use `@see Math#sin(double)` not `@see Math#sin(double) Math#sin(double)`).
81+
- For functional interfaces:
82+
- Consumer descriptions must include "and returns no result" (e.g., "Represents an operation that accepts an int and an object argument, and returns no result.").
83+
- Use type-specific @param descriptions (e.g., "the int argument", "the object argument") instead of generic "the first argument".
84+
- Function @return should use "the function result" for consistency.
85+
- Predicate @return should use "true if the arguments match the predicate".
8186

8287
Project layout & where to change things
8388
- Root-level important files:

.github/skills/generate-javadoc.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ When the user asks to:
2929
2. **No trailing periods** - in `@param` and `@return` descriptions (e.g., `@param value the value` not `@param value the value.`)
3030
3. **No duplicate @see references** - use `@see Math#sin(double)` not `@see Math#sin(double) Math#sin(double)`
3131
4. **Lowercase @param/@return descriptions** - start with lowercase (e.g., `@param value the value` not `@param value The value`)
32+
5. **Consistent type parameter format** - use "the type of..." pattern (e.g., `@param <T> the type of elements` not `@param <T> the element type`)
33+
6. **Descriptive @param names** - for functional interfaces, use type-specific descriptions (e.g., "the int argument", "the object argument") instead of generic "the first argument"
34+
35+
### Functional Interface Conventions
36+
1. **Consumer descriptions** - always include "and returns no result" (e.g., "Represents an operation that accepts an int and an object argument, and returns no result.")
37+
2. **Function @return** - use "the function result" for consistency
38+
3. **Predicate @return** - use "true if the arguments match the predicate" or "true if the arguments match the predicate, false otherwise"
39+
4. **Supplier @return** - describe what is supplied (e.g., "the char value" not just "a result")
3240

3341
### Javadoc Standards
3442
Each documented element must include:
@@ -91,6 +99,29 @@ public interface Array<E> extends Iterable<E> {
9199
}
92100
```
93101

102+
### Functional Interface Example
103+
104+
```java
105+
/**
106+
* Represents an operation that accepts an int and an object argument, and returns no result.
107+
*
108+
* @param <B> the type of the object argument
109+
* @since 10.0.0
110+
*/
111+
@FunctionalInterface
112+
public interface IntObjConsumer<B> {
113+
114+
/**
115+
* Performs this operation on the given arguments.
116+
*
117+
* @param arg1 the int argument
118+
* @param arg2 the object argument
119+
* @since 10.0.0
120+
*/
121+
void accept(int arg1, B arg2);
122+
}
123+
```
124+
94125
### Common Fixes When Reviewing Existing Javadocs
95126
- Change "Return the" to "Returns the"
96127
- Change "Compare the" to "Compares the"

rlib-functions/src/main/java/javasabr/rlib/functions/BiObjLongConsumer.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package javasabr.rlib.functions;
22

33
/**
4-
* Represents an operation that accepts two object arguments and a long argument.
4+
* Represents an operation that accepts two object arguments and a long argument, and returns no result.
55
*
6-
* @param <A> the first object argument type
7-
* @param <B> the second object argument type
6+
* @param <A> the type of the first object argument
7+
* @param <B> the type of the second object argument
88
* @since 10.0.0
99
*/
1010
@FunctionalInterface
@@ -13,9 +13,9 @@ public interface BiObjLongConsumer<A, B> {
1313
/**
1414
* Performs this operation on the given arguments.
1515
*
16-
* @param arg1 the first argument
17-
* @param arg2 the second argument
18-
* @param arg3 the third argument
16+
* @param arg1 the first object argument
17+
* @param arg2 the second object argument
18+
* @param arg3 the long argument
1919
* @since 10.0.0
2020
*/
2121
void accept(A arg1, B arg2, long arg3);

rlib-functions/src/main/java/javasabr/rlib/functions/BiObjToBoolFunction.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
/**
44
* Represents a function that accepts two object arguments and produces a boolean result.
55
*
6-
* @param <A> the first argument type
7-
* @param <B> the second argument type
6+
* @param <A> the type of the first argument
7+
* @param <B> the type of the second argument
88
* @since 10.0.0
99
*/
1010
@FunctionalInterface
@@ -15,7 +15,7 @@ public interface BiObjToBoolFunction<A, B> {
1515
*
1616
* @param arg1 the first argument
1717
* @param arg2 the second argument
18-
* @return the function result
18+
* @return true or false based on the evaluation
1919
* @since 10.0.0
2020
*/
2121
boolean apply(A arg1, B arg2);

rlib-functions/src/main/java/javasabr/rlib/functions/ByteFunction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public interface ByteFunction<R> {
1212
/**
1313
* Applies this function to the given argument.
1414
*
15-
* @param value the argument
15+
* @param value the byte value
1616
* @return the function result
1717
* @since 10.0.0
1818
*/
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
package javasabr.rlib.functions;
22

3+
/**
4+
* Represents a supplier of char-valued results.
5+
*
6+
* @since 10.0.0
7+
*/
38
@FunctionalInterface
49
public interface CharSupplier {
510

611
/**
712
* Gets a result.
813
*
9-
* @return a result
14+
* @return the char value
15+
* @since 10.0.0
1016
*/
1117
char getAsChar();
1218
}

rlib-functions/src/main/java/javasabr/rlib/functions/DoubleObjConsumer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public interface DoubleObjConsumer<B> {
1414
*
1515
* @param arg1 the double argument
1616
* @param arg2 the object argument
17+
* @since 10.0.0
1718
*/
1819
void accept(double arg1, B arg2);
1920
}

rlib-functions/src/main/java/javasabr/rlib/functions/FloatBiObjConsumer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public interface FloatBiObjConsumer<B, C> {
1919
* @param arg1 the float argument
2020
* @param arg2 the first object argument
2121
* @param arg3 the second object argument
22+
* @since 10.0.0
2223
*/
2324
void accept(float arg1, B arg2, C arg3);
2425
}

rlib-functions/src/main/java/javasabr/rlib/functions/FloatConsumer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public interface FloatConsumer {
1212
* Performs this operation on the given float value.
1313
*
1414
* @param arg the float value
15+
* @since 10.0.0
1516
*/
1617
void consume(float arg);
1718
}

rlib-functions/src/main/java/javasabr/rlib/functions/FunctionInt.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public interface FunctionInt<A> {
1414
*
1515
* @param arg the function argument
1616
* @return the int result
17+
* @since 10.0.0
1718
*/
1819
int apply(A arg);
1920
}

0 commit comments

Comments
 (0)