File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
src/main/java/org/scijava Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -122,10 +122,8 @@ public Context(final boolean empty) {
122122 * @throws ClassCastException If any of the given arguments do not implement
123123 * the {@link Service} interface.
124124 */
125- @ SuppressWarnings ({ "rawtypes" , "unchecked" })
126- public Context (final Class ... serviceClasses ) {
127- this (serviceClasses != null ? (Collection ) Arrays .asList (serviceClasses )
128- : Arrays .asList (Service .class ));
125+ public Context (@ SuppressWarnings ("rawtypes" ) final Class ... serviceClasses ) {
126+ this (serviceClassList (serviceClasses ));
129127 }
130128
131129 /**
@@ -379,6 +377,20 @@ public void dispose() {
379377 }
380378 }
381379
380+ // -- Utility methods --
381+
382+ /**
383+ * Utility method for converting a varargs list of service classes to a
384+ * {@link List} of those classes.
385+ */
386+ @ SuppressWarnings ({ "rawtypes" , "unchecked" })
387+ public static List <Class <? extends Service >> serviceClassList (
388+ final Class ... serviceClasses )
389+ {
390+ return serviceClasses != null ? (List ) Arrays .asList (serviceClasses )
391+ : Arrays .asList (Service .class );
392+ }
393+
382394 // -- Helper methods --
383395
384396 private String createMissingServiceMessage (
You can’t perform that action at this time.
0 commit comments