All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Add
DefaultProblemMapperto replaceAbstractProblemMapperandProblemMapper.create(). - Add
StatusTitleResolverSPI to allow users to provide custom resolution ofstatuscode intotitle. To be used with HTTP status enums depending on the user's framework. - Add
ProblemSupportfor common utilities.
- Make all methods in
Problem,ProblemBuilderandProblemContextinterfaces non-default. - Make
Problem.Extensionnot extendMap.Entryand instead be a simple data class withnameandvalueproperties. - Reorganize interface
defaultmethods.
- Remove deprecated methods from
ProblemBuilder. - Minify number of methods in
Problem- plaingetExtensions()returningMap<String, Object>is enough. - Remove deprecated
ProblemStatusenum from public API. The resolution ofstatuscode intotitleis still supported and available for extension viaStatusTitleResolverSPI. - Remove
AbstractProblemclass - useProblemobjects created viaProblem.builder()or static factory methods. Custom implementations ofProblemcan be created by implementing theProbleminterface. - Remove
AbstractProblemBuilderclass - useProblem.builder()static method to get default builder implementation. Custom implementations ofProblemBuildercan be created by implementing theProblemBuilderinterface. - Remove
AbstractProblemContextclass - useProblemContextobjects created viaProblemContext.create()static method. Custom implementations ofProblemContextcan be created by implementing theProblemContextinterface. - Remove
AbstractProblemMapperclass - useDefaultProblemMapperinstead.
- Deprecate
ProblemStatusenum (see JavaDocs for details).
- Make
ProblemBuilderremove extension member ifnullvalues is passed, instead of silently ignoring it and keeping the previous value. - Cleanup
defaultmethods inProblemBuilderinterface.
- Change type from
Objectto? extends Objectfor generics in method arguments to support covariant arguments.
- Add various static
Problem.of(...)factory methods for in-place creation convenience. - Add support for JSpecify annotations for nullability and Kotlin interop.
- Add support for Java Platform Module System if using Java version 9+, due to producing multi-release JAR
artifacts.
module org.example.project { requires io.github.problem4j.core; }
- Pull back from the idea of returning JSON-alike strings in
toString()methods of this library's classes. While it was nice, sinceContent-Typeis namedapplication/problem+json, these strings were not 100% valid JSONs in all scenarios, and it could be tempting to use it as a response body somewhere. Instead of that,toStringmethods will now produce strings that are simple, useful for logging/debugging and JSON representations should be delegated tojackson-databindandproblem4j-jackson, or any other library that may be supported in the future. - Seal the contract between
toProblemBuildermethod overloading inAbstractProblemMapperby making one methodfinal. Any extensions this logic should be performed by overriding the second method as the first one must only delegate to it.@Override public final ProblemBuilder toProblemBuilder(Throwable t) { return toProblemBuilder(t, null); } @Override public ProblemBuilder toProblemBuilder(Throwable t, ProblemContext context) { // ...
- Re-use instance of default implementation of
ProblemMapperreturned byProblemMapper.create(), because it's thread-safe, stateless and immutable. - Make resolution of deprecated HTTP status codes in
ProblemStatuslazy, by delegating to nested class. - Apply minor improvements to JavaDocs.
- Resolve confusing naming of
ProblemBuilderinterface methods having singular naming, but actually taking plural arguments (and deprecate old ones). - Apply minor fixes in JavaDocs,
toStringand exception messages.
- Override
toStringinAbstractProblemBuilder(probably won't be used but useful in debug mode). - Unify
toStringoverrides ofAbstractProblem,AbstractProblemBuilderandAbstractProblemContextto return output in similar style. - Finalize missing JavaDocs (and fix various existing) - all
publicclasses and methods now have proper JavaDocs. - Annotate
ProblemMappingwith@Documentedso it will appear in JavaDocs.
- Use
HashMapinstead ofLinkedHashMapforAbstractProblemBuilder, as order of insertion of extension members does not matter.
This release of problem4j-core is considered a first "public" release, so the entry aggregates changes from the
v1.0.x to v1.2.x release lines into single entry.
- Add
Problem,ProblemBuilderinterfaces with staticProblem.builder()method for fluent construction ofProblemobjects using default builder implementation. - Add
ProblemExceptionclass as a dedicated unchecked exception for error handling. - Add
@ProblemMappingannotation andProblemMapper(with abstract base implementation) to allow declarative approach in converting exception instances intoProblemobjects with staticProblemMapper.create()to get its default implementation. - All interfaces provided by this library have abstract implementations that can be extended or used as-is, so users can choose to implement their own or use the provided ones.