You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Luca Burgazzoli (JIRA)" <ji...@apache.org> on 2016/12/09 17:31:59 UTC

[jira] [Work started] (CAMEL-10584) spring boot auto configuration mojo: use Class.isAssignableFrom instead of instanceof as the later may fail at compile time in case of final classes

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

Work on CAMEL-10584 started by Luca Burgazzoli.
-----------------------------------------------
> spring boot auto configuration mojo: use Class.isAssignableFrom instead of instanceof as the later may fail at compile time in case of final classes
> ----------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-10584
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10584
>             Project: Camel
>          Issue Type: Improvement
>          Components: tooling
>            Reporter: Luca Burgazzoli
>            Assignee: Luca Burgazzoli
>             Fix For: 2.19.0
>
>
> In *AutoConfiguration classes generated by camel-package-plugin, there is a check like 
> {code:java}
> if (myInstance instanceof CamelContextAware) {
>     ((CamelContextAware) dataformat).setCamelContext(camelContext);
> }
> {code}
> This check may fail at compile time if myInstance is final and it is not an instance of CamelContextAware which make not possible to write final classes.
> We should do something like:
> {code:java}
> if (CamelContextAware.class.isAssignableFrom(MyInstanceType.class)) {
>     CamelContextAware context = CamelContextAware.class.cast(myInstance);
>     if (context != null) {
>         context.setCamelContext(camelContext);
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)