| To: | "users@xxxxxxxxxx" <users@xxxxxxxxxx> |
|---|---|
| Subject: | Re: [cinjug-users] IDE Warning - Parameter value should not be assigned |
| From: | "Edward Sumerfield" <esumerfd@xxxxxxxxx> |
| Date: | Wed, 2 Aug 2006 13:54:02 -0400 |
| Delivered-to: | mailing list users@cinjug.org |
| Domainkey-signature: | a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:references; b=GPNHRKt7fl29up/JV7TgwTk0EbQ1z3Ye22nUTMksrUjkAIeU7L+P6NDtTTGNm/zLwp5MgmJS7q0EabnOD3Rc7MR5Tah+2PHH04+PekBEC3WZ0ALxoPvs+G1OeuOheZH+7e6FA7qCr4lUsQqYmx5bMFFQIBU/XFhj8jEfbtmWUsM= |
| In-reply-to: | <44D0D767.8040108@digilore.com> |
| Mailing-list: | contact users-help@cinjug.org; run by ezmlm |
| References: | <6a216ba20608020750v496e606eh72da2bd5deb9f907@mail.gmail.com> <44D0D767.8040108@digilore.com> |
| Reply-to: | esumerfd@xxxxxxxxxxxxxx |
|
In JDK1.5 the warning will say that newList "can only be null" which should catch that scenario. Once we accept that the changed value can not be returned we are left with a "read only" value, expecially if we add James' final operator. So the resulting code is just redundent. public void foo(final int a_value) { int value = a_value; value++; doSomething(value); doSomethingElse(value); } To Brians' point, I agree that in most cases this problem doesn't come up and as methods are reduced in size the problem goes away. However, with short methods the "hard to follow" concern goes away aswell. There is also the counter argument that two variables is are complex than one. The hard to follow concern would be solved with good naming conventions. public void foo(int a_numberOfRulesToBreak) { a_numberOfRulesToBreak++; doSomething(a_numberOfRulesToBreak); doSomethingElse(a_numberOfRulesToBreak); } I think, given the severity of the problem, that this warning should now be ignored. Less code is better. This means I am agreeing with Rob the Ruby guy. See you at NoFluff dude. :-)
On 8/2/06, Joe Fox <joe.fox@xxxxxxxxxxxx> wrote: -----BEGIN PGP SIGNED MESSAGE----- -- Ed |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | RE: [cinjug-users] IDE Warning - Parameter value should not be assigned, Forsythe, Brian |
|---|---|
| Next by Date: | A college d1pl0ma can help you get a better job now., Higher Education |
| Previous by Thread: | Re: [cinjug-users] IDE Warning - Parameter value should not be assigned, Joe Fox |
| Next by Thread: | DbUnit and Hibernate, twcrone |
| Indexes: | [Date] [Thread] [Top] [All Lists] |