[
https://issues.apache.org/jira/browse/CAMEL-24971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen resolved CAMEL-24971.
---------------------------------
Resolution: Fixed
Fixed by https://github.com/apache/camel/pull/26806 (merged as cbe03f3fee0d).
_Claude Code on behalf of davsclaus_
> simple - internal tidy-ups (dead code, duplication, per-exchange work)
> ----------------------------------------------------------------------
>
> Key: CAMEL-24971
> URL: https://issues.apache.org/jira/browse/CAMEL-24971
> Project: Camel
> Issue Type: Sub-task
> Components: camel-core
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Major
> Fix For: 4.23.0
>
>
> Non-functional clean up found during the review.
> Dead code:
> * static SimpleLanguage.SIMPLE is only written, never read (left from
> CAMEL-15606)
> * SimpleFunctionExpression strict flag is always true (non-strict branches
> dead)
> * SimpleTokenizer.hasEscapeToken, OtherOperatorType.CHAIN/CHAIN_NULL_SAFE,
> SimpleInitBlockTokenizer.setAcceptInitTokens/hasNewLine, deprecated
> SimpleInitBlockParser.prepareInitBlocks and
> SimpleFunctionExpression.ifStartsWithReturnRemainder
> * dead checks in CustomFunctionFactory / MiscFunctionFactory (hash);
> unreachable null-token branches in accept()/expect()
> Latent bug: SimplePredicateParser ~721 sets nullSupported where
> numericSupported is meant.
> Duplication:
> * header / variable / exchangeProperty key parsing copied three times
> (extract one helper)
> * ~12 identical single-argument function blocks; ~15 "resolve simple, init,
> fall back to body" adapters in String/Math builders; sum/max/min/average
> bodies
> * quoted-literal/function/unary/other grammar methods copied between the
> expression and predicate parsers
> * ternary Expression construction duplicated in SimpleFunctionStart; quote
> stripping copy-pasted 4 times in AST nodes
> * kindOfType in both MiscExpressionBuilder and StringExpressionBuilder
> Per-exchange work that could be done once at init: PredicateBuilder.and/or in
> LogicalExpression, Pattern/range/class/list in BinaryExpression
> is/regex/in/range, substring allocating ExpressionBuilder.substring,
> fileOnlyNameExpression, collate group iterator, setHeader/setVariable type
> class, new Random per call (use ThreadLocalRandom). The composite path
> re-parses the predicate on every exchange.
> Other: unused org.apache.camel.util.ObjectHelper imports and FQCN
> org.apache.camel.support.ObjectHelper in Math/Collection builders; orphaned
> Javadoc above escapeExpression; concatExpression parameter names swapped;
> toString of pad/concat/chain wrong; init() not forwarded to children in
> several AST nodes; AST nodes mutated inside createExpression; resource:
> expressions never hit the cache (lookup key vs store key differ);
> FileExpressionBuilder uses string literals instead of Exchange.FILE_*
> constants; NUMBER_OF_TOKENS kept in sync by hand.
> _Claude Code on behalf of davsclaus (found by an AI review of the simple
> language source; each item marked (verified) was reproduced on main at
> c3ef718de2e8)_
--
This message was sent by Atlassian Jira
(v8.20.10#820010)