mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
improve performance of logical conjunction (IDEA-182226)
This commit is contained in:
@@ -38,7 +38,7 @@ class WindowsJavaFinder extends JavaHomeFinder {
|
||||
File parentFile = javasFolder.getParentFile();
|
||||
File root = parentFile != null ? parentFile.getParentFile() : null;
|
||||
String name = parentFile != null ? parentFile.getName() : "";
|
||||
if (name.contains("Program Files") && root != null) {
|
||||
if (root != null && name.contains("Program Files")) {
|
||||
String x86Suffix = " (x86)";
|
||||
boolean x86 = name.endsWith(x86Suffix) && name.length() > x86Suffix.length();
|
||||
File anotherJavasFolder;
|
||||
|
||||
+1
-1
@@ -415,7 +415,7 @@ class IntroduceConstantDialog extends DialogWrapper {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!visible.contains(initialVisibility) && !visible.isEmpty()) {
|
||||
if (!visible.isEmpty() && !visible.contains(initialVisibility)) {
|
||||
return visible.get(0);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -69,7 +69,7 @@ public class ExpressionParser {
|
||||
if (left == null) return null;
|
||||
|
||||
final IElementType tokenType = getGtTokenType(builder);
|
||||
if (ASSIGNMENT_OPS.contains(tokenType) && tokenType != null) {
|
||||
if (tokenType != null && ASSIGNMENT_OPS.contains(tokenType)) {
|
||||
final PsiBuilder.Marker assignment = left.precede();
|
||||
advanceGtToken(builder, tokenType);
|
||||
|
||||
|
||||
@@ -417,7 +417,7 @@ public class ControlFlowUtil {
|
||||
// process chain of goto's
|
||||
gotoOffset = promoteThroughGotoChain(flow, gotoOffset);
|
||||
|
||||
if (!exitPoints.contains(gotoOffset) && (gotoOffset >= end || gotoOffset < start) && gotoOffset > 0) {
|
||||
if (gotoOffset > 0 && (gotoOffset >= end || gotoOffset < start) && !exitPoints.contains(gotoOffset)) {
|
||||
exitPoints.add(gotoOffset);
|
||||
}
|
||||
if (gotoOffset >= end || gotoOffset < start) {
|
||||
|
||||
@@ -77,7 +77,7 @@ public class CompileScopeImpl extends CompileScope {
|
||||
|
||||
@Override
|
||||
public boolean isBuildForced(@NotNull BuildTarget<?> target) {
|
||||
return myTypesToForceBuild.contains(target.getTargetType()) && myFiles.isEmpty() && isWholeTargetAffected(target);
|
||||
return myFiles.isEmpty() && myTypesToForceBuild.contains(target.getTargetType()) && isWholeTargetAffected(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -122,7 +122,7 @@ public class MinifiedFilesUtil {
|
||||
|
||||
if (whitespaceTokens.contains(tokenType)) {
|
||||
lastWhiteSpaceWasHandled = false;
|
||||
if (!commentTokens.contains(lastTokenType) && tokenLength > 1) {
|
||||
if (tokenLength > 1 && !commentTokens.contains(lastTokenType)) {
|
||||
lexer.advance();
|
||||
if (lexer.getTokenType() == null) {
|
||||
// it was last token
|
||||
|
||||
@@ -66,7 +66,7 @@ public class ManageRepoDialog extends DialogWrapper {
|
||||
@Override
|
||||
public void run(AnActionButton button) {
|
||||
String url = Messages.showInputDialog("Please input repository URL", "Repository URL", null);
|
||||
if (!repoModel.contains(url) && !StringUtil.isEmptyOrSpaces(url)) {
|
||||
if (!StringUtil.isEmptyOrSpaces(url) && !repoModel.contains(url)) {
|
||||
repoModel.addElement(url);
|
||||
controller.addRepository(url);
|
||||
}
|
||||
|
||||
@@ -2867,7 +2867,7 @@ public class AbstractTreeUi {
|
||||
if (!canInitiateNewActivity()) return false;
|
||||
if (!getBuilder().isSmartExpand()) return false;
|
||||
|
||||
boolean smartExpand = !myNotForSmartExpand.contains(node) && canSmartExpand;
|
||||
boolean smartExpand = canSmartExpand && !myNotForSmartExpand.contains(node);
|
||||
return smartExpand && validateAutoExpand(true, getElementFor(node));
|
||||
}
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
|
||||
if (scrollpane != null) {
|
||||
Point loc = ((MouseEvent)event).getLocationOnScreen();
|
||||
SwingUtilities.convertPointFromScreen(loc, scrollpane);
|
||||
if (scrollpane.contains(loc) && !myMacScrollbarHidden && myMacScrollbarFadeLevel == 0) {
|
||||
if (!myMacScrollbarHidden && myMacScrollbarFadeLevel == 0 && scrollpane.contains(loc)) {
|
||||
startMacScrollbarFadeout();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -180,7 +180,7 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
|
||||
myLastVisualLine = visualLine;
|
||||
Rectangle area = myEditor.getScrollingModel().getVisibleArea();
|
||||
int visualY = myEditor.getLineHeight() * visualLine;
|
||||
boolean isVisible = area.contains(area.x, visualY) && myWheelAccumulator == 0;
|
||||
boolean isVisible = myWheelAccumulator == 0 && area.contains(area.x, visualY);
|
||||
|
||||
if (UIUtil.uiParents(myEditor.getComponent(), false).filter(EditorWindowHolder.class).isEmpty() || isVisible || !UISettings.getInstance().getShowEditorToolTip()) {
|
||||
final Set<RangeHighlighter> highlighters = new THashSet<>();
|
||||
|
||||
@@ -120,7 +120,7 @@ public class ExceptionUtil {
|
||||
String exceptionPattern = "Exception: ";
|
||||
String errorPattern = "Error: ";
|
||||
|
||||
while ((result == null || result.contains(exceptionPattern) || result.contains(errorPattern)) && e.getCause() != null) {
|
||||
while (e.getCause() != null && (result == null || result.contains(exceptionPattern) || result.contains(errorPattern))) {
|
||||
e = e.getCause();
|
||||
result = e.getMessage();
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class VcsRootErrorsFinder {
|
||||
continue;
|
||||
}
|
||||
String vcsPath = virtualFileFromRoot.getPath();
|
||||
if (!mappedPaths.contains(vcsPath) && root.getVcs() != null) {
|
||||
if (root.getVcs() != null && !mappedPaths.contains(vcsPath)) {
|
||||
errors.add(new VcsRootErrorImpl(VcsRootError.Type.UNREGISTERED_ROOT, vcsPath, root.getVcs().getName()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class IndexSpeedSearch extends VcsLogSpeedSearch {
|
||||
if (newValue != null && dataGetter != null) {
|
||||
String oldValue = (String)evt.getOldValue();
|
||||
Collection<VcsUser> usersToExamine = myUserRegistry.getUsers();
|
||||
if (oldValue != null && newValue.contains(oldValue) && myMatchedUsers != null) {
|
||||
if (oldValue != null && myMatchedUsers != null && newValue.contains(oldValue)) {
|
||||
if (myMatchedUsers.isEmpty()) return;
|
||||
usersToExamine = myMatchedUsers;
|
||||
}
|
||||
|
||||
+1
-1
@@ -525,7 +525,7 @@ public class GroovyInlineMethodUtil {
|
||||
GrParameter[] parameters = method.getParameters();
|
||||
for (GrParameter parameter : parameters) {
|
||||
GrExpression initializer = parameter.getInitializerGroovy();
|
||||
if (nameFilter.contains(parameter.getName()) && initializer != null) {
|
||||
if (initializer != null && nameFilter.contains(parameter.getName())) {
|
||||
replaceAllOccurrencesWithExpression(method, call, initializer, parameter);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -216,14 +216,14 @@ public class DeadCodeHelper {
|
||||
|
||||
for (int i = 0; i < node.getPreds().size(); i++) {
|
||||
BasicBlock pred = node.getPreds().get(i);
|
||||
if (!marked.contains(pred) && pred != dom) {
|
||||
if (pred != dom && !marked.contains(pred)) {
|
||||
lstNodes.add(pred);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < node.getPredExceptions().size(); i++) {
|
||||
BasicBlock pred = node.getPredExceptions().get(i);
|
||||
if (!marked.contains(pred) && pred != dom) {
|
||||
if (pred != dom && !marked.contains(pred)) {
|
||||
lstNodes.add(pred);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-2
@@ -4,7 +4,10 @@ package org.jetbrains.java.decompiler.modules.decompiler;
|
||||
import org.jetbrains.java.decompiler.modules.decompiler.exps.Exprent;
|
||||
import org.jetbrains.java.decompiler.modules.decompiler.stats.Statement;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
public class DecHelper {
|
||||
@@ -145,7 +148,7 @@ public class DecHelper {
|
||||
if (head == statd) {
|
||||
return false;
|
||||
}
|
||||
if (!setDest.contains(statd) && post != statd) {
|
||||
if (post != statd && !setDest.contains(statd)) {
|
||||
if (post != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+5
-2
@@ -1,7 +1,10 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.java.decompiler.modules.decompiler;
|
||||
|
||||
import org.jetbrains.java.decompiler.code.*;
|
||||
import org.jetbrains.java.decompiler.code.CodeConstants;
|
||||
import org.jetbrains.java.decompiler.code.Instruction;
|
||||
import org.jetbrains.java.decompiler.code.InstructionSequence;
|
||||
import org.jetbrains.java.decompiler.code.SimpleInstructionSequence;
|
||||
import org.jetbrains.java.decompiler.code.cfg.BasicBlock;
|
||||
import org.jetbrains.java.decompiler.code.cfg.ControlFlowGraph;
|
||||
import org.jetbrains.java.decompiler.code.cfg.ExceptionRangeCFG;
|
||||
@@ -321,7 +324,7 @@ public class FinallyProcessor {
|
||||
|
||||
for (BasicBlock dest : lstSucc) {
|
||||
// break out
|
||||
if (!setCopy.contains(dest) && dest != graph.getLast()) {
|
||||
if (dest != graph.getLast() && !setCopy.contains(dest)) {
|
||||
// disable semaphore
|
||||
SimpleInstructionSequence seq = new SimpleInstructionSequence();
|
||||
seq.addInstruction(Instruction.create(CodeConstants.opc_bipush, false, CodeConstants.GROUP_GENERAL, bytecode_version, new int[]{0}), -1);
|
||||
|
||||
+6
-3
@@ -5,7 +5,6 @@ package org.jetbrains.java.decompiler.modules.decompiler.stats;
|
||||
|
||||
import org.jetbrains.java.decompiler.code.CodeConstants;
|
||||
import org.jetbrains.java.decompiler.main.DecompilerContext;
|
||||
import org.jetbrains.java.decompiler.util.TextBuffer;
|
||||
import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer;
|
||||
import org.jetbrains.java.decompiler.main.collectors.CounterContainer;
|
||||
import org.jetbrains.java.decompiler.modules.decompiler.DecHelper;
|
||||
@@ -13,8 +12,12 @@ import org.jetbrains.java.decompiler.modules.decompiler.ExprProcessor;
|
||||
import org.jetbrains.java.decompiler.modules.decompiler.StatEdge;
|
||||
import org.jetbrains.java.decompiler.modules.decompiler.exps.VarExprent;
|
||||
import org.jetbrains.java.decompiler.struct.gen.VarType;
|
||||
import org.jetbrains.java.decompiler.util.TextBuffer;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class CatchAllStatement extends Statement {
|
||||
|
||||
@@ -75,7 +78,7 @@ public class CatchAllStatement extends Statement {
|
||||
for (StatEdge edge : head.getSuccessorEdges(StatEdge.TYPE_EXCEPTION)) {
|
||||
Statement exc = edge.getDestination();
|
||||
|
||||
if (edge.getExceptions() == null && setHandlers.contains(exc) && exc.getLastBasicType() == LASTBASICTYPE_GENERAL) {
|
||||
if (edge.getExceptions() == null && exc.getLastBasicType() == LASTBASICTYPE_GENERAL && setHandlers.contains(exc)) {
|
||||
List<StatEdge> lstSuccs = exc.getSuccessorEdges(STATEDGE_DIRECT_ALL);
|
||||
if (lstSuccs.isEmpty() || lstSuccs.get(0).getType() != StatEdge.TYPE_REGULAR) {
|
||||
|
||||
|
||||
+1
-1
@@ -253,7 +253,7 @@ public class PyActiveSdkConfigurable implements UnnamedConfigurable {
|
||||
mySdkSettingsWereModified = false;
|
||||
final Sdk selectedSdk = getSelectedSdk();
|
||||
|
||||
if (myInitialSdkSet.contains(selectedSdk) && selectedSdk != null) {
|
||||
if (selectedSdk != null && myInitialSdkSet.contains(selectedSdk)) {
|
||||
PythonSdkUpdater.updateOrShowError(selectedSdk, null, myProject, null);
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ public class PyNumericViewUtil {
|
||||
if (matcher.matches()) {
|
||||
String real = matcher.group(1);
|
||||
String imag = matcher.group(2);
|
||||
if (real.contains("j") && imag == null) {
|
||||
if (imag == null && real.contains("j")) {
|
||||
return new Pair<>(new Double(0.0), Double.parseDouble(real.substring(0, real.length() - 1)));
|
||||
}
|
||||
else {
|
||||
|
||||
+1
-1
@@ -303,7 +303,7 @@ public class PyChangeSignatureUsageProcessor implements ChangeSignatureUsageProc
|
||||
final PyDocstringGenerator generator = PyDocstringGenerator.forDocStringOwner(function);
|
||||
for (PyParameter p : function.getParameterList().getParameters()) {
|
||||
final String paramName = p.getName();
|
||||
if (!names.contains(paramName) && paramName != null) {
|
||||
if (paramName != null && !names.contains(paramName)) {
|
||||
generator.withoutParam(paramName);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user