From 64bb2ce31108e2910571d450bdb0debeffd7f972 Mon Sep 17 00:00:00 2001
From: Harold Seigel <hseigel@openjdk.org>
Date: Thu, 2 Apr 2015 08:50:10 -0400
Subject: [PATCH] 8076236: VM permits illegal flags for class init method

Move check for multiple access flags so that it also covers instance initialization methods

Reviewed-by: ctornqvi, lfoltan
---
 .../share/vm/classfile/classFileParser.cpp    | 25 ++++++++++---------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp
index 748e76da495..52532918aeb 100644
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp
@@ -4838,20 +4838,21 @@ void ClassFileParser::verify_legal_method_modifiers(
       }
     }
   } else { // not interface
-    if (is_initializer) {
-      if (is_static || is_final || is_synchronized || is_native ||
-          is_abstract || (major_gte_15 && is_bridge)) {
-        is_illegal = true;
-      }
-    } else { // not initializer
-      if (is_abstract) {
-        if ((is_final || is_native || is_private || is_static ||
-            (major_gte_15 && (is_synchronized || is_strict)))) {
+    if (has_illegal_visibility(flags)) {
+      is_illegal = true;
+    } else {
+      if (is_initializer) {
+        if (is_static || is_final || is_synchronized || is_native ||
+            is_abstract || (major_gte_15 && is_bridge)) {
           is_illegal = true;
         }
-      }
-      if (has_illegal_visibility(flags)) {
-        is_illegal = true;
+      } else { // not initializer
+        if (is_abstract) {
+          if ((is_final || is_native || is_private || is_static ||
+              (major_gte_15 && (is_synchronized || is_strict)))) {
+            is_illegal = true;
+          }
+        }
       }
     }
   }