Skip to content

Commit 80572ce

Browse files
committed
Fix ReturnEmptyCollectionRatherThanNull violations
1 parent 34e57ac commit 80572ce

File tree

5 files changed

+7
-10
lines changed

5 files changed

+7
-10
lines changed

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/editors/MultiEnumerationEditorFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ protected void update(PropertySource source, PropertyDescriptor<List<Object>> de
107107

108108
@Override
109109
protected List<Object> valueFrom(Control valueControl) { // unreferenced method?
110-
return null;
110+
return Collections.emptyList();
111111
}
112112

113113

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/editors/MultiMethodEditorFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ protected Method addValueIn(Control widget, PropertyDescriptor<List<Method>> des
138138

139139
@Override
140140
protected List<Method> valueFrom(Control valueControl) { // not necessary for this type
141-
return null;
141+
return Collections.emptyList();
142142
}
143143

144144

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/editors/MultiStringEditorFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,6 @@ protected String addValueIn(Control widget, PropertyDescriptor<List<String>> des
9898

9999
@Override
100100
protected List<String> valueFrom(Control valueControl) { // not necessary for this type
101-
return null;
101+
return Collections.emptyList();
102102
}
103103
}

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/editors/MultiTypeEditorFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,6 @@ protected Class addValueIn(Control widget, PropertyDescriptor<List<Class>> desc,
145145

146146
@Override
147147
protected List<Class> valueFrom(Control valueControl) { // not necessary for this type
148-
return null;
148+
return Collections.emptyList();
149149
}
150150
}

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/views/dataflow/DataflowGraph.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package net.sourceforge.pmd.eclipse.ui.views.dataflow;
66

77
import java.util.ArrayList;
8+
import java.util.Collections;
89
import java.util.Iterator;
910
import java.util.List;
1011

@@ -636,10 +637,6 @@ public void markPath(int line1, int line2, String varName) {
636637

637638
// from every starting Node we search for a Path to the ending node
638639
List<PathCanvas> pathList = findPath(start, endNode, new ArrayList<DataFlowNode>());
639-
if (pathList == null) {
640-
continue;
641-
}
642-
643640
// we get a List of PathCanvas, that build up the searched Path
644641
for (PathCanvas currentPath : pathList) {
645642
// if some PathCanvas are already found and
@@ -708,7 +705,7 @@ protected List<PathCanvas> findPath(DataFlowNode start, DataFlowNode end, List<D
708705
// the Recursion: find the Path from
709706
// the current Node's children to the End
710707
List<PathCanvas> isFound = findPath(node, end, visited);
711-
if (isFound == null) {
708+
if (isFound.isEmpty()) {
712709
continue;
713710
} else {
714711
// if a Path (from child to end) is found
@@ -723,6 +720,6 @@ protected List<PathCanvas> findPath(DataFlowNode start, DataFlowNode end, List<D
723720
}
724721
}
725722

726-
return null;
723+
return Collections.emptyList();
727724
}
728725
}

0 commit comments

Comments
 (0)