Skip to content

Commit bfdc881

Browse files
hinermctrueden
authored andcommitted
AbstractSingletonService: fix helper method
The filterInstances method should not alter the return type of the input list. The purpose of that method is to potentially remove some elements from the input list -- nothing more -- so it should still return a List<PT>, not something else.
1 parent 8f71031 commit bfdc881

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/main/java/org/scijava/platform/DefaultPlatformService.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public boolean registerAppMenus(final Object menus) {
134134
}
135135

136136
@Override
137-
public List<? extends Platform> filterInstances(final List<Platform> list) {
137+
public List<Platform> filterInstances(final List<Platform> list) {
138138
final Iterator<Platform> iter = list.iterator();
139139
while (iter.hasNext()) {
140140
if (!iter.next().isTarget()) {

src/main/java/org/scijava/plugin/AbstractSingletonService.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void initialize() {
8383
objectService.getIndex().addLater(new LazyObjects<PT>() {
8484

8585
@Override
86-
public ArrayList<PT> get() {
86+
public List<PT> get() {
8787
return new ArrayList<PT>(getInstances());
8888
}
8989

@@ -114,7 +114,7 @@ private synchronized void initInstances() {
114114
* @param list the initial list of instances
115115
* @return the filtered list of instances
116116
*/
117-
protected List<? extends PT> filterInstances(List<PT> list) {
117+
protected List<PT> filterInstances(List<PT> list) {
118118
return list;
119119
}
120120

0 commit comments

Comments
 (0)