diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/DebuggerTreeRenderer.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/DebuggerTreeRenderer.java index ed41619db24b..d39e37e0d342 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/DebuggerTreeRenderer.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/DebuggerTreeRenderer.java @@ -272,14 +272,15 @@ public class DebuggerTreeRenderer extends ColoredTreeCellRenderer { final EvaluateException exception = descriptor.getEvaluateException(); if(exception != null) { final String errorMessage = exception.getMessage(); - if(valueLabel.endsWith(errorMessage)) { - appendValueTextWithEscapesRendering(descriptorText, valueLabel.substring(0, valueLabel.length() - errorMessage.length()), valueLabelAttribs, colorScheme); - descriptorText.append(errorMessage, XDebuggerUIConstants.EXCEPTION_ATTRIBUTES); + final String valueText; + if (valueLabel.endsWith(errorMessage)) { + valueText = valueLabel.substring(0, valueLabel.length() - errorMessage.length()); } else { - appendValueTextWithEscapesRendering(descriptorText, valueLabel, valueLabelAttribs, colorScheme); - descriptorText.append(errorMessage, XDebuggerUIConstants.EXCEPTION_ATTRIBUTES); + valueText = valueLabel; } + appendValueTextWithEscapesRendering(descriptorText, valueText, valueLabelAttribs, colorScheme); + descriptorText.append(errorMessage, XDebuggerUIConstants.EXCEPTION_ATTRIBUTES); } else { if(valueLabel.equals(XDebuggerUIConstants.COLLECTING_DATA_MESSAGE)) { diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/LoopAnalyzer.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/LoopAnalyzer.java index 747396603a47..80d66274254d 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/LoopAnalyzer.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/LoopAnalyzer.java @@ -33,12 +33,11 @@ class LoopAnalyzer { int[] froms = myIns.get(toIndex); if (froms == null) { froms = new int[]{fromIndex}; - myIns.put(toIndex, froms); } else { froms = ArrayUtil.append(froms, fromIndex); - myIns.put(toIndex, froms); } + myIns.put(toIndex, froms); } } } diff --git a/java/java-analysis-impl/src/com/intellij/refactoring/util/duplicates/Match.java b/java/java-analysis-impl/src/com/intellij/refactoring/util/duplicates/Match.java index e23333248221..7c9d09f3a569 100644 --- a/java/java-analysis-impl/src/com/intellij/refactoring/util/duplicates/Match.java +++ b/java/java-analysis-impl/src/com/intellij/refactoring/util/duplicates/Match.java @@ -153,7 +153,6 @@ public final class Match { myParameterValues.put(psiVariable, values); final ArrayList elements = new ArrayList<>(); myParameterOccurrences.put(psiVariable, elements); - return true; } else { for (PsiElement val : currentValue) { @@ -168,8 +167,8 @@ public final class Match { } } myParameterOccurrences.get(psiVariable).add(value); - return true; } + return true; } public ReturnValue getReturnValue() { diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/PsiGenerationInfo.java b/java/java-impl/src/com/intellij/codeInsight/generation/PsiGenerationInfo.java index 97f2e81824fe..c8cecc72fb72 100644 --- a/java/java-impl/src/com/intellij/codeInsight/generation/PsiGenerationInfo.java +++ b/java/java-impl/src/com/intellij/codeInsight/generation/PsiGenerationInfo.java @@ -67,7 +67,6 @@ public class PsiGenerationInfo extends GenerationInfoBase i PsiElement newMember = GenerateMembersUtil.insert(aClass, member, anchor, before); member = (T)JavaCodeStyleManager.getInstance(aClass.getProject()).shortenClassReferences(newMember); LOG.assertTrue(member.isValid(), member); - setMember(member); } else { final PsiModifierList modifierList = member.getModifierList(); @@ -94,7 +93,7 @@ public class PsiGenerationInfo extends GenerationInfoBase i " self modified list: " + modifierList + " existing modified list: " + existingModifierList); } - setMember(member); } + setMember(member); } } diff --git a/java/java-impl/src/com/intellij/refactoring/inheritanceToDelegation/InheritanceToDelegationProcessor.java b/java/java-impl/src/com/intellij/refactoring/inheritanceToDelegation/InheritanceToDelegationProcessor.java index 0fcef2cde64d..2db45266df8f 100644 --- a/java/java-impl/src/com/intellij/refactoring/inheritanceToDelegation/InheritanceToDelegationProcessor.java +++ b/java/java-impl/src/com/intellij/refactoring/inheritanceToDelegation/InheritanceToDelegationProcessor.java @@ -960,24 +960,16 @@ public class InheritanceToDelegationProcessor extends BaseRefactoringProcessor { if (classMember != null && myBaseClassMembers.contains(classMember) && !isDelegated(classMember)) { final FieldAccessibility delegateFieldVisibility = new FieldAccessibility(true, getPsiClass()); final InheritanceToDelegationUsageInfo usageInfo; - if (classMemberReference instanceof PsiReferenceExpression) { - if (((PsiReferenceExpression) classMemberReference).getQualifierExpression() == null) { - usageInfo = new UnqualifiedNonDelegatedMemberUsageInfo(classMemberReference, classMember, - delegateFieldVisibility); - } else { - usageInfo = new NonDelegatedMemberUsageInfo( - ((PsiReferenceExpression) classMemberReference).getQualifierExpression(), - classMember, delegateFieldVisibility - ); - } - myUsageInfoStorage.add(usageInfo); + if (classMemberReference instanceof PsiReferenceExpression && + ((PsiReferenceExpression)classMemberReference).getQualifierExpression() != null) { + usageInfo = new NonDelegatedMemberUsageInfo(((PsiReferenceExpression)classMemberReference).getQualifierExpression(), + classMember, delegateFieldVisibility); } - else /*if (classMemberReference instanceof PsiJavaCodeReferenceElement)*/ { - usageInfo = new UnqualifiedNonDelegatedMemberUsageInfo(classMemberReference, classMember, - delegateFieldVisibility); - myUsageInfoStorage.add(usageInfo); - + else { + usageInfo = new UnqualifiedNonDelegatedMemberUsageInfo(classMemberReference, classMember, + delegateFieldVisibility); } + myUsageInfoStorage.add(usageInfo); } } @@ -1004,7 +996,7 @@ public class InheritanceToDelegationProcessor extends BaseRefactoringProcessor { } /** - * This visitor should be called for overriden methods before they are moved to an inner class + * This visitor should be called for overridden methods before they are moved to an inner class */ private class OverriddenMethodClassMemberReferencesVisitor extends ClassMemberReferencesVisitor { private final ArrayList myPsiActions; diff --git a/java/java-impl/src/com/intellij/usageView/UsageContextDataflowToPanel.java b/java/java-impl/src/com/intellij/usageView/UsageContextDataflowToPanel.java index fbbcf0e32fcd..71022fcad4f1 100644 --- a/java/java-impl/src/com/intellij/usageView/UsageContextDataflowToPanel.java +++ b/java/java-impl/src/com/intellij/usageView/UsageContextDataflowToPanel.java @@ -85,7 +85,6 @@ public class UsageContextDataflowToPanel extends UsageContextPanelBase { removeAll(); JComponent titleComp = new JLabel(UsageViewBundle.message("select.the.usage.to.preview", myPresentation.getUsagesWord()), SwingConstants.CENTER); add(titleComp, BorderLayout.CENTER); - revalidate(); } else { PsiElement element = getElementToSliceOn(infos); @@ -99,8 +98,8 @@ public class UsageContextDataflowToPanel extends UsageContextPanelBase { Disposer.register(this, (Disposable)panel); removeAll(); add(panel, BorderLayout.CENTER); - revalidate(); } + revalidate(); } protected boolean isDataflowToThis() { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/EnterHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/EnterHandler.java index 44111bdec4ad..2ebdf21a3f4b 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/EnterHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/EnterHandler.java @@ -379,13 +379,12 @@ public class EnterHandler extends BaseEnterHandler { if (isCommentComplete(comment, commentContext.commenter, myEditor)) { if (myOffset >= commentEnd) { commentContext.docAsterisk = false; - commentContext.docStart = false; } else { commentContext.docAsterisk = CodeStyleManager.getInstance(getProject()).getDocCommentSettings(myFile).isLeadingAsteriskEnabled(); - commentContext.docStart = false; } + commentContext.docStart = false; } else { generateJavadoc(commentContext.commenter); diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/suppress/SuppressActionWrapper.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/suppress/SuppressActionWrapper.java index 465e447f0c68..664a25cfdd64 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/suppress/SuppressActionWrapper.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/suppress/SuppressActionWrapper.java @@ -113,11 +113,10 @@ public class SuppressActionWrapper extends ActionGroup implements CompactActionG text = mySuppressAction.getText(); } e.getPresentation().setText(text); - return true; } else { e.getPresentation().setText(mySuppressAction.getFamilyName()); - return true; } + return true; } public boolean isSuppressAll() { diff --git a/platform/lang-impl/src/com/intellij/largeFilesEditor/search/searchTask/CloseSearchTask.java b/platform/lang-impl/src/com/intellij/largeFilesEditor/search/searchTask/CloseSearchTask.java index 32ea7e70a1f2..df6104d9c47c 100644 --- a/platform/lang-impl/src/com/intellij/largeFilesEditor/search/searchTask/CloseSearchTask.java +++ b/platform/lang-impl/src/com/intellij/largeFilesEditor/search/searchTask/CloseSearchTask.java @@ -132,10 +132,7 @@ public class CloseSearchTask extends SearchTaskBase { * if such result exists; '-1' if doesn't. */ private static int tryGetClosestResult(ArrayList allMatchesAtFrame, SearchTaskOptions options) { - if (allMatchesAtFrame.isEmpty()) { - return -1; - } - else { + if (!allMatchesAtFrame.isEmpty()) { SearchResult searchResult; if (options.searchForwardDirection) { @@ -169,7 +166,7 @@ public class CloseSearchTask extends SearchTaskBase { } } } - return -1; } + return -1; } } diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/impl/DetectedRootsChooserDialog.java b/platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/impl/DetectedRootsChooserDialog.java index 6ba910128bfb..9647fac7804a 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/impl/DetectedRootsChooserDialog.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/impl/DetectedRootsChooserDialog.java @@ -128,7 +128,6 @@ public class DetectedRootsChooserDialog extends DialogWrapper { VirtualFile file = node.getFile(); String text; SimpleTextAttributes attributes; - Icon icon; boolean isValid = true; if (leaf) { VirtualFile ancestor = ((VirtualFileCheckedTreeNode)node.getParent()).getFile(); @@ -146,15 +145,13 @@ public class DetectedRootsChooserDialog extends DialogWrapper { text = file.getPresentableUrl(); } attributes = SimpleTextAttributes.REGULAR_ATTRIBUTES; - icon = PlatformIcons.FOLDER_ICON; } else { text = file.getPresentableUrl(); attributes = SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES; - icon = PlatformIcons.FOLDER_ICON; } final ColoredTreeCellRenderer textRenderer = getTextRenderer(); - textRenderer.setIcon(icon); + textRenderer.setIcon(PlatformIcons.FOLDER_ICON); if (!isValid) { textRenderer.append("[INVALID] ", SimpleTextAttributes.ERROR_ATTRIBUTES); } diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/naming/NameSuggester.java b/platform/lang-impl/src/com/intellij/refactoring/rename/naming/NameSuggester.java index 0d881070c3f6..47c8f5afe060 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/rename/naming/NameSuggester.java +++ b/platform/lang-impl/src/com/intellij/refactoring/rename/naming/NameSuggester.java @@ -31,17 +31,13 @@ public class NameSuggester { myNewClassName = NameUtilCore.splitNameIntoWords(newClassName); myChanges = new ArrayList<>(); - int oldIndex = myOldClassName.length - 1; int oldLastMatch = myOldClassName.length; int newLastMatch = myNewClassName.length; - while(oldIndex >= 0) { + for (int oldIndex = myOldClassName.length - 1; oldIndex >= 0; oldIndex--) { final String patternWord = myOldClassName[oldIndex]; final int matchingWordIndex = findInNewBackwardsFromIndex(patternWord, newLastMatch - 1); - if (matchingWordIndex < 0) { // no matching word - oldIndex--; - } - else { // matching word found + if (matchingWordIndex >= 0) { // matching word found if (oldIndex + 1 <= oldLastMatch - 1 || matchingWordIndex + 1 <= newLastMatch - 1) { final OriginalToNewChange change = new OriginalToNewChange( oldIndex + 1, oldLastMatch - 1, matchingWordIndex + 1, newLastMatch - 1); @@ -49,7 +45,6 @@ public class NameSuggester { } oldLastMatch = oldIndex; newLastMatch = matchingWordIndex; - oldIndex--; } } if (0 <= oldLastMatch - 1 || 0 <= newLastMatch - 1) { diff --git a/platform/lang-impl/src/com/intellij/usageView/impl/UsageContextCallHierarchyPanel.java b/platform/lang-impl/src/com/intellij/usageView/impl/UsageContextCallHierarchyPanel.java index d176a650d971..2a72713b8c80 100644 --- a/platform/lang-impl/src/com/intellij/usageView/impl/UsageContextCallHierarchyPanel.java +++ b/platform/lang-impl/src/com/intellij/usageView/impl/UsageContextCallHierarchyPanel.java @@ -99,7 +99,6 @@ public class UsageContextCallHierarchyPanel extends UsageContextPanelBase { if (element == null) { JComponent titleComp = new JLabel(UsageViewBundle.message("select.the.usage.to.preview", myPresentation.getUsagesWord()), SwingConstants.CENTER); add(titleComp, BorderLayout.CENTER); - revalidate(); } else { if (myBrowser instanceof Disposable) { @@ -107,8 +106,8 @@ public class UsageContextCallHierarchyPanel extends UsageContextPanelBase { } JComponent panel = myBrowser.getComponent(); add(panel, BorderLayout.CENTER); - revalidate(); } + revalidate(); } @Nullable diff --git a/platform/platform-api/src/com/intellij/ide/wizard/AbstractWizard.java b/platform/platform-api/src/com/intellij/ide/wizard/AbstractWizard.java index b1671353a1a3..9f932a4f4737 100644 --- a/platform/platform-api/src/com/intellij/ide/wizard/AbstractWizard.java +++ b/platform/platform-api/src/com/intellij/ide/wizard/AbstractWizard.java @@ -496,13 +496,12 @@ public abstract class AbstractWizard extends DialogWrapper { else { myNextButton.setText(IdeBundle.message("button.ok")); } - myNextButton.setEnabled(canGoNext); } else { myNextButton.setText(UIUtil.removeMnemonic(IdeBundle.message("button.wizard.next"))); myNextButton.setMnemonic('N'); - myNextButton.setEnabled(canGoNext); } + myNextButton.setEnabled(canGoNext); if (myNextButton.isEnabled() && !ApplicationManager.getApplication().isUnitTestMode() && getRootPane() != null) { getRootPane().setDefaultButton(myNextButton); diff --git a/platform/platform-api/src/com/intellij/openapi/ui/popup/util/PopupUtil.java b/platform/platform-api/src/com/intellij/openapi/ui/popup/util/PopupUtil.java index 17d8e04ac3f3..578be1d2b9f0 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/popup/util/PopupUtil.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/popup/util/PopupUtil.java @@ -204,7 +204,6 @@ public class PopupUtil { MenuElement[] selectedPath = menuSelectionManager.getSelectedPath(); if (selectedPath.length > 0) { // hide popup menu if any menuSelectionManager.clearSelectedPath(); - return true; } else { if (ApplicationManager.getApplication() == null) { @@ -214,7 +213,7 @@ public class PopupUtil { if (popupDispatcher != null && !popupDispatcher.isPopupFocused()) { return false; } - return true; } + return true; } } \ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/ui/RowsDnDSupport.java b/platform/platform-api/src/com/intellij/ui/RowsDnDSupport.java index c84a6cb3f95b..af4228b1b1dd 100644 --- a/platform/platform-api/src/com/intellij/ui/RowsDnDSupport.java +++ b/platform/platform-api/src/com/intellij/ui/RowsDnDSupport.java @@ -95,19 +95,13 @@ public class RowsDnDSupport { event.setHighlighting(rectangle, DnDEvent.DropTargetHighlightingType.FILLED_RECTANGLE); break; } - return true; } else { event.hideHighlighter(); - return true; } } - else { - - if (oldIndex == newIndex) { // Drag&Drop always starts with new==old and we shouldn't display 'rejecting' cursor in this case - return true; - } - + else if (oldIndex != newIndex) { + // Drag&Drop always starts with new==old and we shouldn't display 'rejecting' cursor if they are equal boolean canExchange = model.canExchangeRows(oldIndex, newIndex); if (canExchange) { if (oldIndex < newIndex) { @@ -121,8 +115,8 @@ public class RowsDnDSupport { else { event.setDropPossible(false); } - return true; } + return true; } }) .setDropHandler(new DnDDropHandler() { diff --git a/platform/platform-impl/src/com/intellij/internal/inspector/UiDropperAction.java b/platform/platform-impl/src/com/intellij/internal/inspector/UiDropperAction.java index 28fdac08aeca..77e28f3ede7e 100644 --- a/platform/platform-impl/src/com/intellij/internal/inspector/UiDropperAction.java +++ b/platform/platform-impl/src/com/intellij/internal/inspector/UiDropperAction.java @@ -1123,16 +1123,14 @@ public class UiDropperAction extends ToggleAction implements DumbAware { window.switchInfo(c); //window.highlightCmp(true); - window.setVisible(true); - window.toFront(); } else { window = new InspectorWindow(c); myComponentToInspector.put(c, window); window.pack(); - window.setVisible(true); - window.toFront(); } + window.setVisible(true); + window.toFront(); } @Override diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/http/HttpVirtualFileImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/http/HttpVirtualFileImpl.java index ac9c07566e51..5bc355fb1c76 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/http/HttpVirtualFileImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/http/HttpVirtualFileImpl.java @@ -73,14 +73,8 @@ class HttpVirtualFileImpl extends HttpVirtualFile { } else { int prevSlash = path.lastIndexOf('/', lastSlash - 1); - if (prevSlash < 0) { - myParentPath = path.substring(0, lastSlash + 1); - myName = path.substring(lastSlash + 1); - } - else { - myParentPath = path.substring(0, lastSlash); - myName = path.substring(lastSlash + 1); - } + myParentPath = path.substring(0, prevSlash < 0 ? lastSlash + 1 : lastSlash); + myName = path.substring(lastSlash + 1); } } } diff --git a/platform/platform-impl/src/com/intellij/ui/components/SliderSelectorAction.java b/platform/platform-impl/src/com/intellij/ui/components/SliderSelectorAction.java index 38a969f1124c..99a6e0f9df26 100644 --- a/platform/platform-impl/src/com/intellij/ui/components/SliderSelectorAction.java +++ b/platform/platform-impl/src/com/intellij/ui/components/SliderSelectorAction.java @@ -92,13 +92,8 @@ public class SliderSelectorAction extends DumbAwareAction { slider.setPaintLabels(true); slider.setLabelTable(dictionary); - if (! myConfiguration.isShowOk()) { - result.add(wrapper, BorderLayout.WEST); - result.add(slider, BorderLayout.CENTER); - } else { - result.add(wrapper, BorderLayout.WEST); - result.add(slider, BorderLayout.CENTER); - } + result.add(wrapper, BorderLayout.WEST); + result.add(slider, BorderLayout.CENTER); final Runnable saveSelection = () -> { int value = slider.getModel().getValue(); diff --git a/platform/platform-impl/src/com/intellij/ui/mac/MacPopupMenuUI.java b/platform/platform-impl/src/com/intellij/ui/mac/MacPopupMenuUI.java index 53c5fdee0b27..4dd9ea72bbda 100644 --- a/platform/platform-impl/src/com/intellij/ui/mac/MacPopupMenuUI.java +++ b/platform/platform-impl/src/com/intellij/ui/mac/MacPopupMenuUI.java @@ -66,23 +66,21 @@ public class MacPopupMenuUI extends BasicPopupMenuUI { if (rectangle1.x + rectangle1.width < rectangle.x + 10) { if (flag) { graphics2d.fillRect(-2, -2, 8, 8); - return; } else { graphics2d.fillRect(-2, rectangle.height - 6, 8, 8); - return; } + return; } if (rectangle.x + rectangle.width < rectangle1.x + 10) { if (flag) { graphics2d.fillRect(rectangle.width - 6, -2, 8, 8); - return; } else { graphics2d.fillRect(rectangle.width - 6, rectangle.height - 6, 8, 8); - return; } + return; } if (rectangle1.y + rectangle1.height < rectangle.y + 10) { diff --git a/platform/platform-impl/src/com/intellij/ui/plaf/beg/BegTabbedPaneUI.java b/platform/platform-impl/src/com/intellij/ui/plaf/beg/BegTabbedPaneUI.java index 06078be54110..9806eb3554b7 100644 --- a/platform/platform-impl/src/com/intellij/ui/plaf/beg/BegTabbedPaneUI.java +++ b/platform/platform-impl/src/com/intellij/ui/plaf/beg/BegTabbedPaneUI.java @@ -191,12 +191,7 @@ public class BegTabbedPaneUI extends MetalTabbedPaneUI { UIUtil.drawLine(g, x, y, selRect.x, y); if (selRect.x + selRect.width < right - 1) { - if (leftToRight && !lastInRun) { - UIUtil.drawLine(g, selRect.x + selRect.width - 2, y, right, y); - } - else { - UIUtil.drawLine(g, selRect.x + selRect.width - 2, y, right, y); - } + UIUtil.drawLine(g, selRect.x + selRect.width - 2, y, right, y); } else { UIUtil.drawLine(g, x + w - 2, y, x + w - 2, y); diff --git a/platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java b/platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java index 8cac9a64ab0d..cb580f767701 100644 --- a/platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java +++ b/platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java @@ -187,11 +187,10 @@ public class TestsUIUtil { if (icon.hideProgress(project, TESTS)) { if (problemsCounter > 0) { icon.setErrorBadge(project, String.valueOf(problemsCounter)); - icon.requestAttention(project, false); } else { icon.setOkBadge(project, true); - icon.requestAttention(project, false); } + icon.requestAttention(project, false); } } } diff --git a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/TemporaryPlacesRegistry.java b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/TemporaryPlacesRegistry.java index 5a41ced4b23e..3cc032a9534d 100644 --- a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/TemporaryPlacesRegistry.java +++ b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/TemporaryPlacesRegistry.java @@ -105,13 +105,11 @@ public class TemporaryPlacesRegistry { newHost.putUserData(LanguageInjectionSupport.TEMPORARY_INJECTED_LANGUAGE, place.language); place.elementPointer = SmartPointerManager.createPointer(newHost); - - return false; } else { element.putUserData(LanguageInjectionSupport.TEMPORARY_INJECTED_LANGUAGE, place.language); - return false; } + return false; }); if (!placesToRemove.isEmpty()) { myTempPlaces.removeAll(placesToRemove); diff --git a/plugins/cvs/javacvs-src/org/netbeans/lib/cvsclient/file/AbstractFileObject.java b/plugins/cvs/javacvs-src/org/netbeans/lib/cvsclient/file/AbstractFileObject.java index cca94ac3110a..6b7ed3be99ad 100644 --- a/plugins/cvs/javacvs-src/org/netbeans/lib/cvsclient/file/AbstractFileObject.java +++ b/plugins/cvs/javacvs-src/org/netbeans/lib/cvsclient/file/AbstractFileObject.java @@ -135,17 +135,16 @@ public abstract class AbstractFileObject { } if (parentPathLength1 > parentPathLength2) { - if (parentPath1.charAt(parentPathLength2) == '/') { - return DirectoryObject.createInstance(parentPath2); - } - return DirectoryObject.createInstance(parentPath1.substring(0, lastSlashIndex)); + if (parentPath1.charAt(parentPathLength2) == '/') { + return DirectoryObject.createInstance(parentPath2); + } } else { if (parentPath2.charAt(parentPathLength1) == '/') { - return DirectoryObject.createInstance(parentPath1); + return DirectoryObject.createInstance(parentPath1); } - return DirectoryObject.createInstance(parentPath1.substring(0, lastSlashIndex)); } + return DirectoryObject.createInstance(parentPath1.substring(0, lastSlashIndex)); } private static DirectoryObject getDirectory(AbstractFileObject abstractFileObject) { diff --git a/plugins/git4idea/src/git4idea/merge/GitMergeUtil.java b/plugins/git4idea/src/git4idea/merge/GitMergeUtil.java index 5a5fad07373b..0ed30305bf5f 100644 --- a/plugins/git4idea/src/git4idea/merge/GitMergeUtil.java +++ b/plugins/git4idea/src/git4idea/merge/GitMergeUtil.java @@ -103,14 +103,8 @@ public class GitMergeUtil { @Override public void elementMarkChanged(final String element, final boolean isMarked) { final List elements = branchChooser.getMarkedElements(); - if (elements.size() == 0) { - strategy.setEnabled(false); - updateStrategies(elements); - } - else { - strategy.setEnabled(true); - updateStrategies(elements); - } + strategy.setEnabled(!elements.isEmpty()); + updateStrategies(elements); } }; listener.elementMarkChanged(null, true); diff --git a/plugins/git4idea/src/git4idea/util/GitLocalCommitCompareInfo.java b/plugins/git4idea/src/git4idea/util/GitLocalCommitCompareInfo.java index 30a3edcc21d4..057157681e08 100644 --- a/plugins/git4idea/src/git4idea/util/GitLocalCommitCompareInfo.java +++ b/plugins/git4idea/src/git4idea/util/GitLocalCommitCompareInfo.java @@ -62,13 +62,10 @@ public class GitLocalCommitCompareInfo extends LocalCommitCompareInfo { Repository repository = repositoryManager.getRepositoryForFile(ObjectUtils.chooseNotNull(currentPath, branchPath)); if (currentPath != null && branchPath != null) { - if (Comparing.equal(currentPath, branchPath)) { - toCheckout.putValue(repository, branchPath); - } - else { + if (!Comparing.equal(currentPath, branchPath)) { toDelete.putValue(repository, currentPath); - toCheckout.putValue(repository, branchPath); } + toCheckout.putValue(repository, branchPath); } else if (currentPath != null) { toDelete.putValue(repository, currentPath); diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/unusedDef/UnusedDefInspection.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/unusedDef/UnusedDefInspection.java index 13c13834bd56..674748cca88a 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/unusedDef/UnusedDefInspection.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/unusedDef/UnusedDefInspection.java @@ -164,13 +164,12 @@ public class UnusedDefInspection extends GroovyLocalInspectionBase { PsiFile file = var.getContainingFile(); if (file == null) { LOG.error("no file??? var of type" + var.getClass().getCanonicalName()); - return false; } else { TextRange range = var.getTextRange(); LOG.error("var: " + var.getName() + ", offset:" + (range != null ? range.getStartOffset() : -1)); - return false; } + return false; } return ReferencesSearch.search(var, var.getUseScope()).forEach( diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/processors/GroovySpacingProcessor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/processors/GroovySpacingProcessor.java index 938d514afe58..4d87806e0aff 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/processors/GroovySpacingProcessor.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/processors/GroovySpacingProcessor.java @@ -565,13 +565,12 @@ public class GroovySpacingProcessor extends GroovyElementVisitor { if (TokenSets.METHOD_DEFS.contains(myType1) || isSemiAfter(TokenSets.METHOD_DEFS) || TokenSets.METHOD_DEFS.contains((myType2))) { if (myType1 == GroovyDocElementTypes.GROOVY_DOC_COMMENT) { createLF(true); - return; } else { final int minBlankLines = isInterface ? mySettings.BLANK_LINES_AROUND_METHOD_IN_INTERFACE : mySettings.BLANK_LINES_AROUND_METHOD; myResult = Spacing.createSpacing(0, 0, minBlankLines + 1, mySettings.KEEP_LINE_BREAKS, keepBlankLines()); - return; } + return; } if (TokenSets.TYPE_DEFINITIONS.contains(myType1) || isSemiAfter(TokenSets.TYPE_DEFINITIONS) || TokenSets.TYPE_DEFINITIONS.contains((myType2)) ) { diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/AssertProcessor.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/AssertProcessor.java index a5f8d720f99c..b0e7b71b3f33 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/AssertProcessor.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/AssertProcessor.java @@ -320,7 +320,6 @@ public class AssertProcessor { key.equals(InterpreterUtil.makeUniqueKey(fdparam.getName(), fdparam.getDescriptor().descriptorString)); } } - return false; } else { if (exprent.type == Exprent.EXPRENT_FIELD) { @@ -328,7 +327,7 @@ public class AssertProcessor { return classname.equals(fdparam.getClassname()) && key.equals(InterpreterUtil.makeUniqueKey(fdparam.getName(), fdparam.getDescriptor().descriptorString)); } - return false; } + return false; } } diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SwitchStatement.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SwitchStatement.java index 6633d80f9fae..ab48eccfcad8 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SwitchStatement.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SwitchStatement.java @@ -122,7 +122,6 @@ public class SwitchStatement extends Statement { for (int j = 0; j < edges.size(); j++) { if (edges.get(j) == default_edge) { buf.appendIndent(indent).append("default:").appendLineSeparator(); - tracer.incrementCurrentSourceLine(); } else { buf.appendIndent(indent).append("case "); @@ -139,8 +138,8 @@ public class SwitchStatement extends Statement { } buf.append(":").appendLineSeparator(); - tracer.incrementCurrentSourceLine(); } + tracer.incrementCurrentSourceLine(); } buf.append(ExprProcessor.jmpWrapper(stat, indent + 1, false, tracer)); diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsManagerWatcher.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsManagerWatcher.java index 8fc19fac9e4b..dae3dc023293 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsManagerWatcher.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsManagerWatcher.java @@ -447,14 +447,11 @@ public class MavenProjectsManagerWatcher { newCrc = file.getModificationStamp(); } - if (newCrc == -1 // file is invalid - || newCrc.equals(crc)) { - return true; - } - else { + if (newCrc != -1 // file is valid + && !newCrc.equals(crc)) { map.put(myProject, newCrc); - return true; } + return true; } @Nullable diff --git a/python/src/com/jetbrains/python/inspections/unresolvedReference/PyUnresolvedReferencesInspection.java b/python/src/com/jetbrains/python/inspections/unresolvedReference/PyUnresolvedReferencesInspection.java index 11a6d77fddcd..903aa928b700 100644 --- a/python/src/com/jetbrains/python/inspections/unresolvedReference/PyUnresolvedReferencesInspection.java +++ b/python/src/com/jetbrains/python/inspections/unresolvedReference/PyUnresolvedReferencesInspection.java @@ -552,12 +552,11 @@ public class PyUnresolvedReferencesInspection extends PyInspection { else { description = PyBundle.message("INSP.unresolved.ref.$0.for.class.$1", refText, type.getName()); } - markedQualified = true; } else { description = PyBundle.message("INSP.cannot.find.$0.in.$1", refText, type.getName()); - markedQualified = true; } + markedQualified = true; } } if (!markedQualified) { diff --git a/python/src/com/jetbrains/python/psi/impl/PyNumericLiteralExpressionImpl.java b/python/src/com/jetbrains/python/psi/impl/PyNumericLiteralExpressionImpl.java index 33306b62d566..4e912bf823cb 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyNumericLiteralExpressionImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/PyNumericLiteralExpressionImpl.java @@ -125,12 +125,11 @@ public class PyNumericLiteralExpressionImpl extends PyElementImpl implements PyN else if (text.startsWith("0")) { if (StringUtil.isChar(text, 1, 'o') || StringUtil.isChar(text, 1, 'O')) { beginIndex = 2; - radix = 8; } else { beginIndex = 1; - radix = 8; } + radix = 8; } else { beginIndex = 0; diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomAnchorImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomAnchorImpl.java index 65095f7fc702..91b87dfaa6d8 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomAnchorImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomAnchorImpl.java @@ -121,13 +121,12 @@ public abstract class DomAnchorImpl implements DomAnchor