You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Dawid Weiss (JIRA)" <ji...@apache.org> on 2015/07/17 14:31:04 UTC

[jira] [Updated] (LUCENE-6225) Clarify documentation of clone() in IndexInput

     [ https://issues.apache.org/jira/browse/LUCENE-6225?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dawid Weiss updated LUCENE-6225:
--------------------------------
    Attachment: LUCENE-6225.patch

> Clarify documentation of clone() in IndexInput
> ----------------------------------------------
>
>                 Key: LUCENE-6225
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6225
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Dawid Weiss
>            Assignee: Dawid Weiss
>            Priority: Minor
>             Fix For: Trunk
>
>         Attachments: LUCENE-6225.patch
>
>
> Here is a snippet from IndexInput's documentation:
> {code}
> The original instance must take care that cloned instances throw AlreadyClosedException when the original one is closed.
> {code}
> But concrete implementations don't throw this AlreadyClosedException (this would break the contract on Closeable). For example, see NIOFSDirectory:
> {code}
>     public void close() throws IOException {
>       if (!isClone) {
>         channel.close();
>       }
>     }
> {code}
> 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?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org