diff --git a/.github/build.sh b/.github/build.sh
new file mode 100755
index 000000000..523abeb87
--- /dev/null
+++ b/.github/build.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/main/ci-build.sh
+sh ci-build.sh
diff --git a/.github/setup.sh b/.github/setup.sh
new file mode 100755
index 000000000..0ebca586f
--- /dev/null
+++ b/.github/setup.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/main/ci-setup-github-actions.sh
+sh ci-setup-github-actions.sh
+
+# Let the Linux build handle artifact deployment.
+if [ "$(uname)" != Linux ]
+then
+ echo "No deploy -- non-Linux build"
+ echo "NO_DEPLOY=1" >> $GITHUB_ENV
+fi
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 000000000..c0ac58830
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,42 @@
+name: build
+
+on:
+ push:
+ branches:
+ - main
+ tags:
+ - "*-[0-9]+.*"
+ pull_request:
+ branches:
+ - main
+
+jobs:
+ build:
+ name: build-${{ matrix.os }}
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ os: [ubuntu-latest, windows-latest, macos-latest]
+
+ steps:
+ - uses: actions/checkout@v4
+ - name: Set up Java
+ uses: actions/setup-java@v4
+ with:
+ java-version: '11'
+ distribution: 'zulu'
+ cache: 'maven'
+ - name: Set up CI environment
+ run: .github/setup.sh
+ shell: bash
+ - name: Execute the build
+ run: .github/build.sh
+ shell: bash
+ env:
+ GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }}
+ GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
+ MAVEN_USER: ${{ secrets.MAVEN_USER }}
+ MAVEN_PASS: ${{ secrets.MAVEN_PASS }}
+ CENTRAL_USER: ${{ secrets.CENTRAL_USER }}
+ CENTRAL_PASS: ${{ secrets.CENTRAL_PASS }}
+ SIGNING_ASC: ${{ secrets.SIGNING_ASC }}
diff --git a/.mailmap b/.mailmap
index e5a0e733c..5157cbbe1 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1,7 +1,16 @@
Barry DeZonia
-Christian Dietz
+Christian Dietz
+Christian Dietz
+Gabriel Einsdorf
+Gabriel Einsdorf
+Gabriel Selzer
+Gabriel Selzer
ImageJ Jenkins
+Jan Eglinger
Johannes Schindelin
Johannes Schindelin
Jonathan Hale
+Leon Yang
+Leon Yang
Mark Hiner
+Richard Domander
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index b3fcda211..000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-language: java
-jdk: oraclejdk8
-branches:
- only:
- - master
- - "/.*-[0-9]+\\..*/"
-install: true
-script: ".travis/build.sh"
-cache:
- directories:
- - "~/.m2/repository"
-env:
- global:
- - secure: Xkwu2u/v0+kBqW2Mt80FpMS+2NRMnfRaZ6ptiEW44sViKkaENnJegmYVjdSm9RAwAJx9DEp6KYTLH4Hh56JbWp6s8qGcxm2vCbAWBE6ZesOj3oTvv/T4lucxarocZ8hK9NqfY9iCePjl8R10UDePThZgWBFidUQjvPbH+LcXo9g=
- - secure: Jgj204N4hKv+7sUrXGtXMvUoXYuHAerhUvwbHsm0BJFpzUSyHP5QWJH2tHvCUL9Yb4VhNEjc46RLFVmiIXynJwAdAWJodT/VEnOTb5Cf7+0UHK4qCyjyjVHiWq1cf+R8Lr9fuKRqxUAdz9Hw6g0Yt23TX8kCa+wQW9lwchn0IG8=
- - secure: RuGzuPrxyvBRJwsCpSJ10p9PdP2Hzc9lxb29L//Y/Fkc3bJwNMlNa0ST83oGNHJapYc4dWuFk22Ooy/2YioNgsVvR4n5MAslqXQXSY0VDle1Nbf1pudAlPU+quaiYxcAyyysjUUtqc5wADVgpkrDA7GJzAuCOWb4aSwiiIn6u4A=
- - secure: bnsjVlj9MBJto8ahZdMwGpVPjZeyF7r5tZh+t+NhDuZsP0WMlURzGZ9/lJOO4quklgiWCyeVDB5uvDvsdG9BReBe5Q8Q6WZyxhxYtP2iLV0zRWSWsGKk0stGcrmJKk8wbicIJdXD8suiP+2Li5GfxTge/hkhL4CL0OOr6b1JqrM=
diff --git a/.travis/build.sh b/.travis/build.sh
deleted file mode 100755
index 094a570ee..000000000
--- a/.travis/build.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/master/travis-build.sh
-sh travis-build.sh $encrypted_d2fbfc37eea9_key $encrypted_d2fbfc37eea9_iv
diff --git a/.travis/signingkey.asc.enc b/.travis/signingkey.asc.enc
deleted file mode 100644
index 4e4802b46..000000000
Binary files a/.travis/signingkey.asc.enc and /dev/null differ
diff --git a/LICENSE.txt b/LICENSE.txt
index 82d98ebc1..55024a7c5 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,7 +1,4 @@
-Copyright (c) 2009 - 2017, Board of Regents of the University of
-Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
-Institute of Molecular Cell Biology and Genetics, University of
-Konstanz, and KNIME GmbH.
+Copyright (c) 2009 - 2026, SciJava developers.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
diff --git a/NOTICE.txt b/NOTICE.txt
index 74385d300..5b605b01d 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -1,11 +1,12 @@
This project contains code adapted from Apache Commons Lang
(https://commons.apache.org/proper/commons-lang/) version 3.4,
as well as GenTyRef (https://github.com/coekie/gentyref) version 1.1.0,
-both of which are licensed under the Apache 2.0 license, as follows:
+and EventBus (https://github.com/michaelbushe/EventBus) version 1.4,
+each of which is licensed under the Apache 2.0 license, as follows:
Apache License
Version 2.0, January 2004
- http://www.apache.org/licenses/
+ https://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
@@ -197,7 +198,7 @@ both of which are licensed under the Apache 2.0 license, as follows:
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
+ https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/README.md b/README.md
index 0838f7b7b..ba1f15173 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,9 @@
-[](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.scijava%22%20AND%20a%3A%22scijava-common%22)
-[](https://travis-ci.org/scijava/scijava-common)
-[](https://gitter.im/scijava/scijava-common?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+[](https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.scijava%22%20AND%20a%3A%22scijava-common%22)
+[](https://github.com/scijava/scijava-common/actions/workflows/build.yml)
+[](https://imagesc.zulipchat.com/#narrow/stream/327237-SciJava)
SciJava Common is a common library for SciJava software. It provides a
plugin framework, with an extensible mechanism for service discovery, backed
by its own annotation processor, so that plugins can be loaded dynamically.
-It is used by both [ImageJ](https://github.com/imagej/imagej) and
+It is used by both [ImageJ2](https://github.com/imagej/imagej2) and
[SCIFIO](https://github.com/scifio/scifio).
diff --git a/pom.xml b/pom.xml
index 2a76b2e4f..771234c9d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,16 +1,16 @@
-
+4.0.0org.scijavapom-scijava
- 19.2.0
+ 44.0.0scijava-common
- 2.74.3-SNAPSHOT
+ 2.100.2-SNAPSHOTSciJava CommonSciJava Common is a shared library for SciJava software. It provides a plugin framework, with an extensible mechanism for service discovery, backed by its own annotation processor, so that plugins can be loaded dynamically. It is used by downstream projects in the SciJava ecosystem, such as ImageJ and SCIFIO.
@@ -18,7 +18,7 @@
2009SciJava
- http://www.scijava.org/
+ https://scijava.org/
@@ -31,7 +31,7 @@
ctruedenCurtis Rueden
- http://imagej.net/User:Rueden
+ https://imagej.net/people/ctruedenfounderlead
@@ -46,86 +46,99 @@
Mark Hiner
- http://imagej.net/User:Hinerm
+ https://imagej.net/people/hinermfounderhinermJohannes Schindelin
- http://imagej.net/User:Schindelin
+ https://imagej.net/people/dschodschoChris Allanchris-allan
+
+ Nicolas Chiaruttini
+ https://imagej.net/people/NicoKiaru
+ NicoKiaru
+ Barry DeZonia
- http://imagej.net/User:Bdezonia
+ https://imagej.net/people/bdezoniabdezoniaChristian Dietz
- http://imagej.net/User:Dietzc
+ https://imagej.net/people/dietzcdietzcRichard Domander
- http://imagej.net/User:Rdom
+ https://imagej.net/people/rimadomarimadomaGabriel Einsdorf
- http://imagej.net/User:Gab1one
+ https://imagej.net/people/gab1onegab1oneAivar Grislis
- http://imagej.net/User:Grislis
+ https://imagej.net/people/grislisgrislisJonathan Hale
+ https://imagej.net/people/SquareysSquareysGrant Harris
- http://imagej.net/User:Harris
+ https://imagej.net/people/tnargsirrahtnargsirrahLee Kamentsky
- http://imagej.net/User:Leek
+ https://imagej.net/people/LeeKamentskyLeeKamentskyRick Lentz
- http://imagej.net/User:Lentz
+ https://imagej.net/people/ricklentz
+ ricklentzMelissa Linkert
- http://imagej.net/User:Linkert
+ https://imagej.net/people/melissalinkertmelissalinkertKevin Mader
- http://imagej.net/User:Ksmader
+ https://imagej.net/people/kmaderkmaderHadrien Mary
- http://imagej.net/User:Hadim
+ https://imagej.net/people/hadimhadimAlison Walter
- http://imagej.net/User:Awalter2
+ https://imagej.net/people/awalter17awalter17Jay Warrick
+ https://imagej.net/people/jaywarrickjaywarrick
+
+ Christian Tischer
+ https://imagej.net/people/tischi
+ tischi
+
@@ -139,7 +152,7 @@
- scm:git:git://github.com/scijava/scijava-common
+ scm:git:https://github.com/scijava/scijava-commonscm:git:git@github.com:scijava/scijava-commonHEADhttps://github.com/scijava/scijava-common
@@ -149,19 +162,22 @@
https://github.com/scijava/scijava-common/issues
- Travis CI
- https://travis-ci.org/scijava/scijava-common
+ GitHub Actions
+ https://github.com/scijava/scijava-common/actionsorg.scijava
+ 8
+ 11bsd_2SciJava Common shared library for SciJava software.
- Board of Regents of the University of
-Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
-Institute of Molecular Cell Biology and Genetics, University of
-Konstanz, and KNIME GmbH.
+ SciJava developers.
+ **/bushe/**
+
+
+ 2.22.2
@@ -171,13 +187,6 @@ Konstanz, and KNIME GmbH.
parsington
-
-
- org.bushe
- eventbus
- 1.4
-
-
junit
@@ -188,22 +197,22 @@ Konstanz, and KNIME GmbH.
org.mockitomockito-coretest
-
+
-
+
org.apache.maven.pluginsmaven-compiler-plugin
@@ -216,11 +225,22 @@ Konstanz, and KNIME GmbH.
exec-maven-plugin
+ index-annotationsprocess-classesjava
+
+ index-test-annotations
+ process-test-classes
+
+ java
+
+
+ test
+
+ org.scijava.annotations.EclipseHelper
diff --git a/src/it/apt-test/pom.xml b/src/it/apt-test/pom.xml
index 1647ef3ed..c416a3860 100644
--- a/src/it/apt-test/pom.xml
+++ b/src/it/apt-test/pom.xml
@@ -3,10 +3,7 @@
#%L
SciJava Common shared library for SciJava software.
%%
- Copyright (C) 2009 - 2017 Board of Regents of the University of
- Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- Institute of Molecular Cell Biology and Genetics, University of
- Konstanz, and KNIME GmbH.
+ Copyright (C) 2009 - 2026 SciJava developers.
%%
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -34,7 +31,7 @@
+ https://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0@project.groupId@
diff --git a/src/it/apt-test/setup.bsh b/src/it/apt-test/setup.bsh
index 563bf2b67..30380371c 100644
--- a/src/it/apt-test/setup.bsh
+++ b/src/it/apt-test/setup.bsh
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/it/apt-test/src/main/java/org/scijava/annotation/its/Annotated.java b/src/it/apt-test/src/main/java/org/scijava/annotation/its/Annotated.java
index aeb8b9cd5..2d9e5d420 100644
--- a/src/it/apt-test/src/main/java/org/scijava/annotation/its/Annotated.java
+++ b/src/it/apt-test/src/main/java/org/scijava/annotation/its/Annotated.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/it/apt-test/src/main/java/org/scijava/annotation/its/CustomAnnotation.java b/src/it/apt-test/src/main/java/org/scijava/annotation/its/CustomAnnotation.java
index 1ef8c4510..1b456f1c3 100644
--- a/src/it/apt-test/src/main/java/org/scijava/annotation/its/CustomAnnotation.java
+++ b/src/it/apt-test/src/main/java/org/scijava/annotation/its/CustomAnnotation.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/it/apt-test/verify.bsh b/src/it/apt-test/verify.bsh
index 84696a531..679bbf6ed 100644
--- a/src/it/apt-test/verify.bsh
+++ b/src/it/apt-test/verify.bsh
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/it/settings.xml b/src/it/settings.xml
index f7dc233e8..b3042e9e1 100644
--- a/src/it/settings.xml
+++ b/src/it/settings.xml
@@ -3,10 +3,7 @@
#%L
SciJava Common shared library for SciJava software.
%%
- Copyright (C) 2009 - 2017 Board of Regents of the University of
- Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- Institute of Molecular Cell Biology and Genetics, University of
- Konstanz, and KNIME GmbH.
+ Copyright (C) 2009 - 2026 SciJava developers.
%%
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/AbstractBasicDetails.java b/src/main/java/org/scijava/AbstractBasicDetails.java
index a956f0b48..75e28c611 100644
--- a/src/main/java/org/scijava/AbstractBasicDetails.java
+++ b/src/main/java/org/scijava/AbstractBasicDetails.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/AbstractContextual.java b/src/main/java/org/scijava/AbstractContextual.java
index d11fb2c6f..6d47180bf 100644
--- a/src/main/java/org/scijava/AbstractContextual.java
+++ b/src/main/java/org/scijava/AbstractContextual.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/AbstractGateway.java b/src/main/java/org/scijava/AbstractGateway.java
index 4f8362194..14f066a7f 100644
--- a/src/main/java/org/scijava/AbstractGateway.java
+++ b/src/main/java/org/scijava/AbstractGateway.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -45,6 +42,7 @@
import org.scijava.input.InputService;
import org.scijava.io.IOService;
import org.scijava.io.RecentFileService;
+import org.scijava.io.location.LocationService;
import org.scijava.log.LogService;
import org.scijava.main.MainService;
import org.scijava.menu.MenuService;
@@ -54,6 +52,7 @@
import org.scijava.platform.AppEventService;
import org.scijava.platform.PlatformService;
import org.scijava.plugin.AbstractRichPlugin;
+import org.scijava.plugin.PluginInfo;
import org.scijava.plugin.PluginService;
import org.scijava.prefs.PrefService;
import org.scijava.script.ScriptService;
@@ -86,7 +85,15 @@ public AbstractGateway() {
public AbstractGateway(final String appName, final Context context) {
this.appName = appName;
- if (context != null) setContext(context);
+ if (context != null) {
+ setContext(context);
+
+ // NB: Make a best effort to inject plugin metadata.
+ final PluginInfo> info = PluginInfo.getOrCreate(getClass(),
+ Gateway.class, context.getPluginIndex());
+ info.inject(this);
+ Priority.inject(this, info.getPriority());
+ }
}
// -- Gateway methods --
@@ -114,6 +121,8 @@ public void launch(final String... args) {
@Override
public String getShortName() {
+ final String pluginName = getInfo() == null ? null : getInfo().getName();
+ if (pluginName != null && !pluginName.isEmpty()) return pluginName;
return getClass().getSimpleName().toLowerCase();
}
@@ -182,6 +191,11 @@ public InputService input() {
public IOService io() {
return get(IOService.class);
}
+
+ @Override
+ public LocationService location() {
+ return get(LocationService.class);
+ }
@Override
public LogService log() {
diff --git a/src/main/java/org/scijava/AbstractUIDetails.java b/src/main/java/org/scijava/AbstractUIDetails.java
index 6627efa85..11476a03a 100644
--- a/src/main/java/org/scijava/AbstractUIDetails.java
+++ b/src/main/java/org/scijava/AbstractUIDetails.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/BasicDetails.java b/src/main/java/org/scijava/BasicDetails.java
index 98884ff15..6c37807e6 100644
--- a/src/main/java/org/scijava/BasicDetails.java
+++ b/src/main/java/org/scijava/BasicDetails.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/Cancelable.java b/src/main/java/org/scijava/Cancelable.java
index fd8aae923..5bc0fe61c 100644
--- a/src/main/java/org/scijava/Cancelable.java
+++ b/src/main/java/org/scijava/Cancelable.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/Context.java b/src/main/java/org/scijava/Context.java
index c3b928c2d..bfb118099 100644
--- a/src/main/java/org/scijava/Context.java
+++ b/src/main/java/org/scijava/Context.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -36,11 +33,15 @@
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import org.scijava.event.ContextCreatedEvent;
import org.scijava.event.ContextDisposingEvent;
import org.scijava.event.EventHandler;
import org.scijava.event.EventService;
@@ -61,7 +62,7 @@
* @author Curtis Rueden
* @see Service
*/
-public class Context implements Disposable {
+public class Context implements Disposable, AutoCloseable {
// -- Constants --
@@ -75,6 +76,14 @@ public class Context implements Disposable {
*/
public static final String STRICT_PROPERTY = "scijava.context.strict";
+ /** Set of currently active (not disposed) application contexts. */
+ private static final Map CONTEXTS =
+ new ConcurrentHashMap<>(); // NB: ConcurrentHashMap disallows nulls.
+
+ // -- Static fields --
+
+ private static Thread shutdownThread = null;
+
// -- Fields --
/** Index of the application context's services. */
@@ -100,6 +109,12 @@ public class Context implements Disposable {
*/
private boolean strict;
+ /**
+ * False if the context is currently active; true if the context
+ * has already been disposed, or is in the process of being disposed.
+ */
+ private boolean disposed;
+
/**
* Creates a new SciJava application context with all available services.
*
@@ -251,6 +266,13 @@ public Context(final Collection> serviceClasses,
* those of lower priority). See {@link ServiceHelper#loadServices()} for more
* information.
*
+ *
+ * NB: Instiantiation of a Context has an implied requirement of a
+ * corresponding call to {@link Context#dispose()} at the end of the SciJava
+ * applicaton's lifecycle. This cleans up any remaining resources and allows
+ * the JVM to exit gracefully. This is called automatically when constructed as
+ * an {@link AutoCloseable}.
+ *
*
* @param serviceClasses A collection of types that implement the
* {@link Service} interface (e.g., {@code DisplayService.class}).
@@ -280,6 +302,26 @@ public Context(final Collection> serviceClasses,
new ServiceHelper(this, serviceClasses, strict);
serviceHelper.loadServices();
}
+
+ // If JVM shuts down with context still active, clean up after ourselves.
+ if (shutdownThread == null) {
+ synchronized (Context.class) {
+ if (shutdownThread == null) {
+ shutdownThread = new Thread(() -> {
+ final List contexts = new ArrayList<>(CONTEXTS.keySet());
+ for (final Context context : contexts) {
+ context.doDispose(false);
+ }
+ });
+ Runtime.getRuntime().addShutdownHook(shutdownThread);
+ }
+ }
+ }
+ CONTEXTS.put(this, true);
+
+ // Publish an event to indicate that context initialization is complete.
+ final EventService eventService = getService(EventService.class);
+ if (eventService != null) eventService.publish(new ContextCreatedEvent());
}
// -- Context methods --
@@ -414,16 +456,14 @@ public boolean isInjectable(final Class> type) {
@Override
public void dispose() {
- final EventService eventService = getService(EventService.class);
- if (eventService != null) eventService.publish(new ContextDisposingEvent());
+ doDispose(true);
+ }
- // NB: Dispose services in reverse order.
- // This may or may not actually be necessary, but seems safer, since
- // dependent services will be disposed *before* their dependencies.
- final List services = serviceIndex.getAll();
- for (int s = services.size() - 1; s >= 0; s--) {
- services.get(s).dispose();
- }
+ // -- AutoCloseable methods --
+
+ @Override
+ public void close() {
+ dispose();
}
// -- Utility methods --
@@ -440,6 +480,19 @@ public static List> serviceClassList(
Arrays.asList(serviceClasses) : Arrays.asList(Service.class);
}
+ /**
+ * Gets the class loader to use. This will be the current thread's context
+ * class loader if non-null; otherwise it will be the system class loader.
+ *
+ * @see Thread#getContextClassLoader()
+ * @see ClassLoader#getSystemClassLoader()
+ */
+ public static ClassLoader getClassLoader() {
+ final ClassLoader contextCL = Thread.currentThread()
+ .getContextClassLoader();
+ return contextCL != null ? contextCL : ClassLoader.getSystemClassLoader();
+ }
+
// -- Helper methods --
private List getParameterFields(final Object o) {
@@ -530,8 +583,7 @@ private String createMissingServiceMessage(
final Class extends Service> serviceType)
{
final String nl = System.getProperty("line.separator");
- final ClassLoader classLoader = //
- Thread.currentThread().getContextClassLoader();
+ final ClassLoader classLoader = getClassLoader();
final StringBuilder msg = new StringBuilder(
"Required service is missing: " + serviceType.getName() + nl);
msg.append("Context: " + this + nl);
@@ -557,17 +609,34 @@ private String createMissingServiceMessage(
return msg.toString();
}
+ private synchronized void doDispose(final boolean announce) {
+ if (disposed) return;
+ disposed = true;
+ CONTEXTS.remove(this);
+ if (announce) {
+ final EventService eventService = getService(EventService.class);
+ if (eventService != null) eventService.publish(new ContextDisposingEvent());
+ }
+
+ // NB: Dispose services in reverse order.
+ // This may or may not actually be necessary, but seems safer, since
+ // dependent services will be disposed *before* their dependencies.
+ final List services = serviceIndex.getAll();
+ for (int s = services.size() - 1; s >= 0; s--) {
+ services.get(s).dispose();
+ }
+ }
+
private static PluginIndex plugins(final boolean empty) {
return empty ? new PluginIndex(null) : null;
}
private static List> services(final boolean empty) {
- if (empty) return Collections.>emptyList();
- return Arrays.>asList(Service.class);
+ if (empty) return Collections.> emptyList();
+ return Arrays.> asList(Service.class);
}
private static boolean strict() {
return !"false".equals(System.getProperty(STRICT_PROPERTY));
}
-
}
diff --git a/src/main/java/org/scijava/Contextual.java b/src/main/java/org/scijava/Contextual.java
index 682abfefe..f76c7fc0d 100644
--- a/src/main/java/org/scijava/Contextual.java
+++ b/src/main/java/org/scijava/Contextual.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/Disposable.java b/src/main/java/org/scijava/Disposable.java
index 9ec7aeec2..ac72c90b4 100644
--- a/src/main/java/org/scijava/Disposable.java
+++ b/src/main/java/org/scijava/Disposable.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/Gateway.java b/src/main/java/org/scijava/Gateway.java
index 37a5b6403..7cd98413e 100644
--- a/src/main/java/org/scijava/Gateway.java
+++ b/src/main/java/org/scijava/Gateway.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -43,6 +40,7 @@
import org.scijava.input.InputService;
import org.scijava.io.IOService;
import org.scijava.io.RecentFileService;
+import org.scijava.io.location.LocationService;
import org.scijava.log.LogService;
import org.scijava.main.MainService;
import org.scijava.menu.MenuService;
@@ -120,7 +118,7 @@
* @author Mark Hiner
* @author Curtis Rueden
*/
-public interface Gateway extends RichPlugin {
+public interface Gateway extends RichPlugin, Disposable {
/**
* Perform launch operations associated with this gateway.
@@ -241,6 +239,13 @@ public interface Gateway extends RichPlugin {
*/
IOService io();
+ /**
+ * Gets this application context's {@link LocationService}.
+ *
+ * @return The {@link LocationService} of this application context.
+ */
+ LocationService location();
+
/**
* Gets this application context's {@link LogService}.
*
@@ -372,4 +377,8 @@ public interface Gateway extends RichPlugin {
/** @see org.scijava.app.App#getInfo(boolean) */
String getInfo(boolean mem);
+ @Override
+ default void dispose() {
+ context().dispose();
+ }
}
diff --git a/src/main/java/org/scijava/Identifiable.java b/src/main/java/org/scijava/Identifiable.java
index 0d88f23a4..53db16039 100644
--- a/src/main/java/org/scijava/Identifiable.java
+++ b/src/main/java/org/scijava/Identifiable.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/Initializable.java b/src/main/java/org/scijava/Initializable.java
index c29b5fb0b..56aa725ae 100644
--- a/src/main/java/org/scijava/Initializable.java
+++ b/src/main/java/org/scijava/Initializable.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/Instantiable.java b/src/main/java/org/scijava/Instantiable.java
index d67cf1298..3edca09a4 100644
--- a/src/main/java/org/scijava/Instantiable.java
+++ b/src/main/java/org/scijava/Instantiable.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/InstantiableException.java b/src/main/java/org/scijava/InstantiableException.java
index 7b1f55900..0ad031f7b 100644
--- a/src/main/java/org/scijava/InstantiableException.java
+++ b/src/main/java/org/scijava/InstantiableException.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/ItemIO.java b/src/main/java/org/scijava/ItemIO.java
index febcc8629..fa8b68684 100644
--- a/src/main/java/org/scijava/ItemIO.java
+++ b/src/main/java/org/scijava/ItemIO.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/ItemVisibility.java b/src/main/java/org/scijava/ItemVisibility.java
index da4e594d4..47897a359 100644
--- a/src/main/java/org/scijava/ItemVisibility.java
+++ b/src/main/java/org/scijava/ItemVisibility.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/Locatable.java b/src/main/java/org/scijava/Locatable.java
index c9b0e7039..a7da30625 100644
--- a/src/main/java/org/scijava/Locatable.java
+++ b/src/main/java/org/scijava/Locatable.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/MenuEntry.java b/src/main/java/org/scijava/MenuEntry.java
index e29db087b..4a2b33bb9 100644
--- a/src/main/java/org/scijava/MenuEntry.java
+++ b/src/main/java/org/scijava/MenuEntry.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/MenuPath.java b/src/main/java/org/scijava/MenuPath.java
index 26b732e17..533fd2461 100644
--- a/src/main/java/org/scijava/MenuPath.java
+++ b/src/main/java/org/scijava/MenuPath.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/Named.java b/src/main/java/org/scijava/Named.java
index f97542944..9a381ee3a 100644
--- a/src/main/java/org/scijava/Named.java
+++ b/src/main/java/org/scijava/Named.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/NoSuchServiceException.java b/src/main/java/org/scijava/NoSuchServiceException.java
index bf2bc79f6..d97d95647 100644
--- a/src/main/java/org/scijava/NoSuchServiceException.java
+++ b/src/main/java/org/scijava/NoSuchServiceException.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/NullContextException.java b/src/main/java/org/scijava/NullContextException.java
index c0509c937..794926da9 100644
--- a/src/main/java/org/scijava/NullContextException.java
+++ b/src/main/java/org/scijava/NullContextException.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/Optional.java b/src/main/java/org/scijava/Optional.java
index c96fc8892..2ab55b3c9 100644
--- a/src/main/java/org/scijava/Optional.java
+++ b/src/main/java/org/scijava/Optional.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/Prioritized.java b/src/main/java/org/scijava/Prioritized.java
index 13f6f600c..86bd0691a 100644
--- a/src/main/java/org/scijava/Prioritized.java
+++ b/src/main/java/org/scijava/Prioritized.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/Priority.java b/src/main/java/org/scijava/Priority.java
index 628904e36..69da7767e 100644
--- a/src/main/java/org/scijava/Priority.java
+++ b/src/main/java/org/scijava/Priority.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/SciJava.java b/src/main/java/org/scijava/SciJava.java
index ebf387171..81375dcd6 100644
--- a/src/main/java/org/scijava/SciJava.java
+++ b/src/main/java/org/scijava/SciJava.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -45,7 +42,7 @@
*
* @author Curtis Rueden
*/
-@Plugin(type = Gateway.class)
+@Plugin(type = Gateway.class, name = "sj")
public class SciJava extends AbstractGateway {
// -- Constructors --
@@ -113,12 +110,4 @@ public SciJava(final Collection> serviceClasses) {
public SciJava(final Context context) {
super(SciJavaApp.NAME, context);
}
-
- // -- Gateway methods --
-
- @Override
- public String getShortName() {
- return "sj";
- }
-
}
diff --git a/src/main/java/org/scijava/Typed.java b/src/main/java/org/scijava/Typed.java
index a5e28f0df..cfb55d690 100644
--- a/src/main/java/org/scijava/Typed.java
+++ b/src/main/java/org/scijava/Typed.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/UIDetails.java b/src/main/java/org/scijava/UIDetails.java
index 998742226..ccf12c261 100644
--- a/src/main/java/org/scijava/UIDetails.java
+++ b/src/main/java/org/scijava/UIDetails.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/Validated.java b/src/main/java/org/scijava/Validated.java
index efa4acf93..11835ba5c 100644
--- a/src/main/java/org/scijava/Validated.java
+++ b/src/main/java/org/scijava/Validated.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/ValidityProblem.java b/src/main/java/org/scijava/ValidityProblem.java
index 10e8bf159..782bcc642 100644
--- a/src/main/java/org/scijava/ValidityProblem.java
+++ b/src/main/java/org/scijava/ValidityProblem.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/Versioned.java b/src/main/java/org/scijava/Versioned.java
index 36aabaea6..6e746dad4 100644
--- a/src/main/java/org/scijava/Versioned.java
+++ b/src/main/java/org/scijava/Versioned.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/annotations/AbstractIndexWriter.java b/src/main/java/org/scijava/annotations/AbstractIndexWriter.java
index c87d1da55..28fe310a5 100644
--- a/src/main/java/org/scijava/annotations/AbstractIndexWriter.java
+++ b/src/main/java/org/scijava/annotations/AbstractIndexWriter.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/annotations/AnnotationCombiner.java b/src/main/java/org/scijava/annotations/AnnotationCombiner.java
index 4d399d8ea..9b152b924 100644
--- a/src/main/java/org/scijava/annotations/AnnotationCombiner.java
+++ b/src/main/java/org/scijava/annotations/AnnotationCombiner.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -43,6 +40,7 @@
import java.util.HashSet;
import java.util.Set;
+import org.scijava.Context;
import org.scijava.util.Combiner;
import org.scijava.util.FileUtils;
@@ -65,7 +63,7 @@ public void combine(File outputDirectory) throws Exception {
}
final Set annotationFiles = getAnnotationFiles();
- final ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ final ClassLoader loader = Context.getClassLoader();
log("");
log("Writing annotations to " + outputDirectory.getAbsolutePath());
@@ -92,7 +90,7 @@ public Set getAnnotationFiles() throws IOException {
for (final String prefix : new String[] { PREFIX, LEGACY_PREFIX }) {
final Enumeration directories =
- Thread.currentThread().getContextClassLoader().getResources(prefix);
+ Context.getClassLoader().getResources(prefix);
while (directories.hasMoreElements()) {
final URL url = directories.nextElement();
for (final URL annotationIndexURL : FileUtils.listContents(url)) {
diff --git a/src/main/java/org/scijava/annotations/AnnotationProcessor.java b/src/main/java/org/scijava/annotations/AnnotationProcessor.java
index 8982527e0..e17d707a9 100644
--- a/src/main/java/org/scijava/annotations/AnnotationProcessor.java
+++ b/src/main/java/org/scijava/annotations/AnnotationProcessor.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -53,7 +50,6 @@
import javax.annotation.processing.Filer;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
-import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.AnnotationValue;
@@ -72,16 +68,38 @@
import org.scijava.annotations.AbstractIndexWriter.StreamFactory;
/**
- * The annotation processor for use with Java 8 and earlier.
+ * An annotation processor for indexing {@link Indexable} annotations at
+ * compile time. The design is inspired by
+ * Sezpoz, a compile-time
+ * indexing library by Jesse Glick.
+ *
+ * For each annotated class, this processor writes a JSON record of the
+ * annotation's attributes into {@code META-INF/json/} under a file named after
+ * the annotation type. At runtime, the index can be read to discover annotated
+ * classes and inspect their annotation values without loading (and therefore
+ * initializing) those classes — avoiding the cost and side-effects of a full
+ * classpath scan.
+ *
+ *
+ * For example, SciJava Common's {@link org.scijava.plugin.Plugin} annotation
+ * enables the {@link org.scijava.Context} application container to discover
+ * and prepare the application including all its plugins without needing to
+ * load all of those plugins in advance. Rather, they can be loaded upon first
+ * use in each appropriate context, greatly reducing application startup cost.
+ *
*
* @author Johannes Schindelin
*/
-@SupportedSourceVersion(SourceVersion.RELEASE_8)
@SupportedAnnotationTypes("*")
public class AnnotationProcessor extends AbstractProcessor {
private RoundEnvironment roundEnv;
+ @Override
+ public SourceVersion getSupportedSourceVersion() {
+ return SourceVersion.latestSupported();
+ }
+
@Override
public boolean process(final Set extends TypeElement> elements,
final RoundEnvironment env)
diff --git a/src/main/java/org/scijava/annotations/ByteCodeAnalyzer.java b/src/main/java/org/scijava/annotations/ByteCodeAnalyzer.java
index 7ef216860..915d9148f 100644
--- a/src/main/java/org/scijava/annotations/ByteCodeAnalyzer.java
+++ b/src/main/java/org/scijava/annotations/ByteCodeAnalyzer.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/annotations/DirectoryIndexer.java b/src/main/java/org/scijava/annotations/DirectoryIndexer.java
index 145252203..ac6be8fcd 100644
--- a/src/main/java/org/scijava/annotations/DirectoryIndexer.java
+++ b/src/main/java/org/scijava/annotations/DirectoryIndexer.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/annotations/EclipseHelper.java b/src/main/java/org/scijava/annotations/EclipseHelper.java
index 053103e8c..67f17ff7d 100644
--- a/src/main/java/org/scijava/annotations/EclipseHelper.java
+++ b/src/main/java/org/scijava/annotations/EclipseHelper.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -43,6 +40,7 @@
import java.util.jar.JarFile;
import java.util.jar.Manifest;
+import org.scijava.Context;
import org.scijava.util.FileUtils;
/**
@@ -297,7 +295,7 @@ else if (file.isDirectory()) {
*/
public static void main(final String... args) {
System.setProperty(FORCE_ANNOTATION_INDEX_PROPERTY, "true");
- updateAnnotationIndex(Thread.currentThread().getContextClassLoader());
+ updateAnnotationIndex(Context.getClassLoader());
}
}
diff --git a/src/main/java/org/scijava/annotations/Index.java b/src/main/java/org/scijava/annotations/Index.java
index 23348cd80..244b00d37 100644
--- a/src/main/java/org/scijava/annotations/Index.java
+++ b/src/main/java/org/scijava/annotations/Index.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/annotations/IndexItem.java b/src/main/java/org/scijava/annotations/IndexItem.java
index b047e8075..e5265fc21 100644
--- a/src/main/java/org/scijava/annotations/IndexItem.java
+++ b/src/main/java/org/scijava/annotations/IndexItem.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/annotations/IndexReader.java b/src/main/java/org/scijava/annotations/IndexReader.java
index d716978ae..4eab67552 100644
--- a/src/main/java/org/scijava/annotations/IndexReader.java
+++ b/src/main/java/org/scijava/annotations/IndexReader.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/annotations/Indexable.java b/src/main/java/org/scijava/annotations/Indexable.java
index 2916d0a78..325739efd 100644
--- a/src/main/java/org/scijava/annotations/Indexable.java
+++ b/src/main/java/org/scijava/annotations/Indexable.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/annotations/legacy/LegacyReader.java b/src/main/java/org/scijava/annotations/legacy/LegacyReader.java
index 11d0929aa..9df62abcc 100644
--- a/src/main/java/org/scijava/annotations/legacy/LegacyReader.java
+++ b/src/main/java/org/scijava/annotations/legacy/LegacyReader.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/app/AbstractApp.java b/src/main/java/org/scijava/app/AbstractApp.java
index 14003cc24..33ff29ff4 100644
--- a/src/main/java/org/scijava/app/AbstractApp.java
+++ b/src/main/java/org/scijava/app/AbstractApp.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/app/App.java b/src/main/java/org/scijava/app/App.java
index 641c12778..95cf249e7 100644
--- a/src/main/java/org/scijava/app/App.java
+++ b/src/main/java/org/scijava/app/App.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -147,7 +144,7 @@ default void quit() {
/**
* Gets the version of the application.
*
*
diff --git a/src/main/java/org/scijava/app/AppService.java b/src/main/java/org/scijava/app/AppService.java
index 34c3dc4b9..2d9c7e3de 100644
--- a/src/main/java/org/scijava/app/AppService.java
+++ b/src/main/java/org/scijava/app/AppService.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/app/DefaultAppService.java b/src/main/java/org/scijava/app/DefaultAppService.java
index 918501003..9c8afc0c3 100644
--- a/src/main/java/org/scijava/app/DefaultAppService.java
+++ b/src/main/java/org/scijava/app/DefaultAppService.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/app/DefaultStatusService.java b/src/main/java/org/scijava/app/DefaultStatusService.java
index a58987ed2..1b68a27ba 100644
--- a/src/main/java/org/scijava/app/DefaultStatusService.java
+++ b/src/main/java/org/scijava/app/DefaultStatusService.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/app/SciJavaApp.java b/src/main/java/org/scijava/app/SciJavaApp.java
index 6cb97fb8b..b7604ca14 100644
--- a/src/main/java/org/scijava/app/SciJavaApp.java
+++ b/src/main/java/org/scijava/app/SciJavaApp.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/app/StatusService.java b/src/main/java/org/scijava/app/StatusService.java
index c0f20dd08..70d0edf75 100644
--- a/src/main/java/org/scijava/app/StatusService.java
+++ b/src/main/java/org/scijava/app/StatusService.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/app/event/StatusEvent.java b/src/main/java/org/scijava/app/event/StatusEvent.java
index 1866e18a6..653aefb8e 100644
--- a/src/main/java/org/scijava/app/event/StatusEvent.java
+++ b/src/main/java/org/scijava/app/event/StatusEvent.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/cache/CacheService.java b/src/main/java/org/scijava/cache/CacheService.java
index 24c592a0f..ca5808918 100644
--- a/src/main/java/org/scijava/cache/CacheService.java
+++ b/src/main/java/org/scijava/cache/CacheService.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/cache/DefaultCacheService.java b/src/main/java/org/scijava/cache/DefaultCacheService.java
index 4111a45a6..667ffdb30 100644
--- a/src/main/java/org/scijava/cache/DefaultCacheService.java
+++ b/src/main/java/org/scijava/cache/DefaultCacheService.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/command/Command.java b/src/main/java/org/scijava/command/Command.java
index 1843cf1be..17a37ebb1 100644
--- a/src/main/java/org/scijava/command/Command.java
+++ b/src/main/java/org/scijava/command/Command.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/command/CommandInfo.java b/src/main/java/org/scijava/command/CommandInfo.java
index 4acc3f163..f25c213db 100644
--- a/src/main/java/org/scijava/command/CommandInfo.java
+++ b/src/main/java/org/scijava/command/CommandInfo.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -55,6 +52,7 @@
import org.scijava.plugin.Parameter;
import org.scijava.plugin.Plugin;
import org.scijava.plugin.PluginInfo;
+import org.scijava.service.Service;
import org.scijava.util.ClassUtils;
import org.scijava.util.StringMaker;
import org.scijava.util.Types;
@@ -463,7 +461,8 @@ private void checkFields(final Class> type) {
}
final String name = f.getName();
- if (inputMap.containsKey(name) || outputMap.containsKey(name)) {
+ if ((inputMap.containsKey(name) || outputMap.containsKey(name))
+ && !Service.class.isAssignableFrom(f.getType())) {
// NB: Shadowed parameters are bad because they are ambiguous.
final String error = "Invalid duplicate parameter: " + f;
problems.add(new ValidityProblem(error));
diff --git a/src/main/java/org/scijava/command/CommandModule.java b/src/main/java/org/scijava/command/CommandModule.java
index b675c59a5..226edc678 100644
--- a/src/main/java/org/scijava/command/CommandModule.java
+++ b/src/main/java/org/scijava/command/CommandModule.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/command/CommandModuleItem.java b/src/main/java/org/scijava/command/CommandModuleItem.java
index 862bc3643..079193311 100644
--- a/src/main/java/org/scijava/command/CommandModuleItem.java
+++ b/src/main/java/org/scijava/command/CommandModuleItem.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/command/CommandService.java b/src/main/java/org/scijava/command/CommandService.java
index 589da8fe8..c1f78460c 100644
--- a/src/main/java/org/scijava/command/CommandService.java
+++ b/src/main/java/org/scijava/command/CommandService.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -53,7 +50,7 @@
* A command is a particular type of plugin that is also a
* {@link Module}; i.e., it is {@link Runnable}, with typed inputs and outputs.
*
- * The command service keeps a master index of all commands known to the system.
+ * The command service keeps a central index of all commands known to the system.
* It asks the {@link PluginService} for available commands, then takes care of
* registering them with the {@link ModuleService}.
*
diff --git a/src/main/java/org/scijava/command/ContextCommand.java b/src/main/java/org/scijava/command/ContextCommand.java
index 2754d4f7f..c40649d53 100644
--- a/src/main/java/org/scijava/command/ContextCommand.java
+++ b/src/main/java/org/scijava/command/ContextCommand.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/command/DefaultCommandService.java b/src/main/java/org/scijava/command/DefaultCommandService.java
index ca8c412d1..29756debb 100644
--- a/src/main/java/org/scijava/command/DefaultCommandService.java
+++ b/src/main/java/org/scijava/command/DefaultCommandService.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/command/DynamicCommand.java b/src/main/java/org/scijava/command/DynamicCommand.java
index b56a0bac6..5cc3ab4b1 100644
--- a/src/main/java/org/scijava/command/DynamicCommand.java
+++ b/src/main/java/org/scijava/command/DynamicCommand.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -39,7 +36,9 @@
import org.scijava.Contextual;
import org.scijava.NullContextException;
import org.scijava.module.DefaultMutableModule;
+import org.scijava.module.ModuleService;
import org.scijava.plugin.Parameter;
+import org.scijava.plugin.PluginService;
import org.scijava.util.ClassUtils;
/**
@@ -60,6 +59,12 @@ public abstract class DynamicCommand extends DefaultMutableModule implements
@Parameter
private CommandService commandService;
+ @Parameter
+ protected PluginService pluginService;
+
+ @Parameter
+ protected ModuleService moduleService;
+
private DynamicCommandInfo info;
/** Reason for cancelation, or null if not canceled. */
@@ -71,7 +76,8 @@ public abstract class DynamicCommand extends DefaultMutableModule implements
public DynamicCommandInfo getInfo() {
if (info == null) {
// NB: Create dynamic metadata lazily.
- final CommandInfo commandInfo = commandService.getCommand(getClass());
+ CommandInfo commandInfo = commandService.getCommand(getClass());
+ if (commandInfo == null) commandInfo = new CommandInfo(getClass());
info = new DynamicCommandInfo(commandInfo, getClass());
}
return info;
@@ -87,7 +93,7 @@ public Object getInput(final String name) {
@Override
public Object getOutput(final String name) {
final Field field = getInfo().getOutputField(name);
- if (field == null) return super.getInput(name);
+ if (field == null) return super.getOutput(name);
return ClassUtils.getValue(field, this);
}
@@ -144,4 +150,15 @@ public String getCancelReason() {
public void uncancel() {
cancelReason = null;
}
+
+ // -- Internal methods --
+
+ /**
+ * Persists current input values. Use e.g. for {@link InteractiveCommand}s
+ * that want to persist values as they change, since interactive commands do
+ * not complete the module execution lifecycle normally.
+ */
+ protected void saveInputs() {
+ moduleService.saveInputs(this);
+ }
}
diff --git a/src/main/java/org/scijava/command/DynamicCommandInfo.java b/src/main/java/org/scijava/command/DynamicCommandInfo.java
index a45f4b1ac..06c4a16e7 100644
--- a/src/main/java/org/scijava/command/DynamicCommandInfo.java
+++ b/src/main/java/org/scijava/command/DynamicCommandInfo.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -51,9 +48,9 @@
* Helper class for maintaining a {@link DynamicCommand}'s associated
* {@link ModuleInfo}.
*
- * The {@link CommandService} has a plain {@link CommandInfo} object in its
- * index, populated from the {@link DynamicCommand}'s @{@link Plugin}
- * annotation. So this class adapts that object, delegating to it for the
+ * This class wraps a plain {@link CommandInfo} object (e.g. from the
+ * {@link CommandService}'s index, present due to an @{@link Plugin} annotation
+ * on the {@link DynamicCommand} class), delegating to it for the
* {@link UIDetails} methods. The plain {@link CommandInfo} cannot be used
* as-is, however, because we need to override the {@link ModuleInfo} methods as
* well as provide metadata manipulation functionality such as
diff --git a/src/main/java/org/scijava/command/Inputs.java b/src/main/java/org/scijava/command/Inputs.java
new file mode 100644
index 000000000..b2f5e4217
--- /dev/null
+++ b/src/main/java/org/scijava/command/Inputs.java
@@ -0,0 +1,102 @@
+/*
+ * #%L
+ * SciJava Common shared library for SciJava software.
+ * %%
+ * Copyright (C) 2009 - 2026 SciJava developers.
+ * %%
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ * #L%
+ */
+
+package org.scijava.command;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutionException;
+
+import org.scijava.Context;
+import org.scijava.module.process.PreprocessorPlugin;
+
+/**
+ * A way to build a dynamic set of inputs, whose values are then harvested by
+ * the preprocessing framework.
+ *
+ * The {@link #run()} method of this command does nothing. If you want something
+ * custom to happen during execution, use a normal {@link Command} instead:
+ * either implement {@link Command directly}, or extend {@link ContextCommand}
+ * or {@link DynamicCommand}.
+ *
+ *
+ * @author Curtis Rueden
+ */
+public final class Inputs extends DynamicCommand {
+
+ public Inputs(final Context context) {
+ context.inject(this);
+ }
+
+ public Map harvest() {
+ try {
+ final List pre = //
+ pluginService.createInstancesOfType(PreprocessorPlugin.class);
+ return moduleService.run(this, pre, null).get().getInputs();
+ }
+ catch (final InterruptedException | ExecutionException exc) {
+ throw new RuntimeException(exc);
+ }
+ }
+}
diff --git a/src/main/java/org/scijava/command/Interactive.java b/src/main/java/org/scijava/command/Interactive.java
index 74ad4cfee..9714f4a6e 100644
--- a/src/main/java/org/scijava/command/Interactive.java
+++ b/src/main/java/org/scijava/command/Interactive.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/command/InteractiveCommand.java b/src/main/java/org/scijava/command/InteractiveCommand.java
index 117485838..b45e3f21f 100644
--- a/src/main/java/org/scijava/command/InteractiveCommand.java
+++ b/src/main/java/org/scijava/command/InteractiveCommand.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -96,6 +93,7 @@ public InteractiveCommand(final String... listenerNames) {
public void preview() {
// NB: Interactive commands call run upon any parameter change.
run();
+ saveInputs();
}
@Override
diff --git a/src/main/java/org/scijava/command/ModuleCommand.java b/src/main/java/org/scijava/command/ModuleCommand.java
index 4abc0fee1..c09ad922c 100644
--- a/src/main/java/org/scijava/command/ModuleCommand.java
+++ b/src/main/java/org/scijava/command/ModuleCommand.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/command/Previewable.java b/src/main/java/org/scijava/command/Previewable.java
index 8ee57832d..4fbeaebb9 100644
--- a/src/main/java/org/scijava/command/Previewable.java
+++ b/src/main/java/org/scijava/command/Previewable.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/command/UnimplementedCommand.java b/src/main/java/org/scijava/command/UnimplementedCommand.java
index 74530bcec..f1103751a 100644
--- a/src/main/java/org/scijava/command/UnimplementedCommand.java
+++ b/src/main/java/org/scijava/command/UnimplementedCommand.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/command/console/RunArgument.java b/src/main/java/org/scijava/command/console/RunArgument.java
index a6673e243..b2529d279 100644
--- a/src/main/java/org/scijava/command/console/RunArgument.java
+++ b/src/main/java/org/scijava/command/console/RunArgument.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/command/run/CommandCodeRunner.java b/src/main/java/org/scijava/command/run/CommandCodeRunner.java
index 25024e0da..bc8550275 100644
--- a/src/main/java/org/scijava/command/run/CommandCodeRunner.java
+++ b/src/main/java/org/scijava/command/run/CommandCodeRunner.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/console/AbstractConsoleArgument.java b/src/main/java/org/scijava/console/AbstractConsoleArgument.java
index cde13bf0d..76040544d 100644
--- a/src/main/java/org/scijava/console/AbstractConsoleArgument.java
+++ b/src/main/java/org/scijava/console/AbstractConsoleArgument.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/console/ConsoleArgument.java b/src/main/java/org/scijava/console/ConsoleArgument.java
index 4e645ced5..44d058211 100644
--- a/src/main/java/org/scijava/console/ConsoleArgument.java
+++ b/src/main/java/org/scijava/console/ConsoleArgument.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/console/ConsoleService.java b/src/main/java/org/scijava/console/ConsoleService.java
index f5bd055a8..3003892a4 100644
--- a/src/main/java/org/scijava/console/ConsoleService.java
+++ b/src/main/java/org/scijava/console/ConsoleService.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/console/ConsoleUtils.java b/src/main/java/org/scijava/console/ConsoleUtils.java
index 6b366a860..2f62f0c14 100644
--- a/src/main/java/org/scijava/console/ConsoleUtils.java
+++ b/src/main/java/org/scijava/console/ConsoleUtils.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/console/DefaultConsoleService.java b/src/main/java/org/scijava/console/DefaultConsoleService.java
index 8783e1eb9..b3a1ef64b 100644
--- a/src/main/java/org/scijava/console/DefaultConsoleService.java
+++ b/src/main/java/org/scijava/console/DefaultConsoleService.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/console/MultiOutputStream.java b/src/main/java/org/scijava/console/MultiOutputStream.java
index d1f380f20..a8d8238fd 100644
--- a/src/main/java/org/scijava/console/MultiOutputStream.java
+++ b/src/main/java/org/scijava/console/MultiOutputStream.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/console/MultiPrintStream.java b/src/main/java/org/scijava/console/MultiPrintStream.java
index 659f52b9f..c27df7e9b 100644
--- a/src/main/java/org/scijava/console/MultiPrintStream.java
+++ b/src/main/java/org/scijava/console/MultiPrintStream.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/console/OutputEvent.java b/src/main/java/org/scijava/console/OutputEvent.java
index 663d51de7..c408bcaa3 100644
--- a/src/main/java/org/scijava/console/OutputEvent.java
+++ b/src/main/java/org/scijava/console/OutputEvent.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/console/OutputListener.java b/src/main/java/org/scijava/console/OutputListener.java
index f3657c1ca..b1543d339 100644
--- a/src/main/java/org/scijava/console/OutputListener.java
+++ b/src/main/java/org/scijava/console/OutputListener.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/java/org/scijava/console/SystemPropertyArgument.java b/src/main/java/org/scijava/console/SystemPropertyArgument.java
index c174d5aec..33ba2771f 100644
--- a/src/main/java/org/scijava/console/SystemPropertyArgument.java
+++ b/src/main/java/org/scijava/console/SystemPropertyArgument.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -47,7 +44,7 @@
@Plugin(type = ConsoleArgument.class)
public class SystemPropertyArgument extends AbstractConsoleArgument {
- private static final String SYS_PROP_REGEX = "-D([\\w\\._-]+)(=(.*))?";
+ private static final String SYS_PROP_REGEX = "-D([^=]+)(=(.*))?";
private static final Pattern SYS_PROP_PAT = Pattern.compile(SYS_PROP_REGEX);
// -- Constructor --
diff --git a/src/main/java/org/scijava/convert/AbstractConvertService.java b/src/main/java/org/scijava/convert/AbstractConvertService.java
index b15c52de0..c3a56ae47 100644
--- a/src/main/java/org/scijava/convert/AbstractConvertService.java
+++ b/src/main/java/org/scijava/convert/AbstractConvertService.java
@@ -2,10 +2,7 @@
* #%L
* SciJava Common shared library for SciJava software.
* %%
- * Copyright (C) 2009 - 2017 Board of Regents of the University of
- * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck
- * Institute of Molecular Cell Biology and Genetics, University of
- * Konstanz, and KNIME GmbH.
+ * Copyright (C) 2009 - 2026 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -32,145 +29,16 @@
package org.scijava.convert;
-import java.lang.reflect.Type;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
import org.scijava.plugin.AbstractHandlerService;
-import org.scijava.util.ConversionUtils;
/**
- * Abstract superclass for {@link ConvertService} implementations. Sets this
- * service as the active delegate service in {@link ConversionUtils}.
+ * Abstract superclass for {@link ConvertService} implementations.
*
* @author Mark Hiner
*/
-public abstract class AbstractConvertService extends AbstractHandlerService>
- implements ConvertService {
-
- // -- ConversionService methods --
- @SuppressWarnings({ "unchecked", "rawtypes" })
- @Override
- public Class> getPluginType() {
- return (Class) Converter.class;
- }
-
- @Override
- public Class getType() {
- return ConversionRequest.class;
- }
-
- @Override
- public Converter, ?> getHandler(final Object src, final Class> dest) {
- return getHandler(new ConversionRequest(src, dest));
- }
-
- @Override
- public Converter, ?> getHandler(final Class> src, final Class> dest) {
- return getHandler(new ConversionRequest(src, dest));
- }
-
- @Override
- public Converter, ?> getHandler(final Object src, final Type dest) {
- return getHandler(new ConversionRequest(src, dest));
- }
-
- @Override
- public Converter, ?> getHandler(final Class> src, final Type dest) {
- return getHandler(new ConversionRequest(src, dest));
- }
-
- @Override
- public boolean supports(final Object src, final Class> dest) {
- return supports(new ConversionRequest(src, dest));
- }
-
- @Override
- public boolean supports(final Class> src, final Class> dest) {
- return supports(new ConversionRequest(src, dest));
- }
-
- @Override
- public boolean supports(final Object src, final Type dest) {
- return supports(new ConversionRequest(src, dest));
- }
-
- @Override
- public boolean supports(final Class> src, final Type dest) {
- return supports(new ConversionRequest(src, dest));
- }
-
- @Override
- public Collection