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
new file mode 100644
index 000000000..5b605b01d
--- /dev/null
+++ b/NOTICE.txt
@@ -0,0 +1,207 @@
+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,
+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
+ https://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [2012] [MOJO Codehaus]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ 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,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
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 7029accf9..771234c9d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,16 +1,16 @@
-
+4.0.0org.scijavapom-scijava
- 17.1.1
+ 44.0.0scijava-common
- 2.69.1-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,39 +187,32 @@ Konstanz, and KNIME GmbH.
parsington
-
-
- com.googlecode.gentyref
- gentyref
- 1.1.0
-
-
- org.bushe
- eventbus
- 1.4
-
-
junitjunittest
+
+ org.mockito
+ mockito-core
+ test
+
-
+
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 8b686230a..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,10 +52,12 @@
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;
import org.scijava.service.Service;
+import org.scijava.startup.StartupService;
import org.scijava.text.TextService;
import org.scijava.thread.ThreadService;
import org.scijava.tool.IconService;
@@ -85,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 --
@@ -102,6 +110,9 @@ public void launch(final String... args) {
// NB: When running headless, the HeadlessUI will be used.
if (mainCount == 0) ui().showUI();
+ // perform all pending startup operations
+ startup().executeOperations();
+
if (ui().isHeadless()) {
// now that CLI processing/execution is done, we can shut down
getContext().dispose();
@@ -110,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();
}
@@ -178,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() {
@@ -233,6 +251,11 @@ public ScriptService script() {
return get(ScriptService.class);
}
+ @Override
+ public StartupService startup() {
+ return get(StartupService.class);
+ }
+
@Override
public StatusService status() {
return get(StatusService.class);
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 a240ff78e..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;
@@ -52,6 +53,7 @@
import org.scijava.service.ServiceIndex;
import org.scijava.util.ClassUtils;
import org.scijava.util.Query;
+import org.scijava.util.Types;
/**
* Top-level SciJava application context, which initializes and maintains a list
@@ -60,7 +62,7 @@
* @author Curtis Rueden
* @see Service
*/
-public class Context implements Disposable {
+public class Context implements Disposable, AutoCloseable {
// -- Constants --
@@ -74,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. */
@@ -99,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.
*
@@ -250,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}).
@@ -279,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 --
@@ -323,7 +366,7 @@ public S service(final Class c) {
* service.
*/
public Service service(final String className) {
- final Class> c = ClassUtils.loadClass(className, false);
+ final Class> c = Types.load(className, false);
if (!Service.class.isAssignableFrom(c)) {
throw new IllegalArgumentException("Not a service class: " + c.getName());
}
@@ -342,7 +385,7 @@ public S getService(final Class c) {
/** Gets the service of the given class name (useful for scripts). */
public Service getService(final String className) {
- final Class> c = ClassUtils.loadClass(className);
+ final Class> c = Types.load(className);
if (c == null) return null;
if (!Service.class.isAssignableFrom(c)) return null; // not a service class
@SuppressWarnings("unchecked")
@@ -413,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 --
@@ -439,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) {
@@ -529,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);
@@ -556,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 2b5633aa9..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;
@@ -56,6 +54,7 @@
import org.scijava.plugin.RichPlugin;
import org.scijava.script.ScriptService;
import org.scijava.service.Service;
+import org.scijava.startup.StartupService;
import org.scijava.text.TextService;
import org.scijava.thread.ThreadService;
import org.scijava.tool.IconService;
@@ -119,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.
@@ -240,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}.
*
@@ -311,6 +317,13 @@ public interface Gateway extends RichPlugin {
*/
ScriptService script();
+ /**
+ * Gets this application context's {@link StartupService}.
+ *
+ * @return The {@link StartupService} of this application context.
+ */
+ StartupService startup();
+
/**
* Gets this application context's {@link StatusService}.
*
@@ -364,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 a10968865..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:
@@ -34,7 +31,7 @@
import java.net.URL;
-import org.scijava.util.ClassUtils;
+import org.scijava.util.Types;
/**
* An object whose location is defined by a URL string.
@@ -45,7 +42,7 @@ public interface Locatable {
/** Gets the URL string defining the object's location. */
default String getLocation() {
- final URL location = ClassUtils.getLocation(getClass());
+ final URL location = Types.location(getClass());
return location == null ? null : location.toExternalForm();
}
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 4a7907a1b..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:
@@ -40,6 +37,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
+import java.nio.file.NoSuchFileException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -52,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;
@@ -71,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)
@@ -234,7 +253,7 @@ public InputStream openInput(final String annotationName)
return filer.getResource(StandardLocation.CLASS_OUTPUT, "",
Index.INDEX_PREFIX + annotationName).openInputStream();
}
- catch (final FileNotFoundException e) {
+ catch (final FileNotFoundException | NoSuchFileException e) {
return null;
}
}
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 2efbe2c38..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,8 +52,10 @@
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;
/**
* A collection of metadata about a particular {@link Command}.
@@ -462,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));
@@ -502,8 +502,7 @@ private void checkFields(final Class> type) {
private boolean isImmutable(final Class> type) {
// NB: All eight primitive types, as well as the boxed primitive
// wrapper classes, as well as strings, are immutable objects.
- return ClassUtils.isNumber(type) || ClassUtils.isText(type) ||
- ClassUtils.isBoolean(type);
+ return Types.isNumber(type) || Types.isText(type) || Types.isBoolean(type);
}
private Class> loadCommandClass() {
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 01bc4d1af..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:
@@ -46,7 +43,7 @@
import org.scijava.plugin.Attr;
import org.scijava.plugin.Parameter;
import org.scijava.util.ConversionUtils;
-import org.scijava.util.GenericUtils;
+import org.scijava.util.Types;
/**
* {@link ModuleItem} implementation describing an input or output of a command.
@@ -76,8 +73,7 @@ public Parameter getParameter() {
@Override
public Class getType() {
- final Class> type =
- GenericUtils.getFieldClasses(field, getDelegateClass()).get(0);
+ final Class> type = Types.raw(Types.fieldType(field, getDelegateClass()));
@SuppressWarnings("unchecked")
final Class typedType = (Class) type;
return typedType;
@@ -85,7 +81,7 @@ public Class getType() {
@Override
public Type getGenericType() {
- return GenericUtils.getFieldType(field, getDelegateClass());
+ return Types.fieldType(field, getDelegateClass());
}
@Override
@@ -254,7 +250,7 @@ private T tValue(final String value) {
private D tValue(final String value, final Class type) {
if (value == null || value.isEmpty()) return null;
- final Class saneType = ConversionUtils.getNonprimitiveType(type);
+ final Class saneType = Types.box(type);
return ConversionUtils.convert(value, saneType);
}
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