Hi All,
If you are usinf findbugs to check code quality,
you may see violations like "No relationship between generic parameter and method argument".
Since Map.get() is not fully generic, we often find cases where a developer passed a different type of object (and hence bugs). Frequency of such cases went up when we started using artifacts/services from other teams. What are the reasons why Map.get(Object key) is not (fully) generic explains why get() is not fully generic.
If you are usinf findbugs to check code quality,
you may see violations like "No relationship between generic parameter and method argument".
Since Map.get() is not fully generic, we often find cases where a developer passed a different type of object (and hence bugs). Frequency of such cases went up when we started using artifacts/services from other teams. What are the reasons why Map.get(Object key) is not (fully) generic explains why get() is not fully generic.
Here's a helper method that provides checked access:
Sample Usage:
|
No comments:
Post a Comment