[kaffe] CVS kaffe (guilhem): More (and hopefully final) fixes for
access.
Kaffe CVS
cvs-commits at kaffe.org
Thu Dec 22 10:04:02 PST 2005
PatchSet 7032
Date: 2005/12/22 17:51:17
Author: guilhem
Branch: HEAD
Tag: (none)
Log:
More (and hopefully final) fixes for access.
* kaffe/kaffevm/access.c
(checkAccess): Simplified to the maximum according to Sun's VM
spec we must not check for specific inner classes flags.
* kaffe/kaffevm/classMethod.c
(addInnerClasses): Do not merge inner class access flags with the
class flags.
* libraries/clib/native/Class.c
(java_lang_VMClass_getModifiers): Return the right access flags
depending on what we are asked and whether the class is nested.
* test/regression/TestSerialFields.java,
test/regression/TestSerialVersions.java: Removed private modifier
to be able to run the tests (as for JDK).
Members:
ChangeLog:1.4551->1.4552
kaffe/kaffevm/access.c:1.15->1.16
kaffe/kaffevm/classMethod.c:1.149->1.150
libraries/clib/native/Class.c:1.86->1.87
test/regression/TestSerialFields.java:1.3->1.4
test/regression/TestSerialVersions.java:1.3->1.4
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4551 kaffe/ChangeLog:1.4552
--- kaffe/ChangeLog:1.4551 Thu Dec 22 13:55:16 2005
+++ kaffe/ChangeLog Thu Dec 22 17:51:17 2005
@@ -1,3 +1,21 @@
+2005-12-22 Guilhem Lavaux <guilhem at kaffe.org>
+
+ * kaffe/kaffevm/access.c
+ (checkAccess): Simplified to the maximum according to Sun's VM
+ spec we must not check for specific inner classes flags.
+
+ * kaffe/kaffevm/classMethod.c
+ (addInnerClasses): Do not merge inner class access flags with the
+ class flags.
+
+ * libraries/clib/native/Class.c
+ (java_lang_VMClass_getModifiers): Return the right access flags
+ depending on what we are asked and whether the class is nested.
+
+ * test/regression/TestSerialFields.java,
+ test/regression/TestSerialVersions.java: Removed private modifier
+ to be able to run the tests (as for JDK).
+
2005-12-22 Ito Kazumitsu <kaz at maczuka.gcd.org>
* kaffe/kaffevm/access.c
Index: kaffe/kaffe/kaffevm/access.c
diff -u kaffe/kaffe/kaffevm/access.c:1.15 kaffe/kaffe/kaffevm/access.c:1.16
--- kaffe/kaffe/kaffevm/access.c:1.15 Thu Dec 22 13:55:22 2005
+++ kaffe/kaffe/kaffevm/access.c Thu Dec 22 17:51:23 2005
@@ -179,66 +179,9 @@
* is protected. But our experience tells the need for a special
* handling of this case.
*/
- else if( target->accflags & ACC_PROTECTED && instanceof(target, context) )
+ else if( instanceof(target, context) )
{
class_acc = 1;
- }
- else if( target->accflags & ACC_PROTECTED )
- {
- /* 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;
-
- /* get class containing the accessed class (the target) */
- if( target->this_inner_index >= 0 )
- {
- ict = &target->inner_classes[target->this_inner_index];
- if( ict->outer_class )
- {
- outert = getClass(ict->outer_class, target, &einfo);
- if( outert == NULL )
- {
- discardErrorInfo(&einfo);
- }
- }
- }
- /* get class containing the accessing class (the context) */
- if( context->this_inner_index >= 0 )
- {
- icc = &context->inner_classes[context->this_inner_index];
- if( icc->outer_class )
- {
- outerc = getClass(icc->outer_class, context, &einfo);
- if( outerc == NULL )
- {
- discardErrorInfo(&einfo);
- }
- }
- }
-
- if( outerc != NULL )
- {
- if ( recursive_instanceof(target, outerc) )
- {
- class_acc = 1;
- }
- else if (outert != NULL)
- {
- class_acc = recursive_instanceof(outert, outerc);
- }
-
- }
-
- if ( !class_acc && (outert != NULL) )
- {
- class_acc = instanceof(outert, context);
- }
-
}
if((context->packageLength == target->packageLength) &&
Index: kaffe/kaffe/kaffevm/classMethod.c
diff -u kaffe/kaffe/kaffevm/classMethod.c:1.149 kaffe/kaffe/kaffevm/classMethod.c:1.150
--- kaffe/kaffe/kaffevm/classMethod.c:1.149 Fri Sep 9 13:53:36 2005
+++ kaffe/kaffe/kaffevm/classMethod.c Thu Dec 22 17:51:23 2005
@@ -1113,7 +1113,6 @@
readu2(&ic->inner_class_accflags, fp);
if (c->this_index && ic->inner_class == c->this_index) {
- c->accflags = (c->accflags & ~ACC_MASK) | (ic->inner_class_accflags & ACC_MASK);
c->this_inner_index = i;
}
}
Index: kaffe/libraries/clib/native/Class.c
diff -u kaffe/libraries/clib/native/Class.c:1.86 kaffe/libraries/clib/native/Class.c:1.87
--- kaffe/libraries/clib/native/Class.c:1.86 Sat Aug 13 23:37:23 2005
+++ kaffe/libraries/clib/native/Class.c Thu Dec 22 17:51:23 2005
@@ -291,12 +291,19 @@
jint
java_lang_VMClass_getModifiers(struct Hjava_lang_Class* this,
- jboolean ignoreInnerClassAttribute UNUSED)
+ jboolean ignoreInnerClassAttribute)
{
#ifndef ACC_SUPER
#define ACC_SUPER ACC_SYNCHRONISED
#endif
- return (this->accflags & (ACC_MASK & ~ACC_SUPER));
+ accessFlags accflags = this->accflags;
+
+ if (this->this_inner_index >= 0 && !ignoreInnerClassAttribute)
+ {
+ assert(this->inner_classes != NULL);
+ accflags = this->inner_classes[this->this_inner_index].inner_class_accflags;
+ }
+ return accflags & (ACC_MASK & ~ACC_SUPER);
}
HArrayOfObject*
@@ -433,8 +440,12 @@
if (unhand(this)->this_inner_index >= 0) {
innerClass *ic = unhand(this)->inner_classes;
+ int oc = ic[unhand(this)->this_inner_index].outer_class;
+
+ if (oc == 0)
+ return NULL;
- ret = getClass (ic[unhand(this)->this_inner_index].outer_class,
+ ret = getClass (oc,
this,
&einfo);
Index: kaffe/test/regression/TestSerialFields.java
diff -u kaffe/test/regression/TestSerialFields.java:1.3 kaffe/test/regression/TestSerialFields.java:1.4
--- kaffe/test/regression/TestSerialFields.java:1.3 Sat Dec 10 19:38:20 2005
+++ kaffe/test/regression/TestSerialFields.java Thu Dec 22 17:51:24 2005
@@ -203,7 +203,7 @@
}
- private static class Test0001 // "original" (pristine) version
+ static class Test0001 // "original" (pristine) version
implements Serializable
{
private static final long serialVersionUID = constantUID;
@@ -236,7 +236,7 @@
}
- private static class Test0002 // contains doubles
+ static class Test0002 // contains doubles
implements Serializable
{
private static final long serialVersionUID = constantUID;
@@ -262,7 +262,7 @@
}
}
- private static class Test0005 // missing x,y fields
+ static class Test0005 // missing x,y fields
implements Serializable
{
private static final long serialVersionUID = constantUID;
@@ -287,7 +287,7 @@
}
- private static class Test0008 // Compatible via serialPersistentFields...
+ static class Test0008 // Compatible via serialPersistentFields...
implements Serializable
{
private static final long serialVersionUID = constantUID;
@@ -317,7 +317,7 @@
}
- private static class Test0010 // Compatible, but different (and invalid) serialPersistentFields...
+ static class Test0010 // Compatible, but different (and invalid) serialPersistentFields...
implements Serializable
{
private static final long serialVersionUID = constantUID;
@@ -349,7 +349,7 @@
}
- private static class Test0011 // Compatible, broken writeObject
+ static class Test0011 // Compatible, broken writeObject
implements Serializable
{
private static final long serialVersionUID = constantUID;
@@ -375,7 +375,7 @@
}
}
- private static class Test0012 // check defaultReadObject
+ static class Test0012 // check defaultReadObject
implements Serializable
{
private static final long serialVersionUID = constantUID;
@@ -401,7 +401,7 @@
}
}
- private static class Test0014 // bogus reads/puts
+ static class Test0014 // bogus reads/puts
implements Serializable
{
private static final long serialVersionUID = constantUID;
@@ -429,7 +429,7 @@
}
}
- private static class Test0015 // impossible field names
+ static class Test0015 // impossible field names
implements Serializable
{
private static final long serialVersionUID = constantUID;
@@ -466,7 +466,7 @@
// XXX JDK1.4 and Kaffe differ on this one (JDK blows up with multiple
// readFields()) both Kaffe and JDK1.4 are fine with multiple putFields.
- private static class Test0016 // multiple gets/sets
+ static class Test0016 // multiple gets/sets
implements Serializable
{
private static final long serialVersionUID = constantUID;
Index: kaffe/test/regression/TestSerialVersions.java
diff -u kaffe/test/regression/TestSerialVersions.java:1.3 kaffe/test/regression/TestSerialVersions.java:1.4
--- kaffe/test/regression/TestSerialVersions.java:1.3 Sat Dec 10 19:38:20 2005
+++ kaffe/test/regression/TestSerialVersions.java Thu Dec 22 17:51:24 2005
@@ -21,7 +21,7 @@
public static final long constantUID = 0x42L;
- private static class Test0001 // "original" (pristine) version
+ static class Test0001 // "original" (pristine) version
implements Serializable
{
private static final long serialVersionUID = constantUID;
@@ -34,7 +34,7 @@
}
}
- private static class Test0002 // mismatch (widen) field types
+ static class Test0002 // mismatch (widen) field types
implements Serializable
{
private static final long serialVersionUID = constantUID;
@@ -47,7 +47,7 @@
}
}
- private static class Test0003 // mismatch (narrow) field types
+ static class Test0003 // mismatch (narrow) field types
implements Serializable
{
private static final long serialVersionUID = constantUID;
@@ -60,7 +60,7 @@
}
}
- private static class Test0004 // mismatch (incompatible) field types
+ static class Test0004 // mismatch (incompatible) field types
implements Serializable
{
private static final long serialVersionUID = constantUID;
@@ -73,7 +73,7 @@
}
}
- private static class Test0005 // missing x,y fields
+ static class Test0005 // missing x,y fields
implements Serializable
{
private static final long serialVersionUID = constantUID;
@@ -84,7 +84,7 @@
}
}
- private static class Test0052 // missing x (but not y) field
+ static class Test0052 // missing x (but not y) field
implements Serializable
{
private static final long serialVersionUID = constantUID;
@@ -97,7 +97,7 @@
}
}
- private static class Test0006 // Wrong serialVersionUID
+ static class Test0006 // Wrong serialVersionUID
implements Serializable
{
private static final long serialVersionUID = constantUID + 0x69;
@@ -115,7 +115,7 @@
// I think the serialPersistentFields are really only used for
// *writing* objects (in the default)...
// Kaffe now does the "right thing" (throws an exception on this case).
- private static class Test0007 // Compatible via serialPersistentFields...
+ static class Test0007 // Compatible via serialPersistentFields...
implements Serializable
{
private static final long serialVersionUID = constantUID;
@@ -135,7 +135,7 @@
}
- private static class Test0008 // Compatible via serialPersistentFields...
+ static class Test0008 // Compatible via serialPersistentFields...
implements Serializable
{
private static final long serialVersionUID = constantUID;
@@ -152,7 +152,7 @@
}
- private static class Test0009 // Compatible, but bad serialPersistentFields...
+ static class Test0009 // Compatible, but bad serialPersistentFields...
implements Serializable
{
private static final long serialVersionUID = constantUID;
@@ -171,7 +171,7 @@
}
- private static class Test0010 // Compatible, but different (and invalid) serialPersistentFields...
+ static class Test0010 // Compatible, but different (and invalid) serialPersistentFields...
implements Serializable
{
private static final long serialVersionUID = constantUID;
@@ -190,7 +190,7 @@
}
- private static class Test0011 // Compatible, but different (and valid) serialPersistentFields...
+ static class Test0011 // Compatible, but different (and valid) serialPersistentFields...
implements Serializable
{
private static final long serialVersionUID = constantUID;
@@ -211,7 +211,7 @@
}
}
- private static class Test0012 // "Same" as 0011, but with 'transient' keyword
+ static class Test0012 // "Same" as 0011, but with 'transient' keyword
implements Serializable
{
private static final long serialVersionUID = constantUID;
@@ -226,7 +226,7 @@
}
}
- private static class Test0013 // Battle of the overlapping specs
+ static class Test0013 // Battle of the overlapping specs
implements Serializable
{
private static final long serialVersionUID = constantUID;
@@ -245,7 +245,7 @@
}
- private static class Test0014 // Type mis-match but with an array
+ static class Test0014 // Type mis-match but with an array
implements Serializable
{
private static final long serialVersionUID = constantUID;
More information about the kaffe
mailing list