You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Baptiste Mathus <bm...@batmat.net> on 2015/02/20 16:41:37 UTC

Adding @Nonnull annotations to EnforcerRule

Hi guys,

Just tried on IRC without much success. Using JSR305 annotations on some
internal enforcer rules, we encounter some issue like for example the
checker thinking the helper reference could be passed null in the execute
method [1].

It would help to declare it like this instead:

void execute(@Nonnull EnforcerRuleHelper helper)



What's your take on this?

I can file a JIRA and attach the associated patch, but I thought I'd dump
the question here first. I know those annotations have started to be using
inside the core, so I suppose that shouldn't be an issue there too?

Is this something you'd be OK to integrate inside the enforcer-api?

Thanks

[1]
https://maven.apache.org/enforcer/enforcer-api/apidocs/org/apache/maven/enforcer/rule/api/EnforcerRule.html#execute(org.apache.maven.enforcer.rule.api.EnforcerRuleHelper)

-- 
Baptiste

Re: Adding @Nonnull annotations to EnforcerRule

Posted by Baptiste Mathus <ml...@batmat.net>.
Hi,

I went ahead and filed https://jira.codehaus.org/browse/MENFORCER-227 and
attached the associated ~5 lines patch.
For reference I used the dependency mentioned by Kristian here
http://mail-archives.apache.org/mod_mbox/maven-dev/201409.mbox/%3CCAJZRQKyicOyE-W57cuUnFnFzvihZyhDqCx0TGpDy-i=oLx2btQ@mail.gmail.com%3E

Thanks for any feedback.

2015-02-20 16:41 GMT+01:00 Baptiste Mathus <bm...@batmat.net>:

> Hi guys,
>
> Just tried on IRC without much success. Using JSR305 annotations on some
> internal enforcer rules, we encounter some issue like for example the
> checker thinking the helper reference could be passed null in the execute
> method [1].
>
> It would help to declare it like this instead:
>
> void execute(@Nonnull EnforcerRuleHelper helper)
>
>
>
> What's your take on this?
>
> I can file a JIRA and attach the associated patch, but I thought I'd dump
> the question here first. I know those annotations have started to be using
> inside the core, so I suppose that shouldn't be an issue there too?
>
> Is this something you'd be OK to integrate inside the enforcer-api?
>
> Thanks
>
> [1]
> https://maven.apache.org/enforcer/enforcer-api/apidocs/org/apache/maven/enforcer/rule/api/EnforcerRule.html#execute(org.apache.maven.enforcer.rule.api.EnforcerRuleHelper)
>
> --
> Baptiste
>
> --
> Baptiste <Batmat> MATHUS - http://batmat.net
> Sauvez un arbre,
> Mangez un castor !
> nbsp;!
>