On Fri, 24 Oct 2003 20:14:38 +0200 Guilhem Lavaux <[EMAIL PROTECTED]> wrote:
Hi Guilhem, hi Ito, > >The attached programs cause java.lang.IllegalAccessError, > >which partly seemes to have something to do with KJC, > >but class files compiled with Sun's javac also cause the > >error. > > > Apparently KJC choses to protect the inner class (as usual). I've not > really seen a specific restriction about access modifiers concerning > inner classes in doc but the JDK's compiler put your sample class in > public access (even though you explicitly specified it protected). The > best guess I can make is to ignore the access modifier for inner classes > in KJC. I'll prepare this for tomorrow. I don't think that this would be the correct fix (altering the access modifiers during compilation doesn't look right to me). For a discussion of a similar problem have a look at the thread starting at this mail: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=Pine.LNX.4.10.10010111327040.12800-100000%40green.usr.onet I think the real problem is kaffe's runtime access checking, which is why I'm about to check in the following patch: Index: kaffe/kaffevm/access.c =================================================================== RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/access.c,v retrieving revision 1.3 diff -u -r1.3 access.c --- kaffe/kaffevm/access.c 22 Sep 2003 15:31:24 -0000 1.3 +++ kaffe/kaffevm/access.c 25 Oct 2003 08:16:09 -0000 @@ -116,7 +118,29 @@ { class_acc = 1; } + else if( (target->this_inner_index >= 0) && + (target->accflags & ACC_PROTECTED) ) + { + /* check whether target is non private innerclass of superclass */ + innerClass *ic = &target->inner_classes[target->this_inner_index]; + + if( ic->outer_class ) + { + Hjava_lang_Class *outer; + errorInfo einfo; + outer = getClass(ic->outer_class, target, &einfo); + if( outer != NULL ) + { + class_acc = instanceof(outer, context); + } + else + { + discardErrorInfo(&einfo); + } + } + } + Kaffe's runtime access checking denies access to protected inherited inner classes, which is why we get the IllegalAccessException. Regards, Helmer _______________________________________________ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe