junreachable
The junreachable
package implements a set of exception types for
unambiguously marking code that is supposed to be unreachable (but that the
compiler cannot prove is unreachable).
Status
As the Java platform evolves, libraries that may have been necessary in the
past can become unnecessary due to new platform features. The junreachable
package falls into this category: There are now far fewer instances in the
Java language where the compiler cannot determine that a given section of
code is unreachable. In particular, switch expressions and sealed types
eliminate many of the situations where unreachable code had to be explicitly
marked.
This package is in maintenance mode and will not see any new functionality.
Features
- Exceptions for marking unreachable code.
- High coverage test suite.
- OSGi-ready
- JPMS-ready
- ISC license.
Usage
Throw the UnreachableCodeException
exception at lines of code that are
expected to be unreachable, but that the compiler cannot prove are really
unreachable. If this exception ends up being thrown, it will unambiguously
signal that the code wasn't as unreachable as the developer thought; this
is clearly a bug.
Throw the UnimplementedCodeException
exception at lines of code that have
yet to contain real implementations. If this exception ends up being thrown,
it is immediately clear to users and developers alike what happened: The user
tried to use some part of the code that hasn't yet been properly implemented.
Releases & Development Snapshots
Releases
You can subscribe to the atom feed to be notified of project releases.
The most recently released version of the package is 4.0.2.
4.0.2 Release (2024-05-05Z)
- Fix accidental upgrade to JDK 21.
The compiled artifacts for the release (and all previous releases) are available on Maven Central.
Maven Modules
<dependency> <group>com.io7m.junreachable</group> <artifactId>com.io7m.junreachable.core</artifactId> <version>4.0.2</version> </dependency><dependency> <group>com.io7m.junreachable</group> <artifactId>com.io7m.junreachable.tests</artifactId> <version>4.0.2</version> </dependency>
Previous Releases
The changelogs for the most recent previous releases are as follows:
4.0.1 Release (2024-05-05Z)
- Refresh build metadata and move to new organization.
4.0.0 Release (2022-04-09Z)
- Require JDK 17 (Backwards incompatible)
3.0.0 Release (2019-06-23Z)
- Removed the com.io7m.junreachable.checkstyle module in favour of the common com.io7m.checkstyle_rules module (Backwards incompatible)
- Require JDK 11 (Backwards incompatible)
2.1.1 Release (2018-05-13Z)
- Correctly update version in POM
Development Snapshots
At the time of writing, the current unstable development version of the package is 4.0.2.
Development snapshots may be available in the Central Portal Snapshots repository. Snapshots are published to this repository every time the project is built by the project's continuous integration system, but snapshots do expire after around ninety days and so may or may not be available depending on when a build of the package was last triggered.
Manual
This project does not have any user manuals or other documentation beyond what might be present on the page above.
Sources
This project uses Git to manage source code.
Repository: https://www.github.com/io7m-com/junreachable
$ git clone --recursive https://www.github.com/io7m-com/junreachable
Issues
This project uses GitHub Issues to track issues.
License
Copyright © 2023 Mark Raynsford <code@io7m.com> https://www.io7m.com Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.