What is "Unqualified access to the field"? [message #189946] |
Thu, 25 January 2007 09:23  |
Eclipse User |
|
|
|
Originally posted by: www.nospam.net
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
}
Thank you very much.
|
|
|
Re: What is "Unqualified access to the field"? [message #189972 is a reply to message #189946] |
Thu, 25 January 2007 10:32  |
Eclipse User |
|
|
|
Originally posted by: pgodeau_nosp.m_sapex-alma.com
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-prefere nces-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".
|
|
|
Powered by
FUDForum. Page generated in 0.33888 seconds