Re: Another unused import statement report is out...

2003-03-03 Thread Vladimir R. Bossicard
assertTrue(Whoa, doSomething returned a non-Fred type!, doSomething() instanceof Fred); When the test fails, you don't have a lot of information (like the class returned by doSomething) to debug your code. ads Using JUnit-addons, you would code your assertion:

RE: Another unused import statement report is out...

2003-03-03 Thread Vladimir R. Bossicard
I still don't understand what the hubub about unused imports is about. The goal is not really to check for unused imports (it's a nice-to-have) but IMO to regularly (every night?) use a tool to check the quality of the code. If you care about the details (like unused imports), chances are that

Another unused import statement report is out...

2003-02-26 Thread Tom Copeland
unused imports are down 40% since last November, crikey! http://cvs.apache.org/~tcopeland/jakarta_bad_imports.htm Past reports can be found here - http://cvs.apache.org/~tcopeland/, and mad props to the xml-xalan project, who went from 1421 unused imports to 2 in the last month. Yours, Tom

Re: Another unused import statement report is out...

2003-02-26 Thread Henri Yandell
Anyway of turning off the: Avoid unused local variables such as 'obj' for classes which extend TestCase? It's not something to avoid in a TestCase, as it tests the type of the returned value. These warnings make it hard to see the real problems. Even if it's only a grep for TestCase.java and

RE: Another unused import statement report is out...

2003-02-26 Thread Henri Yandell
On Wed, 26 Feb 2003, Tom Copeland wrote: Hi Henri - Hm, I'm sorry, I don't understand the TestCase thing... are you doing something like: import junit.framework.*; public class FooTest extends TestCase { public void testFiddle() { Object obj = doSomething(); } } or something

RE: Another unused import statement report is out...

2003-02-26 Thread Howard M. Lewis Ship
. Lewis Ship Creator, Tapestry: Java Web Components http://jakarta.apache.org/proposals/tapestry -Original Message- From: Tom Copeland [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 26, 2003 2:58 PM To: [EMAIL PROTECTED] Subject: Another unused import statement report is out

RE: Another unused import statement report is out...

2003-02-26 Thread Tom Copeland
Basically. Except it's: Fred fred = (Fred)doSomething(); in some cases. Hmmm it seems like that local variable is unnecessary if it's not being used later on if this is a JUnit test and it's meant to ensure a certain type is return, seems like this: assertTrue(Whoa, doSomething

RE: Another unused import statement report is out...

2003-02-26 Thread Tom Copeland
Perhaps test code should not be analysed at all. In HttpClient we are rigorus about imports (and style in general) in production code, but are more lax in test code. Not that test code is in anyway unimportant, but just has a different purpose than production code. Yup, I'm the

RE: Another unused import statement report is out...

2003-02-26 Thread Tom Copeland
I still don't understand what the hubub about unused imports is about. Tapestry is pretty clean of them, but even if it wasn't, I wouldn't say that code quality suffered. I mean, there's some fractional difference in compile speed I guess, and a tiny difference in code comprehension that

Re: Another unused import statement report is out...

2003-02-26 Thread Daniel F. Savarese
In message [EMAIL PROTECTED], Hen ri Yandell writes: Basically. Except it's: Fred fred = (Fred)doSomething(); in some cases. Shouldn't you actually do something with the result as a precaution to ensure the assignment doesn't get optimized out (either by the JIT or the compiler)? (Or make

Re: Another unused import statement report is out...

2003-02-26 Thread Daniel F. Savarese
In message [EMAIL PROTECTED], Tom Copeland writes: assertTrue(Whoa, doSomething returned a non-Fred type!, doSomething() instanceof Fred); I retract my comment about needing to do something with the variable. Tom's comment here, in my opinion, is the best approach. daniel

Re: Another unused import statement report is out...

2003-02-26 Thread Simon Brooke
On Wednesday 26 Feb 2003 7:57 pm, Tom Copeland wrote: unused imports are down 40% since last November, crikey! http://cvs.apache.org/~tcopeland/jakarta_bad_imports.htm Past reports can be found here - http://cvs.apache.org/~tcopeland/, and mad props to the xml-xalan project, who went

Re: Another unused import statement report is out...

2003-02-26 Thread Conor MacNeill
Simon Brooke wrote: Do you have a tool for checking for unused imports? I know I have a lot of them in my code, but weeding them takes time and time is something I'm always short of... There are a few - Tom's tool, PMD, will do it, while checkstyle will also do it. Conor

Re: Another unused import statement report is out...

2003-02-26 Thread dion
Tom, how are you working out the LOC for Maven? I count approx 280 .java files in the source tree and at 4066 loc, that makes approx 15 loc per file. Either we're really efficient, or there's something being missed. -- dIon Gillard, Multitask Consulting Blog:

Re: Another unused import statement report is out...

2003-02-26 Thread Tom Copeland
: Re: Another unused import statement report is out... Tom, how are you working out the LOC for Maven? I count approx 280 .java files in the source tree and at 4066 loc, that makes approx 15 loc per file. Either we're really efficient, or there's something being missed. -- dIon Gillard

Re: Another unused import statement report is out...

2003-02-26 Thread Tom Copeland
Historically Checkstyle focuses more on coding standards and checks for things like Javadoc quality, brace placement, use of whitespace, number of parameters in methods, etc. It does find unused imports and other QA checks. PMD has more of a bent on analysing the meaning of the source code,