[kaffe] CVS kaffe (kaz): kaffe/kaffevm/acces.c:

Kaffe CVS Kaffe Mailing List <kaffe@kaffe.org>
Wed Nov 12 07:20:03 2003


PatchSet 4160 
Date: 2003/11/12 15:17:12
Author: kaz
Branch: HEAD
Tag: (none) 
Log:
2003-11-12 Ito Kazumitsu <kaz@maczuka.gcd.org>

        kaffe/kaffevm/acces.c:
        (checkAccess) corrected to avoid java.lang.IllegalAccessError.

Members: 
	ChangeLog:1.1752->1.1753 
	kaffe/kaffevm/access.c:1.4->1.5 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1752 kaffe/ChangeLog:1.1753
--- kaffe/ChangeLog:1.1752	Wed Nov 12 15:06:24 2003
+++ kaffe/ChangeLog	Wed Nov 12 15:17:12 2003
@@ -1,5 +1,10 @@
 2003-11-12 Ito Kazumitsu <kaz@maczuka.gcd.org>
 
+	kaffe/kaffevm/acces.c:
+	(checkAccess) corrected to avoid java.lang.IllegalAccessError.
+
+2003-11-12 Ito Kazumitsu <kaz@maczuka.gcd.org>
+
 	libraries/javalib/kaffe/io/ByteToCharSHIFT_JIS.java,
 	libraries/javalib/kaffe/io/ChartoByteSHIFT_JIS.java:
 	New Files.
Index: kaffe/kaffe/kaffevm/access.c
diff -u kaffe/kaffe/kaffevm/access.c:1.4 kaffe/kaffe/kaffevm/access.c:1.5
--- kaffe/kaffe/kaffevm/access.c:1.4	Sat Oct 25 12:52:38 2003
+++ kaffe/kaffe/kaffevm/access.c	Wed Nov 12 15:17:14 2003
@@ -118,26 +118,56 @@
 	{
 		class_acc = 1;
 	}
-	else if( (target->this_inner_index >= 0) &&
-		 (target->accflags & ACC_PROTECTED) )
+	else if( target->accflags & ACC_PROTECTED )
 	{
-		/* check whether target is non private innerclass of superclass */
-		innerClass *ic = &target->inner_classes[target->this_inner_index];
+	/* check whether target is non private innerclass of superclass */
+		innerClass *ict;
+		innerClass *icc;
+		Hjava_lang_Class *outert;
+		Hjava_lang_Class *outerc;
+		errorInfo einfo;
+		ict = icc = NULL;
+		outert = outerc = NULL;
 
-		if( ic->outer_class )
+	       	if( target->this_inner_index >= 0 )
 		{
-			Hjava_lang_Class *outer;
-			errorInfo einfo;
-
-			outer = getClass(ic->outer_class, target, &einfo);
-			if( outer != NULL )
+			ict = &target->inner_classes[target->this_inner_index];
+			if( ict->outer_class )
+			{
+				outert = getClass(ict->outer_class, target, &einfo);
+				if( outert == NULL )
+				{
+					discardErrorInfo(&einfo);
+				}
+			}
+		}
+	       	if( context->this_inner_index >= 0 )
+		{
+			icc = &context->inner_classes[context->this_inner_index];
+			if( icc->outer_class )
 			{
-				class_acc = instanceof(outer, context);
+				outerc = getClass(icc->outer_class, context, &einfo);
+				if( outerc == NULL )
+				{
+					discardErrorInfo(&einfo);
+				}
 			}
-			else
+		}
+
+		if( outert != NULL )
+		{
+			if( instanceof(outert, context) )
+		       	{
+				class_acc = 1;
+			}
+			else if (outerc != NULL)
 			{
-				discardErrorInfo(&einfo);
+				class_acc = instanceof(outert, outerc);
 			}
+		}
+		else if( outerc != NULL )
+		{
+			class_acc = instanceof(target, outerc);
 		}
 	}