* src/vmcore/class.c (class_define): Added protection domain to
[cacao.git] / src / vmcore / class.c
index 05f04dffd456390b493828282e52c45bfb1ff38c..e0676a3707f42da4b76cbd3f06d614908deeec87 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: class.c 8339 2007-08-17 21:21:51Z twisti $
+   $Id: class.c 8387 2007-08-21 15:37:47Z twisti $
 
 */
 
@@ -294,7 +294,7 @@ void class_postset_header_vftbl(void)
 
 *******************************************************************************/
 
-classinfo *class_define(utf *name, classloader *cl, int32_t length, const uint8_t *data)
+classinfo *class_define(utf *name, classloader *cl, int32_t length, const uint8_t *data, java_handle_t *pd)
 {
        classinfo   *c;
        classinfo   *r;
@@ -360,6 +360,14 @@ classinfo *class_define(utf *name, classloader *cl, int32_t length, const uint8_
                return NULL;
        }
 
+#if defined(ENABLE_JAVASE)
+# if defined(WITH_CLASSPATH_SUN)
+       /* Store the protection domain. */
+
+       c->protectiondomain = pd;
+# endif
+#endif
+
        /* Store the newly defined class in the class cache. This call
           also checks whether a class of the same name has already been
           defined by the same defining loader, and if so, replaces the
@@ -1533,11 +1541,12 @@ static classinfo *class_resolve_superclass(classinfo *c)
        if (c->super.any == NULL)
                return NULL;
 
-       /* Do we have a super class reference or is it already
-          resolved? */
+       /* Check if the super class is a reference. */
 
        if (IS_CLASSREF(c->super)) {
+               /* XXX I'm very sure this is not correct. */
                super = resolve_classref_or_classinfo_eager(c->super, true);
+/*             super = resolve_classref_or_classinfo_eager(c->super, false); */
 
                if (super == NULL)
                        return NULL;
@@ -1566,7 +1575,13 @@ bool class_issubclass(classinfo *sub, classinfo *super)
                if (sub == super)
                        return true;
 
-               sub = class_resolve_superclass(sub);
+/*             sub = class_resolve_superclass(sub); */
+               if (sub->super.any == NULL)
+                       return false;
+
+               assert(IS_CLASSREF(sub->super) == 0);
+
+               sub = sub->super.cls;
        }
 }