Hi Ito,

I have met a new IllegalAccessError in eclipse. I have attached two files which reproduce the problem.

The protected bit is difficult to handle apparently. I have talked with Tom Tromey and it says that normally we should completely ignore the accessibility flag in inner classes.

Regards,

Guilhem.

Ito Kazumitsu wrote:

From: Ito Kazumitsu <[EMAIL PROTECTED]>
Date: Thu, 22 Dec 2005 11:08:15 +0900 (JST)

The runtime access control is much simpler than the compile-time
access control.  And we may be able to omit the checking of nested
relations of classes at runtime.

Simply omitting the checking of nested relations of classes
causes IllegalAccessError, which was reported in November, 2003.

I am afraid Sun's VM spec:

A class or interface C is accessible to a class or interface D if and only if
either of the following conditions are true:

(Runtime):
  - C is public.
  - C and D are members of the same runtime package.

is incomplete and something should be said about the case
where C is protected.

Attached below is my proposed patch.  I have deleted the
checking of outer classes for determining slot_acc,
but kept such checking for determining class_acc.

With this patch applied,

  - All the regression tests pass.
  - Mauve test gnu.testlet.java.lang.Class.newInstance shows the
    same results as Sun's JDK.
  - The testcase attached to
    http://www.kaffe.org/pipermail/kaffe/2003-November/096187.html
    passes.

import a.*;

public class legal2
{
	static public void main(String args[])
	{
		legal1.A a = legal1.getA();

		System.out.println(a.b);
	}
}
package a;

public class legal1
{
	static protected class A
	{
		public int b;
	}

	static public A getA()
	{
		A a = new A();

		a.b = 1;
		return a;
	}
}
_______________________________________________
kaffe mailing list
kaffe@kaffe.org
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe

Reply via email to