Uploaded image for project: 'UIMA'
  1. UIMA
  2. UIMA-4669

UV3 Internal - change some APIs to return more specific subclass

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • Core Java Framework
    • None

    Description

      A method which always returns an instance of class C can be specified in the API to return an instance of C or any of its superclasses. Change the return type to be C instead of one of the superclasses, because

      • the user who is expecting the supertype will still work and cost nothing (a "Widening Reference Conversion")
      • users who need the subtype would otherwise need to cast back to the subtype - which is a runtime check (unless the JIT can optimize this away).

      Attachments

        Activity

          People

            Unassigned Unassigned
            schor Marshall Schor
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: