From 73389fa4a2ec749ef646627ef69c6245a8d862a4 Mon Sep 17 00:00:00 2001 From: Bryce McKinlay Date: Fri, 13 Aug 2004 18:26:00 +0000 Subject: [PATCH] re PR libgcj/17020 (gij should ignore all reserved method flags) PR libgcj/17020 Reported by Robin Green. * defineclass.cc (handleField): Don't throw exception on unrecognised modifier. Add FIXME comments for spec compliance. (handleMethod): Likewise. From-SVN: r85952 --- libjava/ChangeLog | 8 ++++++++ libjava/defineclass.cc | 21 ++++++++++----------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 053ffef084a..8a86bc9000d 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,11 @@ +2004-08-13 Bryce McKinlay + + PR libgcj/17020 + Reported by Robin Green. + * defineclass.cc (handleField): Don't throw exception on unrecognised + modifier. Add FIXME comments for spec compliance. + (handleMethod): Likewise. + 2004-08-10 Hans Boehm PR libgcj/16662 diff --git a/libjava/defineclass.cc b/libjava/defineclass.cc index ad40fc8f7fc..5cd6b009be5 100644 --- a/libjava/defineclass.cc +++ b/libjava/defineclass.cc @@ -1096,16 +1096,15 @@ void _Jv_ClassReader::handleField (int field_no, throw_class_format_error ("duplicate field name"); } - if (field->flags & (Modifier::SYNCHRONIZED - | Modifier::NATIVE - | Modifier::INTERFACE - | Modifier::ABSTRACT)) - throw_class_format_error ("erroneous field access flags"); - + // At most one of PUBLIC, PRIVATE, or PROTECTED is allowed. if (1 < ( ((field->flags & Modifier::PUBLIC) ? 1 : 0) +((field->flags & Modifier::PRIVATE) ? 1 : 0) +((field->flags & Modifier::PROTECTED) ? 1 : 0))) throw_class_format_error ("erroneous field access flags"); + + // FIXME: JVM spec S4.5: Verify ACC_FINAL and ACC_VOLATILE are not + // both set. Verify modifiers for interface fields. + } if (verify) @@ -1256,15 +1255,15 @@ void _Jv_ClassReader::handleMethod throw_class_format_error ("duplicate method"); } - if (method->accflags & (Modifier::VOLATILE - | Modifier::TRANSIENT - | Modifier::INTERFACE)) - throw_class_format_error ("erroneous method access flags"); - + // At most one of PUBLIC, PRIVATE, or PROTECTED is allowed. if (1 < ( ((method->accflags & Modifier::PUBLIC) ? 1 : 0) +((method->accflags & Modifier::PRIVATE) ? 1 : 0) +((method->accflags & Modifier::PROTECTED) ? 1 : 0))) throw_class_format_error ("erroneous method access flags"); + + // FIXME: JVM spec S4.6: if ABSTRACT modifier is set, verify other + // flags are not set. Verify flags for interface methods. Verifiy + // modifiers for initializers. } } -- 2.30.2