Skip to content

Commit 05b1537

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 843f863 commit 05b1537

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
@@ -88,7 +88,7 @@ public void initialize() {
8888
objectService.getIndex().addLater(new LazyObjects<PT>() {
8989

9090
@Override
91-
public ArrayList<PT> get() {
91+
public List<PT> get() {
9292
return new ArrayList<PT>(getInstances());
9393
}
9494

@@ -108,7 +108,7 @@ public Class<?> getType() {
108108
* @param list the initial list of instances
109109
* @return the filtered list of instances
110110
*/
111-
protected List<? extends PT> filterInstances(final List<PT> list) {
111+
protected List<PT> filterInstances(final List<PT> list) {
112112
return list;
113113
}
114114

0 commit comments

Comments
 (0)