Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8303820

Simplify type metadata

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 21
    • 21
    • tools
    • None
    • b14

      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.

            mcimadamore Maurizio Cimadamore
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: