From 71901310d319aece11048cd2db53c39bc1061c17 Mon Sep 17 00:00:00 2001 From: Pavel Afremov Date: Thu, 6 Sep 2007 15:53:11 +0400 Subject: [PATCH] Fix Class parse method to avoid check 1.5 access flags in 1.4 class files. For class file version lower than 49 (1.5) three flags: ACC_ANNOTATION, ACC_ENUM and ACC_SYNTHETIC should be set to zero, according specification 4.5 Fields, for 1.4 Java. Fix consist in move of nulification befor check of the flags. --- vm/vmcore/src/class_support/Class_File_Loader.cpp | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/vm/vmcore/src/class_support/Class_File_Loader.cpp b/vm/vmcore/src/class_support/Class_File_Loader.cpp index 78a0ffe..e528d61 100644 --- a/vm/vmcore/src/class_support/Class_File_Loader.cpp +++ b/vm/vmcore/src/class_support/Class_File_Loader.cpp @@ -2824,6 +2824,12 @@ bool Class::parse(Global_Env* env, m_access_flags |= ACC_ABSTRACT; } + //for class file version lower than 49 these three flags should be set to zero + //See specification 4.5 Fields, for 1.4 Java. + if(m_version < JAVA5_CLASS_FILE_VERSION) { + m_access_flags &= ~(ACC_SYNTHETIC | ACC_ENUM | ACC_ANNOTATION); + } + /* * can't be both final and interface, or both final and abstract * See specification 4.2 about access_flags. @@ -2856,12 +2862,7 @@ bool Class::parse(Global_Env* env, REPORT_FAILED_CLASS_FORMAT(this, "not interface can't be annotation"); return false; } - //for class file version lower than 49 these three flags should be set to zero - //See specification 4.5 Fields, for 1.4 Java. - if(m_version < JAVA5_CLASS_FILE_VERSION) { - m_access_flags &= ~(ACC_SYNTHETIC | ACC_ENUM | ACC_ANNOTATION); - } - + /* * parse this_class & super_class & verify their constant pool entries */ -- 1.5.0.3