lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler (JIRA)" <j...@apache.org>
Subject [jira] Created: (LUCENE-1835) Signature changes in AttributeSource for better Generics support of AddAttribute/getAttribute
Date Fri, 21 Aug 2009 08:38:14 GMT
Signature changes in AttributeSource for better Generics support of AddAttribute/getAttribute
---------------------------------------------------------------------------------------------

                 Key: LUCENE-1835
                 URL: https://issues.apache.org/jira/browse/LUCENE-1835
             Project: Lucene - Java
          Issue Type: Task
          Components: Analysis
    Affects Versions: 2.9
            Reporter: Uwe Schindler
            Assignee: Uwe Schindler
             Fix For: 2.9
         Attachments: LUCENE-1835.patch

The last update of Attribute API using AttributeImpl as implementation oif Attributes changed
the API a little bit. This change leads to the fact, that in Java 1.5 using generics we are
no longer able to add Attributes without casting. addAttribute and getAttribute should return
the Attribute interface because the implementation of the attribute is not interesting to
the caller. By that in 1.5 using generics, one could add a TermAttribute without casting using:
<code>
TermAttribute termAtt = addAttribute(TermAttribute.class);
</code>
The signature to do this is:
<code>
public K addAttribute(Class<K extends Attribute>)
</code>

The attached patch applies the mentioned change to the signature (without generic, only returning
Attribute). No other code cahnges are needed, as current code always casts the result to the
requested interface. I also added the 1.5 method signature for all these methods to the javadocs.

All tests pass.

-- 
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


Mime
View raw message