You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "René Treffer (JIRA)" <ji...@apache.org> on 2010/12/04 23:15:11 UTC

[jira] Created: (LUCENE-2799) MMapDirectory not designed for inheritance

MMapDirectory not designed for inheritance
------------------------------------------

                 Key: LUCENE-2799
                 URL: https://issues.apache.org/jira/browse/LUCENE-2799
             Project: Lucene - Java
          Issue Type: Improvement
          Components: Store
    Affects Versions: 3.0.3
            Reporter: René Treffer


How to reproduce

Try to inherit from MMapDirectory to change the openInput logic (open files from different directories).

Expected result:

Inherit from MMapDirectory, overwrite the one method, done.

Actual result:

It's impossible to overwrite the method as the inner classes would be missing. It's impossible to fork the inner classes as they depend on a final method with default visibility (cleanMapping).
It turns out to be the easiest option to completely for the code and replace just the method in question.

Possible fix:

Change the visibility of most members and subtypes to be at least protected and avoid the default visibility.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2799) MMapDirectory not designed for inheritance

Posted by "Earwin Burrfoot (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12966865#action_12966865 ] 

Earwin Burrfoot commented on LUCENE-2799:
-----------------------------------------

I think it's always best to copy-paste stuff to your project and adapt it, in such cases.
It's simple, it doesn't break when you upgrade, it works with clumsily-built code.

Designing actual classes (not API interfaces, but fullblown working code) for inheritance is _very_ complex. I've seen few people trying this for real, and even fewer succeeding.

> MMapDirectory not designed for inheritance
> ------------------------------------------
>
>                 Key: LUCENE-2799
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2799
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Store
>    Affects Versions: 3.0.3
>            Reporter: René Treffer
>
> How to reproduce
> Try to inherit from MMapDirectory to change the openInput logic (open files from different directories).
> Expected result:
> Inherit from MMapDirectory, overwrite the one method, done.
> Actual result:
> It's impossible to overwrite the method as the inner classes would be missing. It's impossible to fork the inner classes as they depend on a final method with default visibility (cleanMapping).
> It turns out to be the easiest option to completely for the code and replace just the method in question.
> Possible fix:
> Change the visibility of most members and subtypes to be at least protected and avoid the default visibility.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2799) MMapDirectory not designed for inheritance

Posted by "René Treffer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12966866#action_12966866 ] 

René Treffer commented on LUCENE-2799:
--------------------------------------

Ah, right, but FileSwitchDirectory won't solve my problems either as every file is in a different directory. A set of MMapDirectories + delegation might help here.

But it would still be nice if MMapDirectory would either be final or extension safe. Or if the implicit no-exension policy of openInput would be made explicit with a final tag.

> MMapDirectory not designed for inheritance
> ------------------------------------------
>
>                 Key: LUCENE-2799
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2799
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Store
>    Affects Versions: 3.0.3
>            Reporter: René Treffer
>
> How to reproduce
> Try to inherit from MMapDirectory to change the openInput logic (open files from different directories).
> Expected result:
> Inherit from MMapDirectory, overwrite the one method, done.
> Actual result:
> It's impossible to overwrite the method as the inner classes would be missing. It's impossible to fork the inner classes as they depend on a final method with default visibility (cleanMapping).
> It turns out to be the easiest option to completely for the code and replace just the method in question.
> Possible fix:
> Change the visibility of most members and subtypes to be at least protected and avoid the default visibility.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2799) MMapDirectory not designed for inheritance

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12966864#action_12966864 ] 

Uwe Schindler commented on LUCENE-2799:
---------------------------------------

To change the openIngs logic to map special files to other directories use e.g. FileSwitchDirectory or similar implementations sign the delegate pattern. There is no need to extend MMapDirectory.

> MMapDirectory not designed for inheritance
> ------------------------------------------
>
>                 Key: LUCENE-2799
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2799
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Store
>    Affects Versions: 3.0.3
>            Reporter: René Treffer
>
> How to reproduce
> Try to inherit from MMapDirectory to change the openInput logic (open files from different directories).
> Expected result:
> Inherit from MMapDirectory, overwrite the one method, done.
> Actual result:
> It's impossible to overwrite the method as the inner classes would be missing. It's impossible to fork the inner classes as they depend on a final method with default visibility (cleanMapping).
> It turns out to be the easiest option to completely for the code and replace just the method in question.
> Possible fix:
> Change the visibility of most members and subtypes to be at least protected and avoid the default visibility.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Issue Comment Edited: (LUCENE-2799) MMapDirectory not designed for inheritance

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12966864#action_12966864 ] 

Uwe Schindler edited comment on LUCENE-2799 at 12/4/10 5:22 PM:
----------------------------------------------------------------

To change the openInput logic to map special files to other directories use e.g. FileSwitchDirectory or similar implementations with the delegation pattern. There is no need to extend MMapDirectory.

      was (Author: thetaphi):
    To change the openIngs logic to map special files to other directories use e.g. FileSwitchDirectory or similar implementations sign the delegate pattern. There is no need to extend MMapDirectory.
  
> MMapDirectory not designed for inheritance
> ------------------------------------------
>
>                 Key: LUCENE-2799
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2799
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Store
>    Affects Versions: 3.0.3
>            Reporter: René Treffer
>
> How to reproduce
> Try to inherit from MMapDirectory to change the openInput logic (open files from different directories).
> Expected result:
> Inherit from MMapDirectory, overwrite the one method, done.
> Actual result:
> It's impossible to overwrite the method as the inner classes would be missing. It's impossible to fork the inner classes as they depend on a final method with default visibility (cleanMapping).
> It turns out to be the easiest option to completely for the code and replace just the method in question.
> Possible fix:
> Change the visibility of most members and subtypes to be at least protected and avoid the default visibility.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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