davsclaus opened a new pull request, #27147: URL: https://github.com/apache/camel/pull/27147
_Claude Code on behalf of davsclaus_ [CAMEL-25199](https://issues.apache.org/jira/browse/CAMEL-25199) camel-jbang had two regex readers of Java routes left: - The project overview fell back to one when the Java DSL parser (CAMEL-25148) found no routes. - The consumer check of `camel validate` (which `direct:`/`seda:` endpoints the Java routes of an application consume) used one only. ### Is the parser enough? The two were compared on every Java source with a `from(`: | Corpus | Sources | Only the regex finds routes | Parser finds fewer | |---|---|---|---| | camel-examples, camel-spring-boot-examples, camel-quarkus-examples | 232 | 1 → **0** after the fix below | 0 | | components and camel-core tests | 7332 | 5 | 4 | - The parser finds routes in 25 of the example sources, and 840 of the test sources, where the regex finds none. - The one example source was an anonymous `RouteBuilder` passed to `camel.configure().addRoutesBuilder(...)`: the parser took the call `configure()` for the declaration of `configure()`. Fixed here. - The remaining test sources: - A chain assigned to a local variable and continued later (`RouteDefinition route = from(...)`, 3 tests). The regex only saw the `from`, so its route was partial anyway. - A `from` in a loop with a runtime URI, where the regex gave half a URI (`netty-http:http://localhost:`). - Routes whose inputs are only known at runtime. ### Changes - `JavaChainParser` tells a call of `configure()` from its declaration: a declaration is followed by `{` or `throws`. - The project overview reads Java with the parser only. The regex reader and its helpers are removed (about 200 lines). - `EndpointConsumerChecks` reads what Java routes consume with the parser, using the catalog for the endpoint DSL. Constants, `fromF`/`String.format` and `from(direct("x"))` are resolved, so the check now reports a missing consumer it used to stay quiet about. A route template, an input known only at runtime, or a `from(` the parser could not read still keeps it quiet. - `design/java-dsl-parser.adoc` lists where camel-jbang uses the parser. ### Tests - `LwJavaParserTest.anAnonymousRouteBuilderPassedToACall` - `SourceValidatorEndpointConsumersTest`: constants, a format and the endpoint DSL are resolved; a runtime-only input keeps the check quiet. - camel-java-io: 170 tests; camel-jbang-core AI tests: 326 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
