This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git


The following commit(s) were added to refs/heads/master by this push:
     new 0813b04  Raise embedded if into parent if.
0813b04 is described below

commit 0813b04f9c94a0088ce925ccb8556e9ded29f6a7
Author: Gary Gregory <gardgreg...@gmail.com>
AuthorDate: Sun Feb 28 12:15:58 2021 -0500

    Raise embedded if into parent if.
---
 src/examples/Mini/MiniParserTokenManager.java      |  9 +--
 .../java/org/apache/bcel/classfile/JavaClass.java  |  6 +-
 .../java/org/apache/bcel/classfile/Utility.java    |  8 +-
 .../org/apache/bcel/generic/ReferenceType.java     | 20 ++---
 src/main/java/org/apache/bcel/util/Class2HTML.java |  6 +-
 .../bcel/verifier/statics/LocalVariableInfo.java   | 16 ++--
 .../bcel/verifier/statics/Pass1Verifier.java       | 14 ++--
 .../bcel/verifier/statics/Pass3aVerifier.java      | 53 ++++++-------
 .../structurals/InstConstraintVisitor.java         | 91 +++++++++-------------
 .../bcel/verifier/structurals/LocalVariables.java  |  6 +-
 .../bcel/verifier/structurals/OperandStack.java    |  6 +-
 .../bcel/verifier/structurals/Subroutines.java     | 10 +--
 .../GeneratingAnnotatedClassesTestCase.java        |  7 +-
 .../bcel/generic/JdkGenericDumpTestCase.java       |  6 +-
 14 files changed, 103 insertions(+), 155 deletions(-)

