A zero-dependency Java library for resolving and reifying generic type information from classes, interfaces, lambdas, and methods.
TypeTools is a Java library that provides utilities for resolving and reifying generic type information at runtime. It solves Java's type erasure problem by allowing developers to access fully resolved type parameters from classes, interfaces, lambda expressions, and methods, enabling type-safe generic abstractions.
Java developers building generic libraries, frameworks, or applications that require runtime type information, such as ORM layers, dependency injection containers, or serialization libraries.
Developers choose TypeTools for its zero-dependency simplicity, comprehensive support for Java generics including lambdas, and its ability to resolve type arguments that Java's reflection API cannot handle natively.
Tools for working with generic types
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Has no external dependencies, making it easy to integrate without version conflicts or bloat, as emphasized in the minimalist design philosophy.
Resolves generic types from classes, interfaces, lambdas, and method references, demonstrated in examples like resolving Function and Comparator type arguments.
Specifically handles type argument resolution for lambda expressions and method references in JDK 8 and 9, a feature highlighted in the README's examples and notes.
Includes optional weak caching of resolved types to improve performance, configurable via enableCache/disableCache methods as described in additional features.
Simplifies patterns like generic DAOs by automatically resolving type parameters, shown in the DeviceDAO example for persistent and ID classes.
Only supports Oracle and Open JDK 8-9 for lambda resolution, and cannot resolve type parameters unused in functional interface method signatures, returning Unknown.class as admitted in the notes.
Requires manual export of sun.reflect package in OSGi environments for lambda support, adding deployment complexity that the README explicitly warns about.
Relies on Java reflection, which can introduce performance overhead and may be restricted in environments with strict security policies or older Android versions.