Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!news.unit0.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: v_borchert@despammed.com (Volker Borchert) Newsgroups: comp.lang.java.programmer Subject: Re: Eclipse 3.7.1 compiler warning Date: 11 Jan 2012 21:10:17 GMT Organization: Private site at Eddersheim, Germany Lines: 36 Distribution: world Message-ID: References: X-Trace: individual.net 1UbzX8Da6oOHemASOlXNOAaRTiu2RmdlSbx12bUcaO4ROi6vec Cancel-Lock: sha1:cSROY4PtMxUpeom7Z7u/YJCC5bo= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:11245 Novice wrote: > [ ... ] "the parameter should not be assigned". [ ... ] > > So here's what the code looks like: > > public static int foo(int start, int finish) { > > /* Other stuff */ > > start--; > finish--; > > bar(start, finish); > } > > It's the start--; and finish--; lines that are raising the warnings. > > What exactly is wrong with doing that? The casual reader might miss that bar() is being passed values different from those having been passed to foo(). > And what is the best way to make the > compiler happy about that code? public static int foo(int start, int finish) { /* Other stuff */ bar(start - 1, finish - 1); } -- "I'm a doctor, not a mechanic." Dr Leonard McCoy "I'm a mechanic, not a doctor." Volker Borchert