Hi

Currently I work on the next patch for [1] and am stuck in the Scala stuff
because I changed the 2 RoutBuilder onException
signatures from:

    public OnExceptionDefinition onException(Class exception);
    public OnExceptionDefinition onException(Class... exceptions);

to:

    public OnExceptionDefinition onException(Class<? extends Throwable>
exception) {
    public OnExceptionDefinition onException(Class<? extends Throwable>...
exceptions) {

And also in OnExceptionDefinition from:

    public OnExceptionDefinition(List<Class> exceptionClasses);
    public OnExceptionDefinition(Class exceptionType);

to:

    public OnExceptionDefinition(List<Class&lt;? extends Throwable>>
exceptionClasses);
    public OnExceptionDefinition(Class<? extends Throwable> exceptionType);
    
In order to:

- first make the compiler happy with 0 warnings
- second to avoid the case there one could write in his Java DSL:
...onException(Integer.class)... which compiles perfectly with
the existing trunk code but would blow up at runtime! However with the
generic signature in place one could not even compile the
Java DSL above, and that's exactly my intention through the usage of proper
*generics* and avoidance of raw references.

I did also the same for TryDefinition, CatchDefinition as well.

But now as my Scala experience is equal to 'Nil' I'm stuck there as the
Scala compiler is not happy with my changes in Java code.
For example in SAbstractDefinition.scala I've got no idea how to change the
signature of the handle() method, for example changing it
to:

  def handle[T <: Throwable](block: => Unit) =
SOnExceptionDefinition(target.onException(Class[T])).apply(block)

didn't help. I'm already blocked since 3 days on this stuff and would
appreciate any advice from our Scala gurus. Thanks!

BTW, I already contacted Martin Krasser for some help but he proposed me to
ask for help in @dev list.

[1] https://issues.apache.org/jira/browse/CAMEL-4796

Babak

--
View this message in context: 
http://camel.465427.n5.nabble.com/Need-your-help-on-camel-scala-tp5134007p5134007.html
Sent from the Camel Development mailing list archive at Nabble.com.

Reply via email to