[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.newcomer] Re: What is "Unqualified access to the field"?

www a écrit :
> Hi,
> 
> In the setting of "Error/Warining/Ignore" in Project->Property->Java
> compiler, I have just turned on waring to "Unqualified access to the
> field". After rebuild, there are many warnings now.(Before, there was
> none.)
> 
> I look at them. With my Java knowledge, I don't understand why they are
> wrong and should be warned. For example,
> 
> public class MyClass
> {
>     private int x;
> 
>     MyClass(int w)
>     {
>         x = w;   //Now, there is a warning here, saying "Unqualified
> access to the field". I don't understand it
>     }
> 
>     ...//other code

Hi,

RTFM:
http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-errors-warnings.htm


When enabled, the compiler will issue an error or a warning whenever it
encounters a field access which is not qualified (eg. misses a 'this').

=> change "x" to "this.x".