Enforcing Component Constraints
Cantor, Scott
cantor.2 at osu.edu
Sun Jan 29 12:57:43 EST 2017
On 1/28/17, 9:57 AM, "dev on behalf of Rod Widdowson" <dev-bounces at shibboleth.net on behalf of rdw at steadingsoftware.com> wrote:
> Nonetheless for me there is an important case for testing as well as annotating, an example is the case of a @Notnull
> parameter for a method which will mostly work when it is null. Such code could escape gentle testing and might even
> escape full testing, but it would sure as hell bite the end user.
Which I guess is an argument for automated constraints.
> I'm sure that you can infer that event without a constraints check, a caller will find out real quick if 2nd or3rd parameter is
> not null. But "log"? Well I'm only using that when I hit a misconfiguration. So if a null parameterization hit that then
> there is a chance that we'd not notice until the first user misconfigured, and we've replaced a warning with a crash.
As you pointed out, if the tools actually worked, they could be enabled to detect this case (and some of the simpler cases like that one they probably would catch) but I know when I tried Eclipse's feature out it just doesn't have the ability to deal with code of any complexity and starts flagging everything as a potential null.
> Is annotation API ? I just don't know.
We have been treating it as API. I have converted nonnull to null but not the opposite.
Anyway, I think I'm pretty comfortable with the idea of automating the check, but I guess it's a Java 8 thing.
-- Scott
More information about the dev
mailing list