2017-04-20 13 views
1

以下のユニットテストで問題を再現することができますが、トラッカーでは見つかりませんでした。 エッセンス:インタフェースAはデフォルトメソッドを持ち、インタフェースBはAを拡張し、単純な言語評価ではデフォルトメソッドが見えません。 Camelバージョン2.16.1。何か不足していますか?キャメルシンプルな評価では、デフォルトのメソッドが見えません

import org.apache.camel.CamelContext; 
import org.apache.camel.Exchange; 
import org.apache.camel.builder.RouteBuilder; 
import org.apache.camel.impl.DefaultCamelContext; 
import org.apache.camel.impl.DefaultExchange; 
import org.junit.Assert; 
import org.junit.Test; 

public class DefaultMethodIsInvisibleTest { 
    @Test 
    public void camelSimpleDoesNotSeeDefaultMethod() throws Exception { 
     CamelContext context = new DefaultCamelContext(); 
     context.addRoutes(new RouteBuilder() { 
      public void configure() { 
       from("direct:camelSimpleDoesNotSeeDefaultMethod").log("Result of default method invocation is ${exchangeProperty.myObject.defaultMethod}"); 
      } 
     }); 
     context.start(); 

     Exchange incomingExchange = new DefaultExchange(context); 
     incomingExchange.setProperty("myObject", new B() { 
     }); 

     Exchange result = context.createProducerTemplate().send("direct:camelSimpleDoesNotSeeDefaultMethod", incomingExchange); 

     Assert.assertNull(result.getException()); 
    } 

public static interface A { 
    public default String defaultMethod() { 
     return "default method result"; 
    } 
} 

public static interface B extends A { 
} 
} 

スタックトレース:インターフェイス上

Caused by: org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to invoke method: defaultMethod on null due to: org.apache.camel.component.bean.MethodNotFoundException: Method with name: defaultMethod not found on bean: com.ub[email protected]5dafbe45 of type: com.ubs.wma.gfi.tradersbook.subscriber.DefaultMethodIsInvisibleTest$2. Exchange[][Message: [Body is null]] 
    at org.apache.camel.language.bean.BeanExpression$OgnlInvokeProcessor.process(BeanExpression.java:290) 
    at org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:114) 
    ... 46 common frames omitted 
Caused by: org.apache.camel.component.bean.MethodNotFoundException: Method with name: defaultMethod not found on bean: com.ub[email protected]5dafbe45 of type: com.ubs.wma.gfi.tradersbook.subscriber.DefaultMethodIsInvisibleTest$2. Exchange[][Message: [Body is null]] 
    at org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:269) 
    at org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:183) 
    at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:159) 

答えて

1

デフォルトの方法は、明示的なサポートAFAIRではありません。 JIRAをログに登録してもよろしいですか?

+1

こんにちはクラウスさん、素早く対応してくれてありがとうございます。 CAMEL-11178 – Yamahar1sp

関連する問題