Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-6225

Clarify documentation of clone() in IndexInput

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.3, 6.0
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      Here is a snippet from IndexInput's documentation:

      The original instance must take care that cloned instances throw AlreadyClosedException when the original one is closed.
      

      But concrete implementations don't throw this AlreadyClosedException (this would break the contract on Closeable). For example, see NIOFSDirectory:

          public void close() throws IOException {
            if (!isClone) {
              channel.close();
            }
          }
      

      What trapped me was that the abstract class IndexInput overrides the default implementation of clone(), but doesn't do anything useful... I guess you could make it final and provide the tracking for cloned instances in this class rather than reimplementing it everywhere else (isCloned() would be a superclass method then too). Thoughts?

        Attachments

          Activity

            People

            • Assignee:
              dweiss Dawid Weiss
              Reporter:
              dweiss Dawid Weiss
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: