Usage of eclipse warning “field declaration hides another field or variable”?

后端 未结 3 1983
误落风尘
误落风尘 2020-12-10 08:11

Eclipse has a java compiler setting called \"field declaration hides another field or variable\" that can be set to warning/error.

How important is this warning in

相关标签:
3条回答
  • 2020-12-10 08:52

    This is a very useful option in my opinion and should be enabled to show a compiler warning. There is an option (in my version at least Eclipse 3.5.2, Java EE feature 1.2.2) to further enable/disable it within constructors and getters/setters to prevent false positives.

    eclipse compiler settings

    0 讨论(0)
  • 2020-12-10 08:54

    I'd say that you just disable this warning - it seems no use in your convention. And no wonder it is ignored by default.

    0 讨论(0)
  • 2020-12-10 09:07

    I keep these set to "Error". If a class and its parent both have a field of the same name I don't want to lose any of my time trying to figure out why I seem to be assigning a value to the field yet it never seems to change!

    0 讨论(0)
提交回复
热议问题