diff --git a/src/examples/Mini/MiniParserTokenManager.java 
b/src/examples/Mini/MiniParserTokenManager.java
index bffe0b1..93be21f 100644
--- a/src/examples/Mini/MiniParserTokenManager.java
+++ b/src/examples/Mini/MiniParserTokenManager.java
@@ -74,12 +74,9 @@ static private int jjMoveNfa_1(final int startState, int 
curPos)
             switch(jjstateSet[--i])
             {
                case 0:
-                  if ((0x2400L & l) != 0L)
-                  {
-                     if (kind > 7) {
-                        kind = 7;
-                    }
-                  }
+                  if (((0x2400L & l) != 0L) && (kind > 7)) {
+                    kind = 7;
+                }
                   if (curChar == 13) {
                     jjstateSet[jjnewStateCnt++] = 1;
                 }
diff --git a/src/main/java/org/apache/bcel/classfile/JavaClass.java 
b/src/main/java/org/apache/bcel/classfile/JavaClass.java
index de8e260..13141fb 100644
--- a/src/main/java/org/apache/bcel/classfile/JavaClass.java
+++ b/src/main/java/org/apache/bcel/classfile/JavaClass.java
@@ -234,10 +234,8 @@ public class JavaClass extends AccessFlags implements 
Cloneable, Node, Comparabl
         final String parent = file.getParent();
         if (parent != null) {
             final File dir = new File(parent);
-            if (!dir.mkdirs()) { // either was not created or already existed
-                if (!dir.isDirectory()) {
-                    throw new IOException("Could not create the directory " + 
dir);
-                }
+            if (!dir.mkdirs() && !dir.isDirectory()) {
+                throw new IOException("Could not create the directory " + dir);
             }
         }
         try (DataOutputStream dos = new DataOutputStream(new 
FileOutputStream(file))) {
diff --git a/src/main/java/org/apache/bcel/classfile/Utility.java 
b/src/main/java/org/apache/bcel/classfile/Utility.java
index 9d3114d..153a51e 100644
--- a/src/main/java/org/apache/bcel/classfile/Utility.java
+++ b/src/main/java/org/apache/bcel/classfile/Utility.java
@@ -490,11 +490,9 @@ public abstract class Utility {
     public static String compactClassName( String str, final String prefix, 
final boolean chopit ) {
         final int len = prefix.length();
         str = str.replace('/', '.'); // Is `/' on all systems, even DOS
-        if (chopit) {
-            // If string starts with `prefix' and contains no further dots
-            if (str.startsWith(prefix) && (str.substring(len).indexOf('.') == 
-1)) {
-                str = str.substring(len);
-            }
+        // If string starts with `prefix' and contains no further dots
+        if (chopit && (str.startsWith(prefix) && 
(str.substring(len).indexOf('.') == -1))) {
+            str = str.substring(len);
         }
         return str;
     }
diff --git a/src/main/java/org/apache/bcel/generic/ReferenceType.java 
b/src/main/java/org/apache/bcel/generic/ReferenceType.java
index 4178cb6..d45224c 100644
--- a/src/main/java/org/apache/bcel/generic/ReferenceType.java
+++ b/src/main/java/org/apache/bcel/generic/ReferenceType.java
@@ -93,11 +93,9 @@ public abstract class ReferenceType extends Type {
             }
             /* If T is an interface type, this must implement interface T.
              */
-            if ((T instanceof ObjectType) && (((ObjectType) 
T).referencesInterfaceExact())) {
-                if (Repository.implementationOf(((ObjectType) 
this).getClassName(),
-                        ((ObjectType) T).getClassName())) {
-                    return true;
-                }
+            if (((T instanceof ObjectType) && (((ObjectType) 
T).referencesInterfaceExact())) && Repository.implementationOf(((ObjectType) 
this).getClassName(),
+                    ((ObjectType) T).getClassName())) {
+                return true;
             }
         }
         /* If this is an interface type, then:
@@ -105,10 +103,8 @@ public abstract class ReferenceType extends Type {
         if ((this instanceof ObjectType) && (((ObjectType) 
this).referencesInterfaceExact())) {
             /* If T is a class type, then T must be Object (�2.4.7).
              */
-            if ((T instanceof ObjectType) && (((ObjectType) 
T).referencesClassExact())) {
-                if (T.equals(Type.OBJECT)) {
-                    return true;
-                }
+            if (((T instanceof ObjectType) && (((ObjectType) 
T).referencesClassExact())) && T.equals(Type.OBJECT)) {
+                return true;
             }
             /* If T is an interface type, then T must be the same interface
              * as this or a superinterface of this (�2.13.2).
@@ -129,10 +125,8 @@ public abstract class ReferenceType extends Type {
         if (this instanceof ArrayType) {
             /* If T is a class type, then T must be Object (�2.4.7).
              */
-            if ((T instanceof ObjectType) && (((ObjectType) 
T).referencesClassExact())) {
-                if (T.equals(Type.OBJECT)) {
-                    return true;
-                }
+            if (((T instanceof ObjectType) && (((ObjectType) 
T).referencesClassExact())) && T.equals(Type.OBJECT)) {
+                return true;
             }
             /* If T is an array type TC[], that is, an array of components
              * of type TC, then one of the following must be true:
diff --git a/src/main/java/org/apache/bcel/util/Class2HTML.java 
b/src/main/java/org/apache/bcel/util/Class2HTML.java
index 1a34723..e1379a8 100644
--- a/src/main/java/org/apache/bcel/util/Class2HTML.java
+++ b/src/main/java/org/apache/bcel/util/Class2HTML.java
@@ -129,10 +129,8 @@ public class Class2HTML implements Constants {
                     final File store = new File(dir);
                     if (!store.isDirectory()) {
                         final boolean created = store.mkdirs(); // Create 
target directory if necessary
-                        if (!created) {
-                            if (!store.isDirectory()) {
-                                System.out.println("Tried to create the 
directory " + dir + " but failed");
-                            }
+                        if (!created && !store.isDirectory()) {
+                            System.out.println("Tried to create the directory 
" + dir + " but failed");
                         }
                     }
                 } else if (argv[i].equals("-zip")) {
diff --git 
a/src/main/java/org/apache/bcel/verifier/statics/LocalVariableInfo.java 
b/src/main/java/org/apache/bcel/verifier/statics/LocalVariableInfo.java
index 3db76d6..f83f290 100644
--- a/src/main/java/org/apache/bcel/verifier/statics/LocalVariableInfo.java
+++ b/src/main/java/org/apache/bcel/verifier/statics/LocalVariableInfo.java
@@ -102,17 +102,13 @@ public class LocalVariableInfo{
      *         with already gathered information.
      */
     private void add(final int offset, final String name, final Type t) throws 
LocalVariableInfoInconsistentException {
-        if (getName(offset) != null) {
-            if (!getName(offset).equals(name)) {
-                throw new LocalVariableInfoInconsistentException("At bytecode 
offset '" + offset
-                        + "' a local variable has two different names: '" + 
getName(offset) + "' and '" + name + "'.");
-            }
+        if ((getName(offset) != null) && !getName(offset).equals(name)) {
+            throw new LocalVariableInfoInconsistentException("At bytecode 
offset '" + offset
+                    + "' a local variable has two different names: '" + 
getName(offset) + "' and '" + name + "'.");
         }
-        if (getType(offset) != null) {
-            if (!getType(offset).equals(t)) {
-                throw new LocalVariableInfoInconsistentException("At bytecode 
offset '" + offset
-                        + "' a local variable has two different types: '" + 
getType(offset) + "' and '" + t + "'.");
-            }
+        if ((getType(offset) != null) && !getType(offset).equals(t)) {
+            throw new LocalVariableInfoInconsistentException("At bytecode 
offset '" + offset
+                    + "' a local variable has two different types: '" + 
getType(offset) + "' and '" + t + "'.");
         }
         setName(offset, name);
         setType(offset, t);
diff --git a/src/main/java/org/apache/bcel/verifier/statics/Pass1Verifier.java 
b/src/main/java/org/apache/bcel/verifier/statics/Pass1Verifier.java
index 89c2377..ad21dbf 100644
--- a/src/main/java/org/apache/bcel/verifier/statics/Pass1Verifier.java
+++ b/src/main/java/org/apache/bcel/verifier/statics/Pass1Verifier.java
@@ -148,14 +148,12 @@ public final class Pass1Verifier extends PassVerifier{
         try{
             jc = getJavaClass();    //loads in the class file if not already 
done.
 
-            if (jc != null) {
-                /* If we find more constraints to check, we should do this in 
an own method. */
-                if (! myOwner.getClassName().equals(jc.getClassName())) {
-                    // This should maybe caught by BCEL: In case of renamed 
.class files we get wrong
-                    // JavaClass objects here.
-                    throw new LoadingException("Wrong name: the internal name 
of the .class file '"+jc.getClassName()+
-                        "' does not match the file's name 
'"+myOwner.getClassName()+"'.");
-                }
+            /* If we find more constraints to check, we should do this in an 
own method. */
+            if ((jc != null) && ! 
myOwner.getClassName().equals(jc.getClassName())) {
+                // This should maybe caught by BCEL: In case of renamed .class 
files we get wrong
+                // JavaClass objects here.
+                throw new LoadingException("Wrong name: the internal name of 
the .class file '"+jc.getClassName()+
+                    "' does not match the file's name 
'"+myOwner.getClassName()+"'.");
             }
 
         }
diff --git a/src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java 
b/src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java
index ec17d9f..2d7884d 100644
--- a/src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java
+++ b/src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java
@@ -1063,12 +1063,10 @@ public final class Pass3aVerifier extends PassVerifier{
                 throw new AssertionViolatedException("Field '" + field_name + 
"' not found in " + jc.getClassName());
             }
 
-            if (f.isFinal()) {
-                if 
(!(myOwner.getClassName().equals(getObjectType(o).getClassName()))) {
-                    constraintViolated(o,
-                        "Referenced field '"+f+"' is final and must therefore 
be declared in the current class '"+
-                            myOwner.getClassName()+"' which is not the case: 
it is declared in '"+o.getReferenceType(constantPoolGen)+"'.");
-                }
+            if (f.isFinal() && 
!(myOwner.getClassName().equals(getObjectType(o).getClassName()))) {
+                constraintViolated(o,
+                    "Referenced field '"+f+"' is final and must therefore be 
declared in the current class '"+
+                        myOwner.getClassName()+"' which is not the case: it is 
declared in '"+o.getReferenceType(constantPoolGen)+"'.");
             }
 
             if (! (f.isStatic())) {
@@ -1224,38 +1222,35 @@ public final class Pass3aVerifier extends PassVerifier{
             }
 
             JavaClass current = Repository.lookupClass(myOwner.getClassName());
-            if (current.isSuper()) {
-
-                if ((Repository.instanceOf( current, jc )) && 
(!current.equals(jc))) {
+            if (current.isSuper() && ((Repository.instanceOf( current, jc )) 
&& (!current.equals(jc)))) {
 
-                    if (! 
(o.getMethodName(constantPoolGen).equals(Const.CONSTRUCTOR_NAME) )) {
-                        // Special lookup procedure for ACC_SUPER classes.
+                if (! 
(o.getMethodName(constantPoolGen).equals(Const.CONSTRUCTOR_NAME) )) {
+                    // Special lookup procedure for ACC_SUPER classes.
 
-                        int supidx = -1;
+                    int supidx = -1;
 
-                        Method meth = null;
-                        while (supidx != 0) {
-                            supidx = current.getSuperclassNameIndex();
-                            current = 
Repository.lookupClass(current.getSuperclassName());
+                    Method meth = null;
+                    while (supidx != 0) {
+                        supidx = current.getSuperclassNameIndex();
+                        current = 
Repository.lookupClass(current.getSuperclassName());
 
-                            final Method[] meths = current.getMethods();
-                            for (final Method meth2 : meths) {
-                                if    ( 
(meth2.getName().equals(o.getMethodName(constantPoolGen))) &&
-                                     
(Type.getReturnType(meth2.getSignature()).equals(o.getReturnType(constantPoolGen)))
 &&
-                                     
(objarrayequals(Type.getArgumentTypes(meth2.getSignature()), 
o.getArgumentTypes(constantPoolGen))) ) {
-                                    meth = meth2;
-                                    break;
-                                }
-                            }
-                            if (meth != null) {
+                        final Method[] meths = current.getMethods();
+                        for (final Method meth2 : meths) {
+                            if    ( 
(meth2.getName().equals(o.getMethodName(constantPoolGen))) &&
+                                 
(Type.getReturnType(meth2.getSignature()).equals(o.getReturnType(constantPoolGen)))
 &&
+                                 
(objarrayequals(Type.getArgumentTypes(meth2.getSignature()), 
o.getArgumentTypes(constantPoolGen))) ) {
+                                meth = meth2;
                                 break;
                             }
                         }
-                        if (meth == null) {
-                            constraintViolated(o, "ACC_SUPER special lookup 
procedure not successful: method '"+
-                                o.getMethodName(constantPoolGen)+"' with 
proper signature not declared in superclass hierarchy.");
+                        if (meth != null) {
+                            break;
                         }
                     }
+                    if (meth == null) {
+                        constraintViolated(o, "ACC_SUPER special lookup 
procedure not successful: method '"+
+                            o.getMethodName(constantPoolGen)+"' with proper 
signature not declared in superclass hierarchy.");
+                    }
                 }
             }
 
diff --git 
a/src/main/java/org/apache/bcel/verifier/structurals/InstConstraintVisitor.java 
b/src/main/java/org/apache/bcel/verifier/structurals/InstConstraintVisitor.java
index ce816bd..0cb5d6e 100644
--- 
a/src/main/java/org/apache/bcel/verifier/structurals/InstConstraintVisitor.java
+++ 
b/src/main/java/org/apache/bcel/verifier/structurals/InstConstraintVisitor.java
@@ -334,43 +334,40 @@ public class InstConstraintVisitor extends EmptyVisitor{
      */
     @Override
     public void visitLoadInstruction(final LoadInstruction o) {
-        //visitLocalVariableInstruction(o) is called before, because it is 
more generic.
+        // visitLocalVariableInstruction(o) is called before, because it is 
more generic.
 
         // LOAD instructions must not read Type.UNKNOWN
         if (locals().get(o.getIndex()) == Type.UNKNOWN) {
-            constraintViolated(o, "Read-Access on local variable 
"+o.getIndex()+" with unknown content.");
+            constraintViolated(o, "Read-Access on local variable " + 
o.getIndex() + " with unknown content.");
         }
 
         // LOAD instructions, two-slot-values at index N must have Type.UNKNOWN
         // as a symbol for the higher halve at index N+1
         // [suppose some instruction put an int at N+1--- our double at N is 
defective]
-        if (o.getType(cpg).getSize() == 2) {
-            if (locals().get(o.getIndex()+1) != Type.UNKNOWN) {
-                constraintViolated(o,
-                    "Reading a two-locals value from local variables 
"+o.getIndex()+
-                    " and "+(o.getIndex()+1)+" where the latter one is 
destroyed.");
-            }
+        if ((o.getType(cpg).getSize() == 2) && (locals().get(o.getIndex() + 1) 
!= Type.UNKNOWN)) {
+            constraintViolated(o, "Reading a two-locals value from local 
variables " + o.getIndex() + " and "
+                + (o.getIndex() + 1) + " where the latter one is destroyed.");
         }
 
         // LOAD instructions must read the correct type.
         if (!(o instanceof ALOAD)) {
-            if (locals().get(o.getIndex()) != o.getType(cpg) ) {
-                constraintViolated(o,"Local Variable type and LOADing 
Instruction type mismatch: Local Variable: '"+
-                    locals().get(o.getIndex())+"'; Instruction type: 
'"+o.getType(cpg)+"'.");
+            if (locals().get(o.getIndex()) != o.getType(cpg)) {
+                constraintViolated(o, "Local Variable type and LOADing 
Instruction type mismatch: Local Variable: '"
+                    + locals().get(o.getIndex()) + "'; Instruction type: '" + 
o.getType(cpg) + "'.");
             }
-        }
-        else{ // we deal with an ALOAD
+        } else { // we deal with an ALOAD
             if (!(locals().get(o.getIndex()) instanceof ReferenceType)) {
-                constraintViolated(o, "Local Variable type and LOADing 
Instruction type mismatch: Local Variable: '"+
-                    locals().get(o.getIndex())+"'; Instruction expects a 
ReferenceType.");
+                constraintViolated(o, "Local Variable type and LOADing 
Instruction type mismatch: Local Variable: '"
+                    + locals().get(o.getIndex()) + "'; Instruction expects a 
ReferenceType.");
             }
             // ALOAD __IS ALLOWED__ to put uninitialized objects onto the 
stack!
-            //referenceTypeIsInitialized(o, (ReferenceType) 
(locals().get(o.getIndex())));
+            // referenceTypeIsInitialized(o, (ReferenceType) 
(locals().get(o.getIndex())));
         }
 
         // LOAD instructions must have enough free stack slots.
         if ((stack().maxStack() - stack().slotsUsed()) < 
o.getType(cpg).getSize()) {
-            constraintViolated(o, "Not enough free stack slots to load a 
'"+o.getType(cpg)+"' onto the OperandStack.");
+            constraintViolated(o,
+                "Not enough free stack slots to load a '" + o.getType(cpg) + 
"' onto the OperandStack.");
         }
     }
 
@@ -464,14 +461,12 @@ public class InstConstraintVisitor extends EmptyVisitor{
         final Type index    = stack().peek(0);
 
         indexOfInt(o, index);
-        if (arrayrefOfArrayType(o, arrayref)) {
-            if (! (((ArrayType) arrayref).getElementType() instanceof 
ReferenceType)) {
-                constraintViolated(o,
-                    "The 'arrayref' does not refer to an array with elements 
of a ReferenceType but to an array of "+
-                    ((ArrayType) arrayref).getElementType()+".");
-            }
-            //referenceTypeIsInitialized(o, (ReferenceType) (((ArrayType) 
arrayref).getElementType()));
+        if (arrayrefOfArrayType(o, arrayref) && ! (((ArrayType) 
arrayref).getElementType() instanceof ReferenceType)) {
+            constraintViolated(o,
+                "The 'arrayref' does not refer to an array with elements of a 
ReferenceType but to an array of "+
+                ((ArrayType) arrayref).getElementType()+".");
         }
+        //referenceTypeIsInitialized(o, (ReferenceType) (((ArrayType) 
arrayref).getElementType()));
     }
 
     /**
@@ -491,13 +486,11 @@ public class InstConstraintVisitor extends EmptyVisitor{
         }
         // Don't bother further with "referenceTypeIsInitialized()", there are 
no arrays
         // of an uninitialized object type.
-        if (arrayrefOfArrayType(o, arrayref)) {
-            if (! (((ArrayType) arrayref).getElementType() instanceof 
ReferenceType)) {
-                constraintViolated(o, "The 'arrayref' does not refer to an 
array with elements of a ReferenceType but to an array of "+
-                    ((ArrayType) arrayref).getElementType()+".");
-            }
-            // No check for array element assignment compatibility. This is 
done at runtime.
+        if (arrayrefOfArrayType(o, arrayref) && ! (((ArrayType) 
arrayref).getElementType() instanceof ReferenceType)) {
+            constraintViolated(o, "The 'arrayref' does not refer to an array 
with elements of a ReferenceType but to an array of "+
+                ((ArrayType) arrayref).getElementType()+".");
         }
+        // No check for array element assignment compatibility. This is done 
at runtime.
     }
 
     /**
@@ -609,13 +602,11 @@ public class InstConstraintVisitor extends EmptyVisitor{
         final Type arrayref = stack().peek(1);
         final Type index    = stack().peek(0);
         indexOfInt(o, index);
-        if (arrayrefOfArrayType(o, arrayref)) {
-            if (! ( (((ArrayType) 
arrayref).getElementType().equals(Type.BOOLEAN)) ||
-                    (((ArrayType) 
arrayref).getElementType().equals(Type.BYTE)) ) ) {
-                constraintViolated(o,
-                    "The 'arrayref' does not refer to an array with elements 
of a Type.BYTE or Type.BOOLEAN but to an array of '"+
-                    ((ArrayType) arrayref).getElementType()+"'.");
-            }
+        if (arrayrefOfArrayType(o, arrayref) && ! ( (((ArrayType) 
arrayref).getElementType().equals(Type.BOOLEAN)) ||
+                (((ArrayType) arrayref).getElementType().equals(Type.BYTE)) ) 
) {
+            constraintViolated(o,
+                "The 'arrayref' does not refer to an array with elements of a 
Type.BYTE or Type.BOOLEAN but to an array of '"+
+                ((ArrayType) arrayref).getElementType()+"'.");
         }
     }
 
@@ -630,13 +621,11 @@ public class InstConstraintVisitor extends EmptyVisitor{
 
         indexOfInt(o, index);
         valueOfInt(o, value);
-        if (arrayrefOfArrayType(o, arrayref)) {
-            if (! ( (((ArrayType) 
arrayref).getElementType().equals(Type.BOOLEAN)) ||
-                    (((ArrayType) 
arrayref).getElementType().equals(Type.BYTE)) ) ) {
-                constraintViolated(o,
-                    "The 'arrayref' does not refer to an array with elements 
of a Type.BYTE or Type.BOOLEAN but to an array of '"+
-                    ((ArrayType) arrayref).getElementType()+"'.");
-            }
+        if (arrayrefOfArrayType(o, arrayref) && ! ( (((ArrayType) 
arrayref).getElementType().equals(Type.BOOLEAN)) ||
+                (((ArrayType) arrayref).getElementType().equals(Type.BYTE)) ) 
) {
+            constraintViolated(o,
+                "The 'arrayref' does not refer to an array with elements of a 
Type.BYTE or Type.BOOLEAN but to an array of '"+
+                ((ArrayType) arrayref).getElementType()+"'.");
         }
     }
 
@@ -680,11 +669,9 @@ public class InstConstraintVisitor extends EmptyVisitor{
 
         indexOfInt(o, index);
         valueOfInt(o, value);
-        if (arrayrefOfArrayType(o, arrayref)) {
-            if (! ((ArrayType) arrayref).getElementType().equals(Type.CHAR) ) {
-                constraintViolated(o, "The 'arrayref' does not refer to an 
array with elements of type char but to an array of type "+
-                    ((ArrayType) arrayref).getElementType()+".");
-            }
+        if (arrayrefOfArrayType(o, arrayref) && ! ((ArrayType) 
arrayref).getElementType().equals(Type.CHAR) ) {
+            constraintViolated(o, "The 'arrayref' does not refer to an array 
with elements of type char but to an array of type "+
+                ((ArrayType) arrayref).getElementType()+".");
         }
     }
 
@@ -2877,10 +2864,8 @@ public class InstConstraintVisitor extends EmptyVisitor{
      */
     @Override
     public void visitRETURN(final RETURN o) {
-        if (mg.getName().equals(Const.CONSTRUCTOR_NAME)) {// If we leave an 
<init> method
-            if ((Frame.getThis() != null) && 
(!(mg.getClassName().equals(Type.OBJECT.getClassName()))) ) {
-                constraintViolated(o, "Leaving a constructor that itself did 
not call a constructor.");
-            }
+        if (mg.getName().equals(Const.CONSTRUCTOR_NAME) && ((Frame.getThis() 
!= null) && (!(mg.getClassName().equals(Type.OBJECT.getClassName())))) ) {
+            constraintViolated(o, "Leaving a constructor that itself did not 
call a constructor.");
         }
     }
 
diff --git 
a/src/main/java/org/apache/bcel/verifier/structurals/LocalVariables.java 
b/src/main/java/org/apache/bcel/verifier/structurals/LocalVariables.java
index 88dac52..eaeecb7 100644
--- a/src/main/java/org/apache/bcel/verifier/structurals/LocalVariables.java
+++ b/src/main/java/org/apache/bcel/verifier/structurals/LocalVariables.java
@@ -164,10 +164,8 @@ public class LocalVariables implements Cloneable {
                 "Backwards branch with an uninitialized object in the local 
variables detected.");
         }
         // If we just didn't know that it was initialized, we have now learned.
-        if (locals[i] instanceof UninitializedObjectType) {
-            if (! (lv.locals[i] instanceof UninitializedObjectType)) {
-                locals[i] = ((UninitializedObjectType) 
locals[i]).getInitialized();
-            }
+        if ((locals[i] instanceof UninitializedObjectType) && !(lv.locals[i] 
instanceof UninitializedObjectType)) {
+            locals[i] = ((UninitializedObjectType) locals[i]).getInitialized();
         }
         if ((locals[i] instanceof ReferenceType) && (lv.locals[i] instanceof 
ReferenceType)) {
             if (! locals[i].equals(lv.locals[i])) { // needed in case of two 
UninitializedObjectType instances
diff --git 
a/src/main/java/org/apache/bcel/verifier/structurals/OperandStack.java 
b/src/main/java/org/apache/bcel/verifier/structurals/OperandStack.java
index 987227e..7219165 100644
--- a/src/main/java/org/apache/bcel/verifier/structurals/OperandStack.java
+++ b/src/main/java/org/apache/bcel/verifier/structurals/OperandStack.java
@@ -236,10 +236,8 @@ public class OperandStack implements Cloneable {
                 throw new StructuralCodeConstraintException("Backwards branch 
with an uninitialized object on the stack detected.");
             }
             // on the other hand...
-            if (stack.get(i) instanceof UninitializedObjectType) { //if we 
have an uninitialized object here
-                if (! (s.stack.get(i) instanceof UninitializedObjectType)) { 
//that has been initialized by now
-                    stack.set(i, ((UninitializedObjectType) 
(stack.get(i))).getInitialized() ); //note that.
-                }
+            if ((stack.get(i) instanceof UninitializedObjectType) && 
!(s.stack.get(i) instanceof UninitializedObjectType)) { //that has been 
initialized by now
+                stack.set(i, ((UninitializedObjectType) 
(stack.get(i))).getInitialized() ); //note that.
             }
             if (! stack.get(i).equals(s.stack.get(i))) {
                 if (    (stack.get(i) instanceof ReferenceType) &&
diff --git 
a/src/main/java/org/apache/bcel/verifier/structurals/Subroutines.java 
b/src/main/java/org/apache/bcel/verifier/structurals/Subroutines.java
index 33a6346..52642f5 100644
--- a/src/main/java/org/apache/bcel/verifier/structurals/Subroutines.java
+++ b/src/main/java/org/apache/bcel/verifier/structurals/Subroutines.java
@@ -500,12 +500,10 @@ public class Subroutines{
                 while (_protected != handler.getEndPC().getNext()) {
                     // Note the inclusive/inclusive notation of "generic API" 
exception handlers!
                     for (final Subroutine sub : subroutines.values()) {
-                        if (sub != subroutines.get(all[0])) {    // We don't 
want to forbid top-level exception handlers.
-                            if (sub.contains(_protected)) {
-                                throw new 
StructuralCodeConstraintException("Subroutine instruction '"+_protected+
-                                    "' is protected by an exception handler, 
'"+handler+
-                                    "'. This is forbidden by the JustIce 
verifier due to its clear definition of subroutines.");
-                            }
+                        if ((sub != subroutines.get(all[0])) && 
sub.contains(_protected)) {
+                            throw new 
StructuralCodeConstraintException("Subroutine instruction '"+_protected+
+                                "' is protected by an exception handler, 
'"+handler+
+                                "'. This is forbidden by the JustIce verifier 
due to its clear definition of subroutines.");
                         }
                     }
                     _protected = _protected.getNext();
diff --git 
a/src/test/java/org/apache/bcel/generic/GeneratingAnnotatedClassesTestCase.java 
b/src/test/java/org/apache/bcel/generic/GeneratingAnnotatedClassesTestCase.java
index ca44de1..704b439 100644
--- 
a/src/test/java/org/apache/bcel/generic/GeneratingAnnotatedClassesTestCase.java
+++ 
b/src/test/java/org/apache/bcel/generic/GeneratingAnnotatedClassesTestCase.java
@@ -332,11 +332,8 @@ public class GeneratingAnnotatedClassesTestCase extends 
AbstractTestCase
         boolean found = false;
         for (final Object name : l) {
             final ElementValuePairGen element = (ElementValuePairGen) name;
-            if (element.getNameString().equals("dval"))
-            {
-                if (element.getValue().stringifyValue().equals("33.4")) {
-                    found = true;
-                }
+            if (element.getNameString().equals("dval") && 
element.getValue().stringifyValue().equals("33.4")) {
+                found = true;
             }
         }
         assertTrue(found, "Did not find double annotation value with value 
33.4");
diff --git a/src/test/java/org/apache/bcel/generic/JdkGenericDumpTestCase.java 
b/src/test/java/org/apache/bcel/generic/JdkGenericDumpTestCase.java
index 3390fc4..7bcf30e 100644
--- a/src/test/java/org/apache/bcel/generic/JdkGenericDumpTestCase.java
+++ b/src/test/java/org/apache/bcel/generic/JdkGenericDumpTestCase.java
@@ -177,10 +177,8 @@ public class JdkGenericDumpTestCase {
             if (Advapi32Util.registryKeyExists(HKEY_LOCAL_MACHINE, keyJavaHome 
+ "\\" + key)) {
                 final String javaHome = 
Advapi32Util.registryGetStringValue(HKEY_LOCAL_MACHINE,
                     keyJavaHome + "\\" + key, "JavaHome");
-                if (StringUtils.isNoneBlank(javaHome)) {
-                    if (new File(javaHome).exists()) {
-                        javaHomes.add(javaHome);
-                    }
+                if (StringUtils.isNoneBlank(javaHome) && new 
File(javaHome).exists()) {
+                    javaHomes.add(javaHome);
                 }
             }
         }

Reply via email to