Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2021-03-17 15:59:35 +0000
committerLars Vogel2021-03-17 15:59:40 +0000
commitde1b4cc1047dc3e6f5a100a1904098aedcb71e0e (patch)
tree02a8278510f19a1fae3320de769fca054237359c
parentaef7bd3b2861a5d0c8d521f05d51024e9d701937 (diff)
downloadeclipse.platform.team-de1b4cc1047dc3e6f5a100a1904098aedcb71e0e.tar.gz
eclipse.platform.team-de1b4cc1047dc3e6f5a100a1904098aedcb71e0e.tar.xz
eclipse.platform.team-de1b4cc1047dc3e6f5a100a1904098aedcb71e0e.zip
Bug 572036 - Evaluate without null checkI20210317-1320
Done with the JDT clean-up -> Unnecesarry code -> Evaluate without null check Change-Id: I3b38dbc83593d8248d05ec89341a73aba4c01a44 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java5
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java18
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java4
3 files changed, 10 insertions, 17 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
index eb28e45b8..823c19ee8 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
@@ -3912,8 +3912,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
Object current = getCompareConfiguration()
.getProperty(ChangeCompareFilterPropertyAction.COMPARE_FILTER_ACTIONS);
boolean currentFiltersMatch = false;
- if (current != null && current instanceof List
- && ((List<?>) current).size() == compareFilterDescriptors.length) {
+ if (current instanceof List && ((List<?>) current).size() == compareFilterDescriptors.length) {
currentFiltersMatch = true;
@SuppressWarnings("unchecked")
List<ChangeCompareFilterPropertyAction> currentFilterActions = (List<ChangeCompareFilterPropertyAction>) current;
@@ -5397,7 +5396,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
*/
private int getHunkStart() {
Object input = getInput();
- if (input != null && input instanceof DiffNode){
+ if (input instanceof DiffNode){
ITypedElement right = ((DiffNode) input).getRight();
if (right != null) {
Object element = Adapters.adapt(right, IHunk.class);
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java
index 3456ad142..dd5fb0088 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java
@@ -973,10 +973,8 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
String rightType = guessType(input.getRight());
if (leftType != null || rightType != null) {
- boolean right_text = rightType != null
- && ITypedElement.TEXT_TYPE.equals(rightType);
- boolean left_text = leftType != null
- && ITypedElement.TEXT_TYPE.equals(leftType);
+ boolean right_text = ITypedElement.TEXT_TYPE.equals(rightType);
+ boolean left_text = ITypedElement.TEXT_TYPE.equals(leftType);
if ((rightType != null && !right_text)
|| (leftType != null && !left_text)) {
result.add(BINARY_TYPE);
@@ -1063,10 +1061,8 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
String rightType= guessType(input.getRight());
if (leftType != null || rightType != null) {
- boolean right_text = rightType != null
- && ITypedElement.TEXT_TYPE.equals(rightType);
- boolean left_text = leftType != null
- && ITypedElement.TEXT_TYPE.equals(leftType);
+ boolean right_text = ITypedElement.TEXT_TYPE.equals(rightType);
+ boolean left_text = ITypedElement.TEXT_TYPE.equals(leftType);
initializeRegistries();
if ((rightType != null && !right_text)
|| (leftType != null && !left_text)) {
@@ -1499,10 +1495,8 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
String rightType= guessType(input.getRight());
if (leftType != null || rightType != null) {
- boolean right_text = rightType != null
- && ITypedElement.TEXT_TYPE.equals(rightType);
- boolean left_text = leftType != null
- && ITypedElement.TEXT_TYPE.equals(leftType);
+ boolean right_text = ITypedElement.TEXT_TYPE.equals(rightType);
+ boolean left_text = ITypedElement.TEXT_TYPE.equals(leftType);
initializeRegistries();
if ((rightType != null && !right_text)
|| (leftType != null && !left_text)) {
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
index 8740a897a..b071c0221 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
@@ -763,7 +763,7 @@ public class Utilities {
* @return whether the left or right side of the input represents a hunk
*/
public static boolean isHunk(Object input) {
- if (input != null && input instanceof DiffNode){
+ if (input instanceof DiffNode){
ITypedElement right = ((DiffNode) input).getRight();
if (Adapters.adapt(right, IHunk.class) != null)
return true;
@@ -775,7 +775,7 @@ public class Utilities {
}
public static boolean isHunkOk(Object input) {
- if (input != null && input instanceof DiffNode){
+ if (input instanceof DiffNode){
ITypedElement right = ((DiffNode) input).getRight();
HunkResult element = Adapters.adapt(right, HunkResult.class);
if (element != null) {

Back to the top