Community
Participate
Working Groups
I like your error/warning for requiring comments on empty blocks! In my code, I have many catch blocks commented as follows: } catch (Exception e) { } // Ignore CANCEL_BUTTON Exception which is not correct to satisify this check. I must change the comment to the form: } catch (Exception e) { /* Ignore CANCEL_BUTTON Exception */ } which is uglier and more prone to errors (open comment and a close comment) Please include end-of-line comments on the same line as an empty block endif brace as a valid comment to satisify this error/warning. Both of the following cases should be OK: (1) } catch (Exception e) { } // Ignore CANCEL_BUTTON Exception (2) } catch (Exception e) { } // Ignore CANCEL_BUTTON Exception note: This case currently works: } catch (Exception e) { // Ignore CANCEL_BUTTON Exception }
This was discussed when we added this feature, and the consensus was not to consider trailing line comments to be a valid comment for an empty block. As you noted, you may simply write the empty block on 2 lines.