commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Cooper" <martin.coo...@tumbleweed.com>
Subject RE: [collection] PMD of Collections
Date Thu, 07 Nov 2002 22:21:54 GMT


> -----Original Message-----
> From: Michael A. Smith [mailto:mas@apache.org]
> Sent: Thursday, November 07, 2002 1:49 PM
> To: Jakarta Commons Developers List
> Subject: Re: [collection] PMD of Collections
> 
> 
> On Thu, 7 Nov 2002, Henri Yandell wrote:
> > Looking at the PMD report of Commons Collections, I've 
> fixed the blatant
> > errors [see:
> > 
> http://pmd.sourceforge.net/reports/jakartacommons_jakarta-comm
> ons.html]
> > 
> > It still leaves a lot in the Tests which are basically:
> > 
> > try {
> >    Object obj = someTest();
> > } catch(ExpectedException ee) {
> >    ...
> > }
> > 
> > It thinks these should be:
> > 
> > try {
> >     someTest();
> > } catch(...
> > 
> > So. Does anyone mind if I go through and remove all the 
> variable naming?
> > Is it doing any real service [all it shows is return type, rtfjdoc]?
> 
> One benefit to this is that if the signature changes (i.e. the return
> type), then the assignment won't compile.  In a way, reminding the
> developer that changing the return type breaks things.  Without the
> assignment, there is no typecheck.

If the code is really like the example above, and the assignment is to an
Object, then compilation will only break if the return type is changed to a
primitive or void. ;-)

--
Martin Cooper


> 
> But really, I don't think that's much of an argument because there
> really should be some other test that's implicitly checking the return
> type when it tests that the method returns an expected result.  So I'm
> fine with removing the unused variables.
> 
> regards,
> michael
> 
> -- 
> Michael A. Smith
> mas@apache.org
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:commons-dev-help@jakarta.apache.org>
> 
> 


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message