Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Hammer2020-12-06 18:02:02 +0000
committerCarsten Hammer2021-04-05 07:45:47 +0000
commit89dd1a248f586d1b372c1f04b66417eea91614dc (patch)
treea0ec42b3ae3e347aab6c1fa6c72385ce1618d8e8
parentb5124012e081d6b9046ce45845bc166245d8f41d (diff)
downloadeclipse.platform.debug-89dd1a248f586d1b372c1f04b66417eea91614dc.tar.gz
eclipse.platform.debug-89dd1a248f586d1b372c1f04b66417eea91614dc.tar.xz
eclipse.platform.debug-89dd1a248f586d1b372c1f04b66417eea91614dc.zip
in org.eclipse.debug.internal.core.DebugOptions.optionsChanged(DebugOptions) org.eclipse.debug.internal.core.LaunchManager$ResourceProxyVisitor.visit(IResourceProxy) .. This code seems to be using non-short-circuit logic (e.g., & or |) rather than short-circuit logic (&& or ||). In addition, it seem possible that, depending on the value of the left hand side, you might not want to evaluate the right hand side (because it would have side effects, could cause an exception or could be expensive. Non-short-circuit logic causes both sides of the expression to be evaluated even when the result can be inferred from knowing the left-hand side. This can be less efficient and can result in errors if the left-hand side guards cases when evaluating the right-hand side can generate an error. See the Java Language Specification for details. Rank: Of Concern (15), confidence: High Pattern: NS_DANGEROUS_NON_SHORT_CIRCUIT Type: NS, Category: STYLE (Dodgy code) Change-Id: Ib234c4f879ec39de41c661d4532ba2afdfaa1d69 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugOptions.java4
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java6
2 files changed, 5 insertions, 5 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugOptions.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugOptions.java
index 841b06ae6..e03eec7e3 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugOptions.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugOptions.java
@@ -56,8 +56,8 @@ public class DebugOptions implements DebugOptionsListener {
public void optionsChanged(org.eclipse.osgi.service.debug.DebugOptions options) {
fgDebugTrace = options.newDebugTrace(DebugPlugin.getUniqueIdentifier());
DEBUG = options.getBooleanOption(DEBUG_FLAG, false);
- DEBUG_COMMANDS = DEBUG & options.getBooleanOption(DEBUG_FLAG_COMMANDS, false);
- DEBUG_EVENTS = DEBUG & options.getBooleanOption(DEBUG_FLAG_EVENTS, false);
+ DEBUG_COMMANDS = DEBUG && options.getBooleanOption(DEBUG_FLAG_COMMANDS, false);
+ DEBUG_EVENTS = DEBUG && options.getBooleanOption(DEBUG_FLAG_EVENTS, false);
}
/**
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
index 477ce0dce..fb9c0c749 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
@@ -453,7 +453,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
@Override
public boolean visit(IResourceProxy proxy) {
if (proxy.getType() == IResource.FILE) {
- if (ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION.equalsIgnoreCase(proxy.requestFullPath().getFileExtension()) | ILaunchConfiguration.LAUNCH_CONFIGURATION_PROTOTYPE_FILE_EXTENSION.equalsIgnoreCase(proxy.requestFullPath().getFileExtension())) {
+ if (ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION.equalsIgnoreCase(proxy.requestFullPath().getFileExtension()) || ILaunchConfiguration.LAUNCH_CONFIGURATION_PROTOTYPE_FILE_EXTENSION.equalsIgnoreCase(proxy.requestFullPath().getFileExtension())) {
fList.add(proxy.requestResource());
}
return false;
@@ -1662,7 +1662,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
// compatibility.
initializePreferredDelegates();
for (PreferredDelegate pd : fPreferredDelegates) {
- if(pd.getModes().equals(modes) & pd.getTypeId().equals(typeid)) {
+ if (pd.getModes().equals(modes) && pd.getTypeId().equals(typeid)) {
return pd.getDelegate();
}
}
@@ -2393,7 +2393,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
try {
for (ILaunch launch : launches) {
for (ILaunchConfiguration config : configs) {
- if(config.equals(launch.getLaunchConfiguration()) & launch.canTerminate()) {
+ if (config.equals(launch.getLaunchConfiguration()) && launch.canTerminate()) {
launch.terminate();
}
}

Back to the top