The TypeMetadata class can be used to attach additional information to javac types. There is support for comparing types with metadata (namely, equalsNoMetadata) which is correctly used in all type routines (e.g. subtyping) - making this an excellent candidate to handle all side-data in a centralized fashion.
Unfortunately, the type metadata API is not very friendly to use - it acts as a map, and you can only add to it by "combining" new metadata in. This parts feels slightly over-designed.
A simpler approach is possible where TypeMetadata is just a marker interface for metadata-like stuff (e.g. records). Then a type just keeps track of the list of metadata objects attached to it.