"Carl" <> wrote in message
news: oups.com...
> wrote:
>> Hello,
>> How can I implement a rule with checkstyle that would warn when the
>> code would call the method "receive()" on an instance of the class
>> "MessageConsumer" ?
>>
>> I know that checkstyle might not be the appropriate tool for that, but
>> could I chek that the method "receive" is not called with a long
>> parameter superior with 5000 ?
>>
>> thanks
>
> Hello,
>
> I Have no experience with checkstyle, but based on my understanding of
> your question I think that java assertions may fit your requirements.
>
> See
> http://java.sun.com/j2se/1.4.2/docs/...ng/assert.html
> for more details.
>
> Alternatively, you could just have your method throw an
> IllegalArgumentException if the argument was out of range.
Presumably the OP wishes to check for these violations at compile time
(because they've got an ant script to automatically run checkstyle right
after compilation, for example), rather than runtime. I'm not familiar with
checkstyle, so I don't know how to solve this using CheckStyle either, but
it can be solved using AspectJ.
- Oliver