[ 
https://issues.apache.org/jira/browse/CAMEL-25814?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-25814.
---------------------------------
    Resolution: Fixed

> camel-jbang - the AI validator compiles a Java file alone, so a class that 
> uses another class of the project is refused
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-25814
>                 URL: https://issues.apache.org/jira/browse/CAMEL-25814
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jbang
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 4.24.0
>
>
> The AI validator of camel-jbang ({{JavaChecks.validateJava}}, which 
> {{camel_write_file}} and {{camel validate}} use for a Java file) compiles the 
> file on its own, against the classpath of the CLI. So a class that uses 
> another class of the project is refused with "cannot find symbol", although 
> {{camel run}} compiles the Java files of the project together and runs it 
> fine.
> In a benchmark of Oct 18-19 2026 (a local model building a code-first REST 
> example), the model wrote {{src/main/java/camel/example/Order.java}}:
> {code:java}
> package camel.example;
> import java.util.List;
> public record Order(String orderId, String customer, String country, String 
> status, List<OrderLine> lines) {
> }
> {code}
> and {{OrderLine.java}} next to it, in the same package. {{camel_write_file}} 
> refused Order.java seven times:
> {noformat}
> Line 5: cannot find symbol   symbol:   class OrderLine   location: class 
> camel.example.Order (the class is compiled when camel run starts against the 
> CLI classpath: Camel and the JDK; another library needs a //DEPS 
> group:artifact:version line at the top of the Java file, or the dependency 
> added to the run)
> {noformat}
> It kept refusing after OrderLine.java was written, and the hint points to a 
> missing library, which is not the case. The step failed.
> {{withSiblingClassHints}} rewrites such a message when the class is a 
> sibling, but it suggests an import, and a class in the same package needs 
> none.
> The fix: compile the file together with the other Java files of the project 
> (its directory and {{src/main/java}}, as the bean check reads them, 
> CAMEL-24698), and report the diagnostics of the file being validated only.
> _Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to