davsclaus commented on code in PR #24120:
URL: https://github.com/apache/camel/pull/24120#discussion_r3444014853


##########
core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleExpressionParser.java:
##########
@@ -242,8 +241,8 @@ protected void removeIgnorableWhiteSpaceTokens() {
     protected void parseAndCreateAstModel() {
         // we loop the tokens and create a sequence of ast nodes
 
-        // counter to keep track of number of functions in the tokens
-        AtomicInteger functions = new AtomicInteger();
+        // single-element array used as a mutable counter (no concurrency; 
AtomicInteger is not needed here)

Review Comment:
   This comment explains the implementation mechanism (`single-element array`, 
`no concurrency`, `AtomicInteger is not needed`) rather than the domain intent. 
The original comment `// counter to keep track of number of functions in the 
tokens` was more useful — it tells the reader *what* is being tracked, not 
*how* the holder works.
   
   If keeping the `int[]` change, consider restoring the original comment.



##########
core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimplePredicateParser.java:
##########
@@ -334,25 +333,25 @@ private void addImageToken(LiteralNode imageToken) {
      * Creates a node from the given token
      *
      * @param  token         the token
-     * @param  startSingle   state of single quoted blocks
-     * @param  startDouble   state of double quoted blocks
-     * @param  startFunction state of function blocks
+     * @param  startSingle   state of single quoted blocks (single-element 
boolean array used as a mutable holder)
+     * @param  startDouble   state of double quoted blocks (single-element 
boolean array used as a mutable holder)
+     * @param  startFunction state of function blocks (single-element boolean 
array used as a mutable holder)
      * @return               the created node, or <tt>null</tt> to let a 
default node be created instead.

Review Comment:
   The added `(single-element boolean array used as a mutable holder)` in each 
`@param` line duplicates what the type signature `boolean[]` already conveys. 
The original Javadoc (`state of single quoted blocks`) documented the *semantic 
meaning* — what the parameter represents — which is more valuable than 
describing its Java type.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to