Checkstyle AvoidNestedBlocksCheck

Doug Simon doug.simon at oracle.com
Thu Dec 8 15:49:22 UTC 2016


> On 8 Dec 2016, at 16:43, Andrew Haley <aph at redhat.com> wrote:
> 
> On 08/12/16 15:40, Stefan Marr wrote:
>> Can you give a name to the block?
>> 
>> If so, it might improve readability to break out such blocks into methods consistently.
> 
> This is hand-written assembly code.  It's just a loop.  All I'm doing
> is looping over two strings, comparing them.  

Sounds like it could be refactored into an emitCompareStrings() method.

> If I make the label
> global and remove the braces Checkstyle stops complaining, which is
> what I've done.  The code is now compliant and worse: it's much like
> the equivalent x86 code.

If you prefer the nested block, you can bracket it with:

// Checkstyle: stop
...
// Checkstyle: resume

I’ve mostly found nested blocks useful in C++ in use with destructors.

-Doug


More information about the graal-dev mailing list