Skip to content

Commit d03cc39

Browse files
committed
Ensure all core services implement SciJavaService
This commit also adds a test to prevent this issue in the future.
1 parent 2b6eb9b commit d03cc39

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/main/java/org/scijava/app/AppService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,14 @@
3434
import java.util.Map;
3535

3636
import org.scijava.plugin.SingletonService;
37+
import org.scijava.service.SciJavaService;
3738

3839
/**
3940
* Interface for application-level functionality.
4041
*
4142
* @author Curtis Rueden
4243
*/
43-
public interface AppService extends SingletonService<App> {
44+
public interface AppService extends SingletonService<App>, SciJavaService {
4445

4546
/** Gets the foremost application (the one with the highest priority). */
4647
App getApp();

src/main/java/org/scijava/convert/ConvertService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import java.util.Collection;
3636

3737
import org.scijava.plugin.HandlerService;
38+
import org.scijava.service.SciJavaService;
3839

3940
/**
4041
* Service for converting between types using an extensible plugin:
@@ -46,8 +47,9 @@
4647
* @author Mark Hiner
4748
*/
4849
public interface ConvertService extends
49-
HandlerService<ConversionRequest, Converter<?, ?>>
50+
HandlerService<ConversionRequest, Converter<?, ?>>, SciJavaService
5051
{
52+
5153
/**
5254
* @see Converter#convert(Object, Type)
5355
*/

src/test/java/org/scijava/service/ServiceIndexTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import static org.junit.Assert.assertEquals;
3535
import static org.junit.Assert.assertNull;
3636
import static org.junit.Assert.assertSame;
37+
import static org.junit.Assert.assertTrue;
3738

3839
import java.util.List;
3940

@@ -66,6 +67,14 @@ public void testGetAll() {
6667
assertSame(StderrLogService.class, all.get(3).getClass());
6768
}
6869

70+
@Test
71+
public void testMarkerInterfaces() {
72+
final Context context = new Context();
73+
for (Service s : context.getServiceIndex().getAll()) {
74+
assertTrue(s.getClass().getName(), s instanceof SciJavaService);
75+
}
76+
}
77+
6978
/**
7079
* Test the {@link ServiceIndex#getPrevService(Class, Class)} operation.
7180
*/

0 commit comments

Comments
 (0)