In trying to implement a very simple camel route in scala and have run into a
dead-end. First consider this java version:

public class CamelJavaTyperTest {

    private DefaultCamelContext camel = new DefaultCamelContext();

    private Processor p1 = new Processor() {
        @Override public void process(Exchange exchange) throws Exception {
}
    };
    private Processor p2 = new Processor() {
        @Override public void process(Exchange exchange) throws Exception {
}
    };

    public void init() throws Exception {
        camel.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("somewhere")
                        .process(p1)
                        .process(p2)
                        .to("nowhere");
            }
        });
    }
}

This compiles fine. Now consider this seemingly identical scala version:

class CamelScalaTyperTest {

  val camel = new DefaultCamelContext

  val p1 = new Processor { def process(exchange: Exchange) = {} }
  val p2 = new Processor { def process(exchange: Exchange) = {} }

  camel addRoutes new RouteBuilder { override def configure() {
    from ("somwhere")
      .process(p1)
      .process(p2)
      .to("nowhere")
  }}
}

The scala version results in this compiler error:

error: something is wrong (wrong class file?): class ProcessorDefinition
with type parameters [Type] gets applied to arguments [], phase = typer
.to ("jms:topic:__placeholder__")

Clearly this is a scala compiler bug (assuming that scala should be able to
handle all forms of java generics). This is similar to the kinds of issues
that I ran into when trying (and ultimately failing) to port the camel-scala
DSL from 2.7 to 2.8. 

Of course I will package this up as a maven project and submit it as scala
bug report. 

-- 
View this message in context: 
http://old.nabble.com/DSL-severly-limited-with-scala-2.8-tp27884520p27884520.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to