[ 
https://issues.apache.org/activemq/browse/CAMEL-2927?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=60530#action_60530
 ] 

Claus Ibsen commented on CAMEL-2927:
------------------------------------

If you supply the expression as a parameter then you wont confuse the JDK 
compiler.

{code}
aggregate().constant(true).completionSize(2)
{code}

Should be
{code}
aggregate(constant(true)).completionSize(2)
{code}

Java Generics is really stretched to a max in terms of creating a DSL. And you 
can hit some odd combos with expressions and EIP patterns with sub routes (such 
as splitter, aggregator, choice etc.). The rule of thumb is to provide the 
expression as a parameter instead of the fluent builder.

> Compilation error when using .to, .log, .wireTap, etc. before calling 
> .aggregate() in the Java DSL
> --------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-2927
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2927
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.3.0
>         Environment: java version "1.6.0_17"
> Java(TM) SE Runtime Environment (build 1.6.0_17-b04-248-10M3025)
> Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01-101, mixed mode)
> Darwin richard-burtons-macbook-pro.local 10.2.0 Darwin Kernel Version 10.2.0: 
> Tue Nov  3 10:37:10 PST 2009; root:xnu-1486.2.11~1/RELEASE_I386 i386
>            Reporter: Richard L. Burton III
>
> The following code generates a compile time exception:
> from("direct:example")
>     .log("This will break during compile time.")
>     .aggregate().constant(true).completionSize(2)
>     .completionTimeout(500L)
>     .to("mock:result")
>     ;
> Compile time exception:
> symbol  : method completionSize(int)
> location: class java.lang.Object
> When removing .log("This will break during compile time."), the project 
> compiles successfully. I verified this holds true for .to and .wireTap as 
> well.
> Taking the example from 
> https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateGroupedExchangeBatchSizeTest.java
>  and placing a .log or .to after the .from(..) reproduces the problem as well.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to