[ 
https://issues.apache.org/jira/browse/LUCENE-1935?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12761372#action_12761372
 ] 

Uwe Schindler edited comment on LUCENE-1935 at 10/1/09 3:31 PM:
----------------------------------------------------------------

Was it to avoid a perforance impact of casting or only for cleaner code? 
Because the generic version of PQ does noch change anything, the resulting byte 
code is identical (you can compare that with a decompilation using JAD). The 
casts are added by the Java Compiler automatically.
The lessThan method is covariant overloaded (passed through) in subclasses by 
javac (like in the test): lessThan(Integer, Integer) will appear as such in the 
class byte code of the subclass, but javac will add lessThan(Object, Object) 
that delgates to the covariant overload (which may be a small perf impact). It 
is called by the compiled code of PQ using the (Object, Object) signature (PQ 
does not know anything about generics in its byte code).

      was (Author: thetaphi):
    Was it to avoid a perforance impact of casting or only for cleaner code? 
Because the generic version of PQ does noch change anything, the resulting byte 
code is identical (you can compare that with a decompilation using JAD). The 
casts are added by the Java Compiler automatically.
The lessThan method is covariant overloaded (passed through) by javac: 
lessThan(Integer, Integer) will appear as such in the class byte code, but 
javac will add lessThan(Object, Object) that delgates around (which may be a 
small perf impact), as it is called by the compiled code of PQ (PQ does not 
know anything about generics in its byte code).
  
> Generify PriorityQueue
> ----------------------
>
>                 Key: LUCENE-1935
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1935
>             Project: Lucene - Java
>          Issue Type: Task
>          Components: Other
>    Affects Versions: 2.9
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>             Fix For: 3.0
>
>         Attachments: LUCENE-1935.patch
>
>
> Priority Queue should use generics like all other Java 5 Collection API 
> classes. This very simple, but makes code more readable.

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

Reply via email to