commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] Commented: (IO-159) FileCleaningTracker: ReferenceQueue uses raw type
Date Sat, 06 Mar 2010 00:09:27 GMT

    [ https://issues.apache.org/jira/browse/IO-159?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12842122#action_12842122
] 

Sebb commented on IO-159:
-------------------------

The code was changed a while ago to use ReferenceQueue<Object>, so the raw type has
gone.

Using ReferenceQueue<Tracker> does not work, because the marker items are just Objects.

q.remove() returns a Reference to the Object.

Adding debug shows the returned item is in fact a Tracker (which is an instance of a Reference).

Debug also shows that using get() on the reference actually returns null.

So I think the code is now OK, though it perhaps should not swallow all Exceptions - remove()
is only documented to throw InterruptedException.
Also, there's no point checking the returned object for null, because remove() does not return
null.

Fixed accordingly:

URL: http://svn.apache.org/viewvc?rev=919676&view=rev
Log:
See IO-159: remove() never returns null

Modified:
   commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaningTracker.java



> FileCleaningTracker: ReferenceQueue uses raw type
> -------------------------------------------------
>
>                 Key: IO-159
>                 URL: https://issues.apache.org/jira/browse/IO-159
>             Project: Commons IO
>          Issue Type: Improvement
>    Affects Versions: 2.0
>            Reporter: Paul Benedict
>            Priority: Minor
>             Fix For: 2.0
>
>
> The field is:
> ReferenceQueue /* Tracker */ q = new ReferenceQueue();
> But that inline comment needs to become the parameterized type. Is it of type <?>
?

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


Mime
View raw message