Saturday, 15 January 2011

java namespace collisions -



java namespace collisions -

i find myself making next error.

public class foo{ bar bar; public void dosomething(){ bar bar = makenewbar(); // bla bla } }

where error want set foo's bar, not local bar. i.e, should bar = makenewbar(), not bar bar = makenewbar(). there compiler warning flag or can observe "namespace collisions" this? if not, what's way avoid (short of not making error, best alternative =p)?

that's not job of compiler ide warn right settings if shadow variable.

using eclipse, go preferences / java / compiler / error/warnings , name shadowing , conflicts.

java namespaces scope

No comments:

Post a Comment