\item There must be evidence that the project follows business-oriented conventions.
This excludes amateur or personal projects that might have fewer design pattern applications due to their nature.
\item Repository data, documentation, and comments must be written in English. Many repositories that are at the top of the search results provided by the hard requirements are not in English, and this drastically hampers our ability to understand the code;
\item The artifact the project produces must not rely on external components and have a streamlined build process, with all code stored in a single Maven/Gradle module. This improves our ability to tinker with the project more quickly and the pattern detection process, which requires all \textit{.class} files related to the project to be stored in a single directory tree.
Additionally, instead of querying GitHub directly for projects, we decided to see if libraries we knew already in our Java development career would match the hard and soft requirements we set for ourselves.
\item[vavr-io/vavr] a Java library for functional programming, was discarded as the project is less than 20.000 lines of code and does not meet the rigid requirements;
\item[bitcoin4j/bitcoin4j] a Java implementation of the bitcoin protocol, discarded as the project is distributed in several subprojects, and therefore the build process is nontrivial;
\item[FasterXML/jackson-core] is the core ''module`` of a Java JSON serialization and deserialization library. We chose this project because it meets the selection criteria. It does not rely on external components for its execution. Finally, the project structure uses a single Maven module for its sources and is thus easy to analyze.
As mentioned, Jackson is a library that offers serialization and deserialization capabilities in JSON format. It is highly extensible and customizable through a robust but flexible API. The library is divided into what the Jackson developers call “modules,” i.e., plug-ins that can augment the serialization and deserialization process. Some modules, like the \textit{jackson-dataformat-xml} module, target different encoding languages like XML.
as a pattern detection tool. This tool needs to be compiled \textit{.class} files to perform analysis.
Therefore, as \textit{jackson-core} is a standard Maven project, we compile the sources using the command mvn clean compile.
The \textit{pom.xml} of the library specifies Java 1.6 as a build target, which is not supported by JDK 17 or above. We used JDK 11 instead, as it is the previous LTS version.
Ensure a class only has one instance and provide a global point of access to it.
The tool found thirteen instances with the Singleton pattern.
Doing a deeper analysis of the found instances, we discovered that some results are false positives.
Example, \textit{com.fasterxml.jackson.core.sym.Name1} has a private package constructor and a public static final instance of it, but reading the documentation, the class represents (short) JSON string literals and is initialized by client code.
util.DefaultPrettyPrinter\$FixedSpaceIndenter] is not a singleton (detected cause of "convenient" default instance given as static final field), the constructor is not used, but the class is extensible
\item[JsonPointer, filter.TokenFilter] is like the above, but constructors are protected
\textbf{JsonGenerator} is a factory for JsonParser and JsonGenerator objects, although two overloaded factory methods exist on this class (one for each class) catering to a different combination of arguments.
A concrete implementation of this factory is included in the form of the \textbf{JsonFactory} class, although other modules may add additional implementations to cater to different encodings (like the \textit{jackson-dataformat-xml} module for XML);
\item[TSFBuilder] which is also a factory for concrete implementations of \textbf{TokenStreamFactory} allows slight changes in the serialization and deserialization rules (e.g., changing the quote character used in JSON keys from " to '). Like TokenStreamFactory, this class is only implemented by one class, JsonFactoryBuilder, within this module's scope. Moreover, as mentioned previously, this abstract factory will likely be extended by concrete implementations in other Jackson modules.
\textit{Pattern4J}, as the analysis output does not mention the pattern, even to report that no instances of it have been found (as is the case with other patterns, e.g., the observer pattern).
A manual search in the source code produced the following results:
\item[TSFBuilder] is also a builder other than an abstract factory. As mentioned previously, this class allows slightly altering the serialization and deserialization rules used to build outputting JsonFactory objects. Each rule is represented by an object or enum instance implementing the util.JacksonFeature interface. TSFBuilder then provides several overloaded methods to enable and disable features represented by the interface. Enabled features are stored in several bitmask-protected int fields, which are then directly accessed by the constructor of the TokenStreamFactory concrete implementation to build;