This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: static nested class with reference to outer class



I think that there are indeed still issues with inner classes. I've run into
something similar.

The access in an inner class to fields of its parent class doesn't work as
expected (Apache XmlRpc uses such construct):

class ParentOuter
{
	Object result;
	class ParentInner
	{
	}
	protected execute()
	{
		result=new Integer(5);
	}
}

class ChildOuter extends ParentOuter
{
	class ChildInner extends ParentInner
	{
		Object getResult()
		{
			return result;
		}
	}
	public execute()
	{
		ChildInner i=new ChildInner();
		execute();
		System.out.println("result:" + i.getResult().toString());
	}
}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]