Skip to content
This repository was archived by the owner on Jun 26, 2026. It is now read-only.

Repository files navigation

junreachable

Maven Central Maven Central (snapshot) Codecov Java Version

com.io7m.junreachable

JVM Platform Status
OpenJDK (Temurin) Current Linux Build (OpenJDK (Temurin) Current, Linux)
OpenJDK (Temurin) LTS Linux Build (OpenJDK (Temurin) LTS, Linux)
OpenJDK (Temurin) Current Windows Build (OpenJDK (Temurin) Current, Windows)
OpenJDK (Temurin) LTS Windows Build (OpenJDK (Temurin) LTS, Windows)

Repository Relocation

Development of this project has moved to an open-source but not open-contribution model.

Source code and commits will remain publicly available perpetually, but issues and/or pull requests will be rejected and/or ignored. Additionally, this project will now only be available via a read-only mirror at:

https://codeberg.org/io7m-com/junreachable

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.

About

Exception types for marking unreachable/unimplemented code

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages