You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Uwe Schindler (JIRA)" <ji...@apache.org> on 2009/10/17 13:51:31 UTC

[jira] Created: (LUCENE-1989) CharArraySet cannot be made generic, because it violates the Set interface

CharArraySet cannot be made generic, because it violates the Set<char[]> interface
----------------------------------------------------------------------------------

                 Key: LUCENE-1989
                 URL: https://issues.apache.org/jira/browse/LUCENE-1989
             Project: Lucene - Java
          Issue Type: Bug
    Affects Versions: 2.9
            Reporter: Uwe Schindler
             Fix For: 3.0


I tried to make CharArraySet using generics (extends AbstractSet<char[]>) but this is not possible, as it e.g. returns sometimes String instances in the Iterator instead of []. Also its addAll method accepts both String and char[]. I think this class is a complete mis-design and violates almost everything (sorry).

What to do? Make it Set<?> or just place a big @SuppressWarnings("unchecked"> in front of it?

Because of this problem also a lot of Set declarations inside StopAnalyzer cannot be made generic as you never know whats inside.

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Updated: (LUCENE-1989) CharArraySet cannot be made generic, because it violates the Set interface

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1989?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated LUCENE-1989:
----------------------------------

    Attachment: LUCENE-1989.patch

Add some java docs. Will commit now.

> CharArraySet cannot be made generic, because it violates the Set<char[]> interface
> ----------------------------------------------------------------------------------
>
>                 Key: LUCENE-1989
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1989
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 2.9
>            Reporter: Uwe Schindler
>             Fix For: 3.0
>
>         Attachments: LUCENE-1989.patch, LUCENE-1989.patch
>
>
> I tried to make CharArraySet using generics (extends AbstractSet<char[]>) but this is not possible, as it e.g. returns sometimes String instances in the Iterator instead of []. Also its addAll method accepts both String and char[]. I think this class is a complete mis-design and violates almost everything (sorry).
> What to do? Make it Set<?> or just place a big @SuppressWarnings("unchecked"> in front of it?
> Because of this problem also a lot of Set declarations inside StopAnalyzer cannot be made generic as you never know whats inside.

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Issue Comment Edited: (LUCENE-1989) CharArraySet cannot be made generic, because it violates the Set interface

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

Uwe Schindler edited comment on LUCENE-1989 at 10/17/09 1:27 PM:
-----------------------------------------------------------------

This is the only possibility to make it somehow genericfied. As all Object subclasses (so everything) contains a toString() method it is no longer a problem to add any object that has a valid String representation to this set.

It is only strange that the iterator returns Strings and not char[] - why is this so? To fix this, there is also an accessor to get an Iterator<String> correctly casted.

      was (Author: thetaphi):
    This is the only possibility to make it somehow genericfied. As all Object subclasses (so everything) contains a toString() method it is no longer a problem to add any object that has a valid String representation to this set.

It is only strange that the iterator returns Strings and not char[] - why is this so. To fix this, there is also an accessor to get an Iterator<String> correctly casted.
  
> CharArraySet cannot be made generic, because it violates the Set<char[]> interface
> ----------------------------------------------------------------------------------
>
>                 Key: LUCENE-1989
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1989
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 2.9
>            Reporter: Uwe Schindler
>             Fix For: 3.0
>
>         Attachments: LUCENE-1989.patch
>
>
> I tried to make CharArraySet using generics (extends AbstractSet<char[]>) but this is not possible, as it e.g. returns sometimes String instances in the Iterator instead of []. Also its addAll method accepts both String and char[]. I think this class is a complete mis-design and violates almost everything (sorry).
> What to do? Make it Set<?> or just place a big @SuppressWarnings("unchecked"> in front of it?
> Because of this problem also a lot of Set declarations inside StopAnalyzer cannot be made generic as you never know whats inside.

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Resolved: (LUCENE-1989) CharArraySet cannot be made generic, because it violates the Set interface

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1989?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler resolved LUCENE-1989.
-----------------------------------

    Resolution: Fixed
      Assignee: Uwe Schindler

Committed revision: 826395

> CharArraySet cannot be made generic, because it violates the Set<char[]> interface
> ----------------------------------------------------------------------------------
>
>                 Key: LUCENE-1989
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1989
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 2.9
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>             Fix For: 3.0
>
>         Attachments: LUCENE-1989.patch, LUCENE-1989.patch
>
>
> I tried to make CharArraySet using generics (extends AbstractSet<char[]>) but this is not possible, as it e.g. returns sometimes String instances in the Iterator instead of []. Also its addAll method accepts both String and char[]. I think this class is a complete mis-design and violates almost everything (sorry).
> What to do? Make it Set<?> or just place a big @SuppressWarnings("unchecked"> in front of it?
> Because of this problem also a lot of Set declarations inside StopAnalyzer cannot be made generic as you never know whats inside.

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Updated: (LUCENE-1989) CharArraySet cannot be made generic, because it violates the Set interface

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1989?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated LUCENE-1989:
----------------------------------

    Attachment: LUCENE-1989.patch

This is the only possibility to make it somehow genericfied. As all Object subclasses (so everything) contains a toString() method it is no longer a problem to add any object that has a valid String representation to this set.

It is only strange that the iterator returns Strings and not char[] - why is this so. To fix this, there is also an accessor to get an Iterator<String> correctly casted.

> CharArraySet cannot be made generic, because it violates the Set<char[]> interface
> ----------------------------------------------------------------------------------
>
>                 Key: LUCENE-1989
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1989
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 2.9
>            Reporter: Uwe Schindler
>             Fix For: 3.0
>
>         Attachments: LUCENE-1989.patch
>
>
> I tried to make CharArraySet using generics (extends AbstractSet<char[]>) but this is not possible, as it e.g. returns sometimes String instances in the Iterator instead of []. Also its addAll method accepts both String and char[]. I think this class is a complete mis-design and violates almost everything (sorry).
> What to do? Make it Set<?> or just place a big @SuppressWarnings("unchecked"> in front of it?
> Because of this problem also a lot of Set declarations inside StopAnalyzer cannot be made generic as you never know whats inside.

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org