[
https://issues.apache.org/jira/browse/CAMEL-10584?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Luca Burgazzoli resolved CAMEL-10584.
-------------------------------------
Resolution: Fixed
> 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)