[MDSAL-294] Add @CheckReturnValue on YANG RPC generated interfaces extending RpcService Created: 03/Nov/17 Updated: 28/Jun/18 Resolved: 28/Jun/18 |
|
| Status: | Verified |
| Project: | mdsal |
| Component/s: | Binding codegen, Binding V2 codegen |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Medium |
| Reporter: | Jie Han | Assignee: | Jie Han |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
Having a @CheckReturnValue annotation always generated would make perfect sense IMHO, because we could then use that in static code analysis to ensure that all users of the RPC do check the Future RpcResult for errors - even if there is no Output. The "@CheckReturnValue on YANG RPC generated interfaces extending RpcService" thread on https://lists.opendaylight.org/pipermail/mdsal-dev/2017-November/thread.html has the full background. |
| Comments |
| Comment by Michael Vorburger [ 03/Nov/17 ] |
|
This would be great! |
| Comment by Jie Han [ 04/Nov/17 ] |
|
Hi M. , |
| Comment by Robert Varga [ 04/Nov/17 ] |
|
javax.annotation classes are not available in karaf's production environment. |
| Comment by Jie Han [ 06/Nov/17 ] |
|
Should we split the generator implementaion from runtime correlative in mdsal-binding-generator-impl, |
| Comment by Robert Varga [ 06/Nov/17 ] |
|
This change should be part of the generated template, which is already split out. |
| Comment by Jie Han [ 06/Nov/17 ] |
|
I see, I'll try to add it in template tomorrow. Thanks Robert. |
| Comment by Robert Varga [ 06/Nov/17 ] |
|
Well, actually the problem is that you are referring to the annotation class itself – were you to encode the string literals directly, your patch would work just fine |
| Comment by Jie Han [ 06/Nov/17 ] |
|
Yes, I have thought about the way using the string directly, but I feel that's not enough strict |
| Comment by Michael Vorburger [ 09/Nov/17 ] |
|
This is, naturally, good, impacting projects who have already enforced FindBugs non-violation and who do have code that ignores RPC returns. https://git.opendaylight.org/gerrit/#/c/65379/ has related fix in genius. I'm about to add a small new util in infrautils to make it easier. |