Community
Participate
Working Groups
We are importing a large Java project into Eclipse. The following code example.... public final class bug { private BaseClass m_var; private abstract class BaseClass { protected Object m_var; } private class SubClass extends BaseClass { private void setVar() { m_var = null; } } } Generated error "Error The field m_var is defined in an inherited type and an enclosing scope". Javac/Jikes do not generate this error.
I presume you are comparing to 1.4 compilers ? If so, then you should toggle our compiler in 1.4 mode as well (by default it is 1.3). See Preferences>Java>Compiler>Compliance and Classfiles. When doing so, no error is reported any longer. Similarily, javac 1.3.1 would report the following: X.java:14: m_var is inherited from X.BaseClass and hides variable in outer class X. An explicit 'this' qualifier must be used to select the desired instance. m_var = null; ^ 1 error FYI - this results from a language adjustment from 1.3 to 1.4, where the spec got clarified.
Closing