commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject svn commit: r1646254 - /commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java
Date Wed, 17 Dec 2014 14:28:08 GMT
Author: ebourg
Date: Wed Dec 17 14:28:08 2014
New Revision: 1646254

URL: http://svn.apache.org/r1646254
Log:
Check the flags on the instance initialization methods only when inspecting a class

Modified:
    commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java?rev=1646254&r1=1646253&r2=1646254&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java
Wed Dec 17 14:28:08 2014
@@ -677,6 +677,19 @@ public final class Pass2Verifier extends
                         throw new ClassConstraintException("Abstract method '"+tostring(obj)+"'
must not have the ACC_SYNCHRONIZED modifier set.");
                     }
                 }
+
+                // A specific instance initialization method... (vmspec2,Page 116).
+                if (name.equals(CONSTRUCTOR_NAME)) {
+                    //..may have at most one of ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC set:
is checked above.
+                    //..may also have ACC_STRICT set, but none of the other flags in table
4.5 (vmspec2, page 115)
+                    if (obj.isStatic() ||
+                            obj.isFinal() ||
+                            obj.isSynchronized() ||
+                            obj.isNative() ||
+                            obj.isAbstract()) {
+                        throw new ClassConstraintException("Instance initialization method
'" + tostring(obj) + "' must not have any of the ACC_STATIC, ACC_FINAL, ACC_SYNCHRONIZED,
ACC_NATIVE, ACC_ABSTRACT modifiers set.");
+                    }
+                }
             }
             else{ // isInterface!
                 if (!name.equals(STATIC_INITIALIZER_NAME)){//vmspec2, p.116, 2nd paragraph
@@ -711,19 +724,6 @@ public final class Pass2Verifier extends
                 }
             }
 
-            // A specific instance initialization method... (vmspec2,Page 116).
-            if (name.equals(CONSTRUCTOR_NAME)){
-                //..may have at most one of ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC set: is
checked above.
-                //..may also have ACC_STRICT set, but none of the other flags in table 4.5
(vmspec2, page 115)
-                if (    obj.isStatic() ||
-                            obj.isFinal() ||
-                            obj.isSynchronized() ||
-                            obj.isNative() ||
-                            obj.isAbstract() ){
-                    throw new ClassConstraintException("Instance initialization method '"+tostring(obj)+"'
must not have any of the ACC_STATIC, ACC_FINAL, ACC_SYNCHRONIZED, ACC_NATIVE, ACC_ABSTRACT
modifiers set.");
-                }
-            }
-
             // Class and interface initialization methods...
             if (name.equals(STATIC_INITIALIZER_NAME)){
                 if ((obj.getAccessFlags() & (~ACC_STRICT)) > 0){



Mime
View raw message