Skip to content

Commit

Permalink
Module configuration editor does not open
Browse files Browse the repository at this point in the history
This partially reverts 3e27bdc. Boolean
expressions with side effects MUST NOT be modified in such a way that
short circuit evaluation will remove the side effect. That's a ground
rule for all kinds of code optimizations and transformations.
  • Loading branch information
Bananeweizen authored and Calixte committed Sep 11, 2023
1 parent 1f02f11 commit da3ae9c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion config/checkstyle_sevntu_checks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,13 @@
### InnerInterface(.*)
### InnerClass(.*)"/>
</module>
<module name="LogicConditionNeedOptimizationCheck"/>
<module name="LogicConditionNeedOptimizationCheck">
<!-- This rule is wrong. You cannot optimize "return executeEmergencyBrake() && someCondition"
to "return someCondition && executeEmergencyBrake()". The short circuit evaluation of boolean
expressions will lead to the method not being called, even if it has a wanted side effect
(something that changes global state). -->
<property name="severity" value="ignore"/>
</module>
<module name="AvoidConditionInversionCheck"/>
<module name="SingleBreakOrContinueCheck"/>
<module name="NumericLiteralNeedsUnderscoreCheck"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public class CheckConfigurationConfigureDialog extends TitleAreaDialog {
/** Button to remove a module. */
private Button mRemoveButton;

/** Button to remove a module. */
/** Button to edit a module. */
private Button mEditButton;

/** Group containing the table viewer. */
Expand Down Expand Up @@ -663,7 +663,7 @@ private void openModule(ISelection selection) {
RuleConfigurationEditDialog dialog = new RuleConfigurationEditDialog(getShell(),
workingCopy, !mConfigurable,
Messages.CheckConfigurationConfigureDialog_titleModuleConfigEditor);
if (mConfigurable && Window.OK == dialog.open()) {
if (Window.OK == dialog.open() && mConfigurable) {
mModules.set(mModules.indexOf(module), workingCopy);
mIsDirty = true;
mTableViewer.refresh(true);
Expand Down

0 comments on commit da3ae9c

Please sign in to comment.