Fixes PR125.
[cacao.git] / src / vm / method.cpp
index 6389a4f86b9d727792fd11b731fbdf6e51982d95..4a166020146d006377d38f33694cbeffd02b347e 100644 (file)
@@ -201,7 +201,15 @@ bool method_load(classbuffer *cb, methodinfo *m, descriptor_pool *descpool)
                }
        }
 #endif /* ENABLE_VERIFIER */
-       
+
+       /* Ignore flags for class initializer according to section 4.6
+          of "The Java Virtual Machine Specification, 2nd Edition" (see PR125). */
+
+       if (m->name == utf_clinit) {
+               m->flags &= ACC_STRICT;
+               m->flags |= ACC_STATIC;
+       }
+
        if (!(m->flags & ACC_STATIC))
                argcount++; /* count the 'this' argument */