Bug 45482 - Source contains unused variables
Summary: Source contains unused variables
Status: NEEDINFO
Alias: None
Product: Log4j - Now in Jira
Classification: Unclassified
Component: Other (show other bugs)
Version: 1.2
Hardware: PC Windows XP
: P2 minor
Target Milestone: ---
Assignee: log4j-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-25 03:07 UTC by Thorbjørn Ravn Andersen
Modified: 2008-08-05 10:57 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thorbjørn Ravn Andersen 2008-07-25 03:07:28 UTC
There are several places where there are unused variables flagged by the eclipse compiler.

The attached patch removes these with their assignments (except where I was unable to determine if there was subtle side effects).
Comment 1 Curt Arnold 2008-07-28 23:44:03 UTC
The patch touches a lot of files that did not have extra imports.  Quite a few files only differed in whitespace or import order.  Would prefer that only files with extra imports were touched by patches for this bug.  Unclear which files actually did have extra imports.
Comment 2 Thorbjørn Ravn Andersen 2008-07-29 06:01:23 UTC
(In reply to comment #1)
> The patch touches a lot of files that did not have extra imports.  Quite a few
> files only differed in whitespace or import order.  Would prefer that only
> files with extra imports were touched by patches for this bug.  Unclear which
> files actually did have extra imports.

This bug is about unused variables, not imports.

Comment 3 Curt Arnold 2008-07-29 06:30:14 UTC
Are the variable method scope or private?  If the unused variables are protected, package or public they can't be removed with potentially breaking compatibilty. 
Comment 4 Thorbjørn Ravn Andersen 2008-07-29 06:45:25 UTC
(In reply to comment #3)
> Are the variable method scope or private?  If the unused variables are
> protected, package or public they can't be removed with potentially breaking
> compatibilty. 

I have only looked at those that Eclipse 3.4 gave a warning for as being unused, which usually is only private or locals.  If the value assigned to it, looked to have side effects I kept those.

(I got the source in Eclipse by checking it out in Eclipse with the subclipse plugin, close the project, run "mvn eclipse:eclipse", and reopen the project).
Comment 5 Curt Arnold 2008-08-05 10:57:03 UTC
Comment #1 was intended for bug 45481.  I was traveling and confused the two similarly titled bugs. 

I'm marking this as NEEDINFO since there is no patch attached and the unused variables are not identified.  Even if a variable is unused, it can not be removed unless it is either a private member variable or within a method.