Merge pull request #30 from apache/dependabot/maven/junit-junit-4.13.2

Bump junit from 4.13.1 to 4.13.2
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 55cd006..f0f1410 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -24,23 +24,19 @@
     continue-on-error: ${{ matrix.experimental }}
     strategy:
       matrix:
-        java: [ 8, 11, 15 ]
+        java: [ 8, 11, 16 ]
         experimental: [false]
         include:
-          - java: 16-ea
-            experimental: true        
-        
+          - java: 17-ea
+            experimental: true
+
     steps:
     - uses: actions/checkout@v2.3.4
-    - uses: actions/cache@v2.1.4
-      with:
-        path: ~/.m2/repository
-        key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
-        restore-keys: |
-          ${{ runner.os }}-maven-
     - name: Set up JDK ${{ matrix.java }}
-      uses: actions/setup-java@v1.4.3
+      uses: actions/setup-java@v2
       with:
+        distribution: adopt
         java-version: ${{ matrix.java }}
+        cache: 'maven'
     - name: Build with Maven
       run: mvn -V -Ddoclint=all --file pom.xml --no-transfer-progress
diff --git a/.travis.yml b/.travis.yml
index cc26727..cefab1c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,7 +22,7 @@
 jdk:

   - openjdk8

   - openjdk11

-  - openjdk15

+  - openjdk16

   - openjdk-ea

 

 matrix:

diff --git a/pom.xml b/pom.xml
index 0e3f432..be7f18d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -213,7 +213,7 @@
     <dependency>
       <groupId>ognl</groupId>
       <artifactId>ognl</artifactId>
-      <version>3.2.18</version>
+      <version>3.2.21</version>
       <scope>test</scope>
     </dependency>
   </dependencies>
@@ -398,7 +398,7 @@
           </plugin>
           <plugin>
             <artifactId>maven-pmd-plugin</artifactId>
-            <version>3.14.0</version>
+            <version>3.15.0</version>
             <configuration>
               <targetJdk>${maven.compile.target}</targetJdk>
             </configuration>
@@ -481,7 +481,7 @@
         <dependency>
           <groupId>org.slf4j</groupId>
           <artifactId>slf4j-api</artifactId>
-          <version>1.7.30</version>
+          <version>1.7.32</version>
           <scope>test</scope>
         </dependency>
         <dependency>
@@ -555,7 +555,6 @@
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-antrun-plugin</artifactId>
-            <version>3.0.0</version>
             <executions>
               <execution>
                 <id>prepare-checkout</id>
@@ -566,23 +565,18 @@
                 <configuration>
                   <tasks>
                     <exec executable="svn">
-                      <arg line="checkout ${commons.scmPubUrl} ${commons.scmPubCheckoutDirectory}" />
+                      <arg line="checkout --depth immediates ${commons.scmPubUrl} ${commons.scmPubCheckoutDirectory}" />
                     </exec>
-                    <!-- in case of paths to ignore (added manually) -->
-                    <!--
+
                     <exec executable="svn">
-                      <arg line="update - -set-depth exclude ${commons.scmPubCheckoutDirectory}/javadocs" />
+                      <arg line="update --set-depth exclude ${commons.scmPubCheckoutDirectory}/javadocs" />
                     </exec>
 
                     <pathconvert pathsep=" " property="dirs">
                       <dirset dir="${commons.scmPubCheckoutDirectory}" includes="*" />
                     </pathconvert>
                     <exec executable="svn">
-                      <arg line="update - -set-depth infinity ${dirs}" />
-                    </exec>
-                    -->
-                    <exec executable="svn">
-                      <arg line="update" />
+                      <arg line="update --set-depth infinity ${dirs}" />
                     </exec>
                   </tasks>
                 </configuration>
diff --git a/src/main/java/org/apache/commons/ognl/ASTAdd.java b/src/main/java/org/apache/commons/ognl/ASTAdd.java
index 12fe65a..04a4427 100644
--- a/src/main/java/org/apache/commons/ognl/ASTAdd.java
+++ b/src/main/java/org/apache/commons/ognl/ASTAdd.java
@@ -98,11 +98,11 @@
         {
             return false;
         }
-        else if ( parent == null && String.class.isAssignableFrom( lastType.getGetterClass() ) )
+        if ( parent == null && String.class.isAssignableFrom( lastType.getGetterClass() ) )
         {
             return true;
         }
-        else if ( parent == null && String.class.isAssignableFrom( type.getGetterClass() ) )
+        if ( parent == null && String.class.isAssignableFrom( type.getGetterClass() ) )
         {
             return false;
         }
@@ -143,7 +143,7 @@
     {
         try
         {
-            String result = "";
+            StringBuilder result = new StringBuilder();
             NodeType lastType = null;
 
             // go through once to determine the ultimate type
@@ -159,7 +159,7 @@
                 {
                     aChildren.toGetSourceString( context, target );
 
-                    if ( NodeType.class.isInstance( aChildren ) && ( (NodeType) aChildren ).getGetterClass() != null
+                    if ( aChildren instanceof NodeType && ( (NodeType) aChildren ).getGetterClass() != null
                         && isWider( (NodeType) aChildren, lastType ) )
                     {
                         lastType = (NodeType) aChildren;
@@ -183,13 +183,13 @@
                 {
                     if ( i > 0 )
                     {
-                        result += " " + getExpressionOperator( i ) + " ";
+                        result.append(" ").append(getExpressionOperator(i)).append(" ");
                     }
 
                     String expr = children[i].toGetSourceString( context, target );
 
-                    if ( ( expr != null && "null".equals( expr ) )
-                        || ( !ASTConst.class.isInstance( children[i] )
+                    if ( ( "null".equals( expr ) )
+                        || ( !(children[i] instanceof ASTConst)
                         && ( expr == null || expr.trim().isEmpty() ) ) )
                     {
                         expr = "null";
@@ -198,12 +198,12 @@
                     // System.out.println("astadd child class: " + _children[i].getClass().getName() +
                     // " and return expr: " + expr);
 
-                    if ( ASTProperty.class.isInstance( children[i] ) )
+                    if (children[i] instanceof ASTProperty)
                     {
                         expr = ExpressionCompiler.getRootExpression( children[i], context.getRoot(), context ) + expr;
                         context.setCurrentAccessor( context.getRoot().getClass() );
                     }
-                    else if ( ASTMethod.class.isInstance( children[i] ) )
+                    else if (children[i] instanceof ASTMethod)
                     {
                         String chain = (String) context.get( "_currentChain" );
                         String rootExpr =
@@ -215,27 +215,27 @@
                         // dirty fix for overly aggressive casting dot operations
                         if ( rootExpr.endsWith( "." ) && chain != null && chain.startsWith( ")." ) )
                         {
-                            chain = chain.substring( 1, chain.length() );
+                            chain = chain.substring( 1 );
                         }
 
                         expr = rootExpr + ( chain != null ? chain + "." : "" ) + expr;
                         context.setCurrentAccessor( context.getRoot().getClass() );
 
                     }
-                    else if ( ExpressionNode.class.isInstance( children[i] ) )
+                    else if (children[i] instanceof ExpressionNode)
                     {
                         expr = "(" + expr + ")";
                     }
-                    else if ( ( parent == null || !ASTChain.class.isInstance( parent ) )
-                        && ASTChain.class.isInstance( children[i] ) )
+                    else if ( ( parent == null || !(parent instanceof ASTChain))
+                        && children[i] instanceof ASTChain)
                     {
                         String rootExpr =
                             ExpressionCompiler.getRootExpression( children[i], context.getRoot(), context );
 
-                        if ( !ASTProperty.class.isInstance( children[i].jjtGetChild( 0 ) ) && rootExpr.endsWith( ")" )
+                        if ( !(children[i].jjtGetChild(0) instanceof ASTProperty) && rootExpr.endsWith( ")" )
                             && expr.startsWith( ")" ) )
                         {
-                            expr = expr.substring( 1, expr.length() );
+                            expr = expr.substring( 1 );
                         }
 
                         expr = rootExpr + expr;
@@ -253,36 +253,36 @@
                     // turn quoted characters into quoted strings
 
                     if ( context.getCurrentType() != null && context.getCurrentType() == Character.class
-                        && ASTConst.class.isInstance( children[i] ) )
+                        && children[i] instanceof ASTConst)
                     {
-                        expr = expr.replaceAll( "'", "\"" );
+                        expr = expr.replace( "'", "\"" );
                         context.setCurrentType( String.class );
                     }
                     else
                     {
 
                         if ( !ASTVarRef.class.isAssignableFrom( children[i].getClass() )
-                            && !ASTProperty.class.isInstance( children[i] )
-                            && !ASTMethod.class.isInstance( children[i] )
-                            && !ASTSequence.class.isInstance( children[i] )
-                            && !ASTChain.class.isInstance( children[i] )
+                            && !(children[i] instanceof ASTProperty)
+                            && !(children[i] instanceof ASTMethod)
+                            && !(children[i] instanceof ASTSequence)
+                            && !(children[i] instanceof ASTChain)
                             && !NumericExpression.class.isAssignableFrom( children[i].getClass() )
-                            && !ASTStaticField.class.isInstance( children[i] )
-                            && !ASTStaticMethod.class.isInstance( children[i] )
-                            && !ASTTest.class.isInstance( children[i] ) )
+                            && !(children[i] instanceof ASTStaticField)
+                            && !(children[i] instanceof ASTStaticMethod)
+                            && !(children[i] instanceof ASTTest))
                         {
                             if ( lastType != null && String.class.isAssignableFrom( lastType.getGetterClass() ) )
                             {
                                 // System.out.println("Input expr >>" + expr + "<<");
-                                expr = expr.replaceAll( "&quot;", "\"" );
-                                expr = expr.replaceAll( "\"", "'" );
+                                expr = expr.replace( "&quot;", "\"" );
+                                expr = expr.replace( "\"", "'" );
                                 expr = format( "\"%s\"", expr );
                                 // System.out.println("Expr now >>" + expr + "<<");
                             }
                         }
                     }
 
-                    result += expr;
+                    result.append(expr);
 
                     // hanlde addition for numeric types when applicable or just string concatenation
 
@@ -292,16 +292,16 @@
                     {
                         if ( context.getCurrentType() != null
                             && Number.class.isAssignableFrom( context.getCurrentType() )
-                            && !ASTMethod.class.isInstance( children[i] ) )
+                            && !(children[i] instanceof ASTMethod))
                         {
-                            if ( ASTVarRef.class.isInstance( children[i] )
-                                || ASTProperty.class.isInstance( children[i] )
-                                || ASTChain.class.isInstance( children[i] ) )
+                            if ( children[i] instanceof ASTVarRef
+                                || children[i] instanceof ASTProperty
+                                || children[i] instanceof ASTChain)
                             {
-                                result += ".";
+                                result.append(".");
                             }
 
-                            result += OgnlRuntime.getNumericValueGetter( context.getCurrentType() );
+                            result.append(OgnlRuntime.getNumericValueGetter(context.getCurrentType()));
                             context.setCurrentType( OgnlRuntime.getPrimitiveWrapperClass( context.getCurrentType() ) );
                         }
                     }
@@ -335,7 +335,7 @@
                 throw OgnlOps.castToRuntime( t );
             }
 
-            return result;
+            return result.toString();
 
         }
         catch ( Throwable t )
@@ -343,7 +343,7 @@
             throw OgnlOps.castToRuntime( t );
         }
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTAnd.java b/src/main/java/org/apache/commons/ognl/ASTAnd.java
index 41585e4..ff21a5e 100644
--- a/src/main/java/org/apache/commons/ognl/ASTAnd.java
+++ b/src/main/java/org/apache/commons/ognl/ASTAnd.java
@@ -230,7 +230,7 @@
 
         return result;
     }
-    
+
     /* (non-Javadoc)
      * @see org.apache.commons.ognl.Node#accept(org.apache.commons.ognl.NodeVisitor, java.lang.Object)
      */
diff --git a/src/main/java/org/apache/commons/ognl/ASTAssign.java b/src/main/java/org/apache/commons/ognl/ASTAssign.java
index 5992594..7a6d3aa 100644
--- a/src/main/java/org/apache/commons/ognl/ASTAssign.java
+++ b/src/main/java/org/apache/commons/ognl/ASTAssign.java
@@ -53,7 +53,7 @@
         String first = children[0].toGetSourceString( context, target );
         String second = "";
 
-        if ( ASTProperty.class.isInstance( children[1] ) )
+        if (children[1] instanceof ASTProperty)
         {
             second += "((" + OgnlRuntime.getCompiler( context ).getClassName( target.getClass() ) + ")$2).";
         }
@@ -79,8 +79,8 @@
                                                                 Object.class );
         }
 
-        if ( NodeType.class.isInstance( children[1] ) && !ASTProperty.class.isInstance( children[1] )
-            && ( (NodeType) children[1] ).getGetterClass() != null && !OrderedReturn.class.isInstance( children[1] ) )
+        if ( children[1] instanceof NodeType && !(children[1] instanceof ASTProperty)
+            && ( (NodeType) children[1] ).getGetterClass() != null && !(children[1] instanceof OrderedReturn))
         {
 
             second = "new " + ( (NodeType) children[1] ).getGetterClass().getName() + "(" + second + ")";
@@ -113,7 +113,7 @@
 
         result += children[0].toSetSourceString( context, target );
 
-        if ( ASTProperty.class.isInstance( children[1] ) )
+        if (children[1] instanceof ASTProperty)
         {
             result += "((" + OgnlRuntime.getCompiler( context ).getClassName( target.getClass() ) + ")$2).";
         }
@@ -133,7 +133,7 @@
             value = seq.getLastExpression();
         }
 
-        if ( NodeType.class.isInstance( children[1] ) && !ASTProperty.class.isInstance( children[1] )
+        if ( children[1] instanceof NodeType && !(children[1] instanceof ASTProperty)
             && ( (NodeType) children[1] ).getGetterClass() != null )
         {
 
@@ -142,7 +142,7 @@
 
         return result + value + ")";
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTBitAnd.java b/src/main/java/org/apache/commons/ognl/ASTBitAnd.java
index 5f5928c..ea83d4f 100644
--- a/src/main/java/org/apache/commons/ognl/ASTBitAnd.java
+++ b/src/main/java/org/apache/commons/ognl/ASTBitAnd.java
@@ -60,7 +60,7 @@
     {
         return "(long)" + super.coerceToNumeric( source, context, child );
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTBitNegate.java b/src/main/java/org/apache/commons/ognl/ASTBitNegate.java
index fb65132..f612e45 100644
--- a/src/main/java/org/apache/commons/ognl/ASTBitNegate.java
+++ b/src/main/java/org/apache/commons/ognl/ASTBitNegate.java
@@ -45,16 +45,13 @@
     {
         String source = children[0].toGetSourceString( context, target );
 
-        if ( !ASTBitNegate.class.isInstance( children[0] ) )
+        if ( !(children[0] instanceof ASTBitNegate))
         {
             return "~(" + super.coerceToNumeric( source, context, children[0] ) + ")";
         }
-        else
-        {
-            return "~(" + source + ")";
-        }
+        return "~(" + source + ")";
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTBitOr.java b/src/main/java/org/apache/commons/ognl/ASTBitOr.java
index 17df92e..7eb3a42 100644
--- a/src/main/java/org/apache/commons/ognl/ASTBitOr.java
+++ b/src/main/java/org/apache/commons/ognl/ASTBitOr.java
@@ -55,7 +55,7 @@
     {
         return "|";
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTChain.java b/src/main/java/org/apache/commons/ognl/ASTChain.java
index e0cc8ac..8344376 100644
--- a/src/main/java/org/apache/commons/ognl/ASTChain.java
+++ b/src/main/java/org/apache/commons/ognl/ASTChain.java
@@ -75,71 +75,68 @@
         {
             boolean handled = false;
 
-            if ( i < ilast )
+            if ( (i < ilast) && (children[i] instanceof ASTProperty) )
             {
-                if ( children[i] instanceof ASTProperty )
+                ASTProperty propertyNode = (ASTProperty) children[i];
+                int indexType = propertyNode.getIndexedPropertyType( context, result );
+
+                if ( ( indexType != OgnlRuntime.INDEXED_PROPERTY_NONE )
+                    && ( children[i + 1] instanceof ASTProperty ) )
                 {
-                    ASTProperty propertyNode = (ASTProperty) children[i];
-                    int indexType = propertyNode.getIndexedPropertyType( context, result );
+                    ASTProperty indexNode = (ASTProperty) children[i + 1];
 
-                    if ( ( indexType != OgnlRuntime.INDEXED_PROPERTY_NONE )
-                        && ( children[i + 1] instanceof ASTProperty ) )
+                    if ( indexNode.isIndexedAccess() )
                     {
-                        ASTProperty indexNode = (ASTProperty) children[i + 1];
+                        Object index = indexNode.getProperty( context, result );
 
-                        if ( indexNode.isIndexedAccess() )
+                        if ( index instanceof DynamicSubscript )
                         {
-                            Object index = indexNode.getProperty( context, result );
-
-                            if ( index instanceof DynamicSubscript )
+                            if ( indexType == OgnlRuntime.INDEXED_PROPERTY_INT )
                             {
-                                if ( indexType == OgnlRuntime.INDEXED_PROPERTY_INT )
-                                {
-                                    Object array = propertyNode.getValue( context, result );
-                                    int len = Array.getLength( array );
+                                Object array = propertyNode.getValue( context, result );
+                                int len = Array.getLength( array );
 
-                                    switch ( ( (DynamicSubscript) index ).getFlag() )
-                                    {
-                                        case DynamicSubscript.ALL:
-                                            result = Array.newInstance( array.getClass().getComponentType(), len );
-                                            System.arraycopy( array, 0, result, 0, len );
-                                            handled = true;
-                                            i++;
-                                            break;
-                                        case DynamicSubscript.FIRST:
-                                            index = ( len > 0 ) ? 0 : -1;
-                                            break;
-                                        case DynamicSubscript.MID:
-                                            index = ( len > 0 ) ? ( len / 2 ) : -1;
-                                            break;
-                                        case DynamicSubscript.LAST:
-                                            index = ( len > 0 ) ? ( len - 1 ) : -1;
-                                            break;
-                                        default:
-                                            break;
-                                    }
-                                }
-                                else
+                                switch ( ( (DynamicSubscript) index ).getFlag() )
                                 {
-                                    if ( indexType == OgnlRuntime.INDEXED_PROPERTY_OBJECT )
-                                    {
-                                        throw new OgnlException( "DynamicSubscript '" + indexNode
-                                            + "' not allowed for object indexed property '" + propertyNode + "'" );
-                                    }
+                                    case DynamicSubscript.ALL:
+                                        result = Array.newInstance( array.getClass().getComponentType(), len );
+                                        System.arraycopy( array, 0, result, 0, len );
+                                        handled = true;
+                                        i++;
+                                        break;
+                                    case DynamicSubscript.FIRST:
+                                        index = ( len > 0 ) ? 0 : -1;
+                                        break;
+                                    case DynamicSubscript.MID:
+                                        index = ( len > 0 ) ? ( len / 2 ) : -1;
+                                        break;
+                                    case DynamicSubscript.LAST:
+                                        index = ( len > 0 ) ? ( len - 1 ) : -1;
+                                        break;
+                                    default:
+                                        break;
                                 }
                             }
-                            if ( !handled )
+                            else
                             {
-                                result =
-                                    OgnlRuntime.getIndexedProperty( 
-                                        context,
-                                        result,
-                                        propertyNode.getProperty( context, result ).toString(),
-                                        index );
-                                handled = true;
-                                i++;
+                                if ( indexType == OgnlRuntime.INDEXED_PROPERTY_OBJECT )
+                                {
+                                    throw new OgnlException( "DynamicSubscript '" + indexNode
+                                        + "' not allowed for object indexed property '" + propertyNode + "'" );
+                                }
                             }
                         }
+                        if ( !handled )
+                        {
+                            result =
+                                OgnlRuntime.getIndexedProperty(
+                                    context,
+                                    result,
+                                    propertyNode.getProperty( context, result ).toString(),
+                                    index );
+                            handled = true;
+                            i++;
+                        }
                     }
                 }
             }
@@ -158,77 +155,74 @@
 
         for ( int i = 0, ilast = children.length - 2; i <= ilast; ++i )
         {
-            if ( i <= ilast )
+            if ( (i <= ilast) && (children[i] instanceof ASTProperty) )
             {
-                if ( children[i] instanceof ASTProperty )
+                ASTProperty propertyNode = (ASTProperty) children[i];
+                int indexType = propertyNode.getIndexedPropertyType( context, target );
+
+                if ( ( indexType != OgnlRuntime.INDEXED_PROPERTY_NONE )
+                    && ( children[i + 1] instanceof ASTProperty ) )
                 {
-                    ASTProperty propertyNode = (ASTProperty) children[i];
-                    int indexType = propertyNode.getIndexedPropertyType( context, target );
+                    ASTProperty indexNode = (ASTProperty) children[i + 1];
 
-                    if ( ( indexType != OgnlRuntime.INDEXED_PROPERTY_NONE )
-                        && ( children[i + 1] instanceof ASTProperty ) )
+                    if ( indexNode.isIndexedAccess() )
                     {
-                        ASTProperty indexNode = (ASTProperty) children[i + 1];
+                        Object index = indexNode.getProperty( context, target );
 
-                        if ( indexNode.isIndexedAccess() )
+                        if ( index instanceof DynamicSubscript )
                         {
-                            Object index = indexNode.getProperty( context, target );
-
-                            if ( index instanceof DynamicSubscript )
+                            if ( indexType == OgnlRuntime.INDEXED_PROPERTY_INT )
                             {
-                                if ( indexType == OgnlRuntime.INDEXED_PROPERTY_INT )
-                                {
-                                    Object array = propertyNode.getValue( context, target );
-                                    int len = Array.getLength( array );
+                                Object array = propertyNode.getValue( context, target );
+                                int len = Array.getLength( array );
 
-                                    switch ( ( (DynamicSubscript) index ).getFlag() )
-                                    {
-                                        case DynamicSubscript.ALL:
-                                            System.arraycopy( target, 0, value, 0, len );
-                                            handled = true;
-                                            i++;
-                                            break;
-                                        case DynamicSubscript.FIRST:
-                                            index = ( len > 0 ) ? 0 : -1;
-                                            break;
-                                        case DynamicSubscript.MID:
-                                            index = ( len > 0 ) ? ( len / 2 ) : -1;
-                                            break;
-                                        case DynamicSubscript.LAST:
-                                            index = ( len > 0 ) ? ( len - 1 ) : -1;
-                                            break;
-                                        default:
-                                            break;
-                                    }
-                                }
-                                else
+                                switch ( ( (DynamicSubscript) index ).getFlag() )
                                 {
-                                    if ( indexType == OgnlRuntime.INDEXED_PROPERTY_OBJECT )
-                                    {
-                                        throw new OgnlException( "DynamicSubscript '" + indexNode
-                                            + "' not allowed for object indexed property '" + propertyNode + "'" );
-                                    }
+                                    case DynamicSubscript.ALL:
+                                        System.arraycopy( target, 0, value, 0, len );
+                                        handled = true;
+                                        i++;
+                                        break;
+                                    case DynamicSubscript.FIRST:
+                                        index = ( len > 0 ) ? 0 : -1;
+                                        break;
+                                    case DynamicSubscript.MID:
+                                        index = ( len > 0 ) ? ( len / 2 ) : -1;
+                                        break;
+                                    case DynamicSubscript.LAST:
+                                        index = ( len > 0 ) ? ( len - 1 ) : -1;
+                                        break;
+                                    default:
+                                        break;
                                 }
                             }
-                            if ( !handled && i == ilast )
+                            else
                             {
-                                OgnlRuntime.setIndexedProperty( context, target,
-                                                                propertyNode.getProperty( context, target ).toString(),
-                                                                index, value );
-                                handled = true;
-                                i++;
+                                if ( indexType == OgnlRuntime.INDEXED_PROPERTY_OBJECT )
+                                {
+                                    throw new OgnlException( "DynamicSubscript '" + indexNode
+                                        + "' not allowed for object indexed property '" + propertyNode + "'" );
+                                }
                             }
-                            else if ( !handled )
-                            {
-                                target =
-                                    OgnlRuntime.getIndexedProperty( 
-                                        context,
-                                        target,
-                                        propertyNode.getProperty( context, target ).toString(),
-                                        index );
-                                i++;
-                                continue;
-                            }
+                        }
+                        if ( !handled && i == ilast )
+                        {
+                            OgnlRuntime.setIndexedProperty( context, target,
+                                                            propertyNode.getProperty( context, target ).toString(),
+                                                            index, value );
+                            handled = true;
+                            i++;
+                        }
+                        else if ( !handled )
+                        {
+                            target =
+                                OgnlRuntime.getIndexedProperty(
+                                    context,
+                                    target,
+                                    propertyNode.getProperty( context, target ).toString(),
+                                    index );
+                            i++;
+                            continue;
                         }
                     }
                 }
@@ -301,22 +295,22 @@
 
                     // System.out.println("astchain child returned >>  " + value + "  <<");
 
-                    if ( ASTCtor.class.isInstance( child ) )
+                    if (child instanceof ASTCtor)
                     {
                         constructor = true;
                     }
 
-                    if ( NodeType.class.isInstance( child ) && ( (NodeType) child ).getGetterClass() != null )
+                    if ( child instanceof NodeType && ( (NodeType) child ).getGetterClass() != null )
                     {
                         lastType = (NodeType) child;
                     }
 
                     // System.out.println("Astchain i: " + i + " currentobj : " + context.getCurrentObject() +
                     // " and root: " + context.getRoot());
-                    if ( !ASTVarRef.class.isInstance( child ) && !constructor && !(
-                        OrderedReturn.class.isInstance( child )
+                    if ( !(child instanceof ASTVarRef) && !constructor && !(
+                        child instanceof OrderedReturn
                             && ( (OrderedReturn) child ).getLastExpression() != null ) && ( parent == null
-                        || !ASTSequence.class.isInstance( parent ) ) )
+                        || !(parent instanceof ASTSequence)) )
                     {
                         value = OgnlRuntime.getCompiler( context ).castExpression( context, child, value );
                     }
@@ -327,7 +321,7 @@
                      * context.getPreviousType() + " prev accessor " + context.getPreviousAccessor());
                      */
 
-                    if ( OrderedReturn.class.isInstance( child )
+                    if ( child instanceof OrderedReturn
                         && ( (OrderedReturn) child ).getLastExpression() != null )
                     {
                         ordered = true;
@@ -349,8 +343,8 @@
                             lastExpression = context.remove( ExpressionCompiler.PRE_CAST ) + lastExpression;
                         }
                     }
-                    else if ( ASTOr.class.isInstance( child ) || ASTAnd.class.isInstance( child )
-                        || ASTCtor.class.isInstance( child ) || ( ASTStaticField.class.isInstance( child )
+                    else if ( child instanceof ASTOr || child instanceof ASTAnd
+                        || child instanceof ASTCtor || ( child instanceof ASTStaticField
                         && parent == null ) )
                     {
                         context.put( "_noRoot", "true" );
@@ -395,7 +389,7 @@
         {
             throw new UnsupportedCompilationException( "Can't compile nested chain expressions." );
         }
-        
+
         if ( target != null )
         {
             context.setCurrentObject( target );
@@ -409,7 +403,7 @@
         {
             if ( ( children != null ) && ( children.length > 0 ) )
             {
-                if ( ASTConst.class.isInstance( children[0] ) )
+                if (children[0] instanceof ASTConst)
                 {
                     throw new UnsupportedCompilationException( "Can't modify constant values." );
                 }
@@ -429,22 +423,22 @@
 
                     // System.out.println("astchain setter child returned >>  " + value + "  <<");
 
-                    if ( ASTCtor.class.isInstance( children[i] ) )
+                    if (children[i] instanceof ASTCtor)
                     {
                         constructor = true;
                     }
-                    
-                    if ( NodeType.class.isInstance( children[i] )
+
+                    if ( children[i] instanceof NodeType
                         && ( (NodeType) children[i] ).getGetterClass() != null )
                     {
                         lastType = (NodeType) children[i];
                     }
 
-                    if ( !ASTVarRef.class.isInstance( children[i] )
+                    if ( !(children[i] instanceof ASTVarRef)
                         && !constructor
-                        && !( OrderedReturn.class.isInstance( children[i] )
+                        && !( children[i] instanceof OrderedReturn
                         && ( (OrderedReturn) children[i] ).getLastExpression() != null )
-                        && ( parent == null || !ASTSequence.class.isInstance( parent ) ) )
+                        && ( parent == null || !(parent instanceof ASTSequence)) )
                     {
                         value = OgnlRuntime.getCompiler( context ).castExpression( context, children[i], value );
                     }
@@ -457,8 +451,8 @@
                      * OgnlRuntime.getCompiler().castExpression(context, _children[i], value); }
                      */
 
-                    if ( ASTOr.class.isInstance( children[i] ) || ASTAnd.class.isInstance( children[i] )
-                        || ASTCtor.class.isInstance( children[i] ) || ASTStaticField.class.isInstance( children[i] ) )
+                    if ( children[i] instanceof ASTOr || children[i] instanceof ASTAnd
+                        || children[i] instanceof ASTCtor || children[i] instanceof ASTStaticField)
                     {
                         context.put( "_noRoot", "true" );
                         result = value;
@@ -467,7 +461,7 @@
                     {
                         result += value;
                     }
-                    
+
                     context.put( "_currentChain", result );
                 }
             }
@@ -484,10 +478,10 @@
         {
             setterClass = lastType.getSetterClass();
         }
-        
+
         return result;
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTConst.java b/src/main/java/org/apache/commons/ognl/ASTConst.java
index 380d922..9813f3a 100644
--- a/src/main/java/org/apache/commons/ognl/ASTConst.java
+++ b/src/main/java/org/apache/commons/ognl/ASTConst.java
@@ -43,9 +43,9 @@
         super( p, id );
     }
 
-    /** 
+    /**
      * Called from parser actions.
-     * @param value the value to set 
+     * @param value the value to set
      */
     public void setValue( Object value )
     {
@@ -71,11 +71,6 @@
 
     public Class getGetterClass()
     {
-        if ( getterClass == null )
-        {
-            return null;
-        }
-        
         return getterClass;
     }
 
@@ -86,12 +81,12 @@
 
     public String toGetSourceString( OgnlContext context, Object target )
     {
-        if ( value == null && parent != null && ExpressionNode.class.isInstance( parent ) )
+        if ( value == null && parent != null && parent instanceof ExpressionNode)
         {
             context.setCurrentType( null );
             return "null";
         }
-        else if ( value == null )
+        if ( value == null )
         {
             context.setCurrentType( null );
             return "";
@@ -100,21 +95,21 @@
         getterClass = value.getClass();
 
         Object retval = value;
-        if ( parent != null && ASTProperty.class.isInstance( parent ) )
+        if ( parent != null && parent instanceof ASTProperty)
         {
             context.setCurrentObject( value );
 
             return value.toString();
         }
-        else if ( value != null && Number.class.isAssignableFrom( value.getClass() ) )
+        if ( value != null && Number.class.isAssignableFrom( value.getClass() ) )
         {
             context.setCurrentType( OgnlRuntime.getPrimitiveWrapperClass( value.getClass() ) );
             context.setCurrentObject( value );
 
             return value.toString();
         }
-        else if ( !( parent != null
-                        && value != null 
+        if ( !( parent != null
+                        && value != null
                         && NumericExpression.class.isAssignableFrom( parent.getClass() ) )
             && String.class.isAssignableFrom( value.getClass() ) )
         {
@@ -126,7 +121,7 @@
 
             return retval.toString();
         }
-        else if ( Character.class.isInstance( value ) )
+        if (value instanceof Character)
         {
             Character val = (Character) value;
 
@@ -140,7 +135,7 @@
             {
                 retval = "'" + OgnlOps.getEscapedChar( ( (Character) value ).charValue() ) + "'";
             }
-            
+
             context.setCurrentObject( retval );
             return retval.toString();
         }
@@ -164,10 +159,10 @@
         {
             throw new UnsupportedCompilationException( "Can't modify constant values." );
         }
-        
+
         return toGetSourceString( context, target );
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTCtor.java b/src/main/java/org/apache/commons/ognl/ASTCtor.java
index 0c5abd6..5ac44a6 100644
--- a/src/main/java/org/apache/commons/ognl/ASTCtor.java
+++ b/src/main/java/org/apache/commons/ognl/ASTCtor.java
@@ -87,52 +87,48 @@
         }
         if ( isArray )
         {
-            if ( args.length == 1 )
+            if ( args.length != 1 ) {
+                throw new OgnlException( "only expect array size or fixed initializer list" );
+            }
+            try
             {
-                try
+                Class componentClass = OgnlRuntime.classForName( context, className );
+                List sourceList = null;
+                int size;
+
+                if ( args[0] instanceof List )
                 {
-                    Class componentClass = OgnlRuntime.classForName( context, className );
-                    List sourceList = null;
-                    int size;
+                    sourceList = (List) args[0];
+                    size = sourceList.size();
+                }
+                else
+                {
+                    size = (int) OgnlOps.longValue( args[0] );
+                }
+                result = Array.newInstance( componentClass, size );
+                if ( sourceList != null )
+                {
+                    TypeConverter converter = context.getTypeConverter();
 
-                    if ( args[0] instanceof List )
+                    for ( int i = 0, icount = sourceList.size(); i < icount; i++ )
                     {
-                        sourceList = (List) args[0];
-                        size = sourceList.size();
-                    }
-                    else
-                    {
-                        size = (int) OgnlOps.longValue( args[0] );
-                    }
-                    result = Array.newInstance( componentClass, size );
-                    if ( sourceList != null )
-                    {
-                        TypeConverter converter = context.getTypeConverter();
+                        Object o = sourceList.get( i );
 
-                        for ( int i = 0, icount = sourceList.size(); i < icount; i++ )
+                        if ( ( o == null ) || componentClass.isInstance( o ) )
                         {
-                            Object o = sourceList.get( i );
-
-                            if ( ( o == null ) || componentClass.isInstance( o ) )
-                            {
-                                Array.set( result, i, o );
-                            }
-                            else
-                            {
-                                Array.set( result, i,
-                                           converter.convertValue( context, null, null, null, o, componentClass ) );
-                            }
+                            Array.set( result, i, o );
+                        }
+                        else
+                        {
+                            Array.set( result, i,
+                                       converter.convertValue( context, null, null, null, o, componentClass ) );
                         }
                     }
                 }
-                catch ( ClassNotFoundException ex )
-                {
-                    throw new OgnlException( "array component class '" + className + "' not found", ex );
-                }
             }
-            else
+            catch ( ClassNotFoundException ex )
             {
-                throw new OgnlException( "only expect array size or fixed initializer list" );
+                throw new OgnlException( "array component class '" + className + "' not found", ex );
             }
         }
         else
@@ -146,7 +142,7 @@
 
     public String toGetSourceString( OgnlContext context, Object target )
     {
-        String result = "new " + className;
+        StringBuilder result = new StringBuilder("new " + className);
 
         Class clazz = null;
         Object ctorValue = null;
@@ -183,30 +179,28 @@
                 if ( children[0] instanceof ASTConst )
                 {
 
-                    result = result + "[" + children[0].toGetSourceString( context, target ) + "]";
+                    result.append("[").append(children[0].toGetSourceString(context, target)).append("]");
                 }
-                else if ( ASTProperty.class.isInstance( children[0] ) )
+                else if (children[0] instanceof ASTProperty)
                 {
 
-                    result =
-                        result + "[" + ExpressionCompiler.getRootExpression( children[0], target, context )
-                            + children[0].toGetSourceString( context, target ) + "]";
+                    result.append("[").append(ExpressionCompiler.getRootExpression(children[0], target, context)).append(children[0].toGetSourceString(context, target)).append("]");
                 }
-                else if ( ASTChain.class.isInstance( children[0] ) )
+                else if (children[0] instanceof ASTChain)
                 {
 
-                    result = result + "[" + children[0].toGetSourceString( context, target ) + "]";
+                    result.append("[").append(children[0].toGetSourceString(context, target)).append("]");
                 }
                 else
                 {
 
-                    result = result + "[] " + children[0].toGetSourceString( context, target );
+                    result.append("[] ").append(children[0].toGetSourceString(context, target));
                 }
 
             }
             else
             {
-                result = result + "(";
+                result.append("(");
 
                 if ( ( children != null ) && ( children.length > 0 ) )
                 {
@@ -223,7 +217,7 @@
                         Object objValue = children[i].getValue( context, context.getRoot() );
                         String value = children[i].toGetSourceString( context, target );
 
-                        if ( !ASTRootVarRef.class.isInstance( children[i] ) )
+                        if ( !(children[i] instanceof ASTRootVarRef))
                         {
                             value = ExpressionCompiler.getRootExpression( children[i], target, context ) + value;
                         }
@@ -238,12 +232,12 @@
                         {
                             cast = "";
                         }
-                        
-                        if ( !ASTConst.class.isInstance( children[i] ) )
+
+                        if ( !(children[i] instanceof ASTConst))
                         {
                             value = cast + value;
                         }
-                        
+
                         values[i] = objValue;
                         expressions[i] = value;
                         types[i] = context.getCurrentType();
@@ -274,8 +268,8 @@
                                                                         OgnlRuntime.getConstructors( clazz ), values,
                                                                         new Object[values.length] );
                     }
-                    
-                    if ( ctor == null ) 
+
+                    if ( ctor == null )
                     {
                         throw new NoSuchMethodException(
                             "Unable to find constructor appropriate for arguments in class: " + clazz );
@@ -288,7 +282,7 @@
                     {
                         if ( i > 0 )
                         {
-                            result = result + ", ";
+                            result.append(", ");
                         }
 
                         String value = expressions[i];
@@ -307,22 +301,22 @@
                         {
 
                             if ( values[i] != null && !types[i].isPrimitive() && !values[i].getClass().isArray()
-                                && !ASTConst.class.isInstance( children[i] ) )
+                                && !(children[i] instanceof ASTConst))
                             {
 
                                 value =
                                     "(" + OgnlRuntime.getCompiler( context ).getInterfaceClass( values[i].getClass() ).getName()
                                         + ")" + value;
                             }
-                            else if ( !ASTConst.class.isInstance( children[i] )
-                                || ( ASTConst.class.isInstance( children[i] ) && !types[i].isPrimitive() ) )
+                            else if ( !(children[i] instanceof ASTConst)
+                                || ( children[i] instanceof ASTConst && !types[i].isPrimitive() ) )
                             {
 
                                 if ( !types[i].isArray() && types[i].isPrimitive() && !ctorParamTypes[i].isPrimitive() )
                                 {
                                     value =
                                         "new "
-                                            + ExpressionCompiler.getCastString( 
+                                            + ExpressionCompiler.getCastString(
                                                 OgnlRuntime.getPrimitiveWrapperClass( types[i] ) )
                                             + "(" + value + ")";
                                 }
@@ -333,11 +327,11 @@
                             }
                         }
 
-                        result += value;
+                        result.append(value);
                     }
 
                 }
-                result = result + ")";
+                result.append(")");
             }
 
             context.setCurrentType( ctorValue != null ? ctorValue.getClass() : clazz );
@@ -352,7 +346,7 @@
 
         context.remove( "_ctorClass" );
 
-        return result;
+        return result.toString();
     }
 
     public String toSetSourceString( OgnlContext context, Object target )
diff --git a/src/main/java/org/apache/commons/ognl/ASTDivide.java b/src/main/java/org/apache/commons/ognl/ASTDivide.java
index 6f5449f..b74948e 100644
--- a/src/main/java/org/apache/commons/ognl/ASTDivide.java
+++ b/src/main/java/org/apache/commons/ognl/ASTDivide.java
@@ -48,7 +48,7 @@
         return "/";
     }
 
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTEq.java b/src/main/java/org/apache/commons/ognl/ASTEq.java
index b2aaca7..1479110 100644
--- a/src/main/java/org/apache/commons/ognl/ASTEq.java
+++ b/src/main/java/org/apache/commons/ognl/ASTEq.java
@@ -52,7 +52,7 @@
     {
         return "org.apache.commons.ognl.OgnlOps.equal";
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTEval.java b/src/main/java/org/apache/commons/ognl/ASTEval.java
index 44ba694..f098a5a 100644
--- a/src/main/java/org/apache/commons/ognl/ASTEval.java
+++ b/src/main/java/org/apache/commons/ognl/ASTEval.java
@@ -86,7 +86,7 @@
     {
         throw new UnsupportedCompilationException( "Map expressions not supported as native java yet." );
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTGreater.java b/src/main/java/org/apache/commons/ognl/ASTGreater.java
index 6f14837..00c9968 100644
--- a/src/main/java/org/apache/commons/ognl/ASTGreater.java
+++ b/src/main/java/org/apache/commons/ognl/ASTGreater.java
@@ -53,7 +53,7 @@
     {
         return "org.apache.commons.ognl.OgnlOps.greater";
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTGreaterEq.java b/src/main/java/org/apache/commons/ognl/ASTGreaterEq.java
index 348eaef..fb3b606 100644
--- a/src/main/java/org/apache/commons/ognl/ASTGreaterEq.java
+++ b/src/main/java/org/apache/commons/ognl/ASTGreaterEq.java
@@ -52,7 +52,7 @@
     {
         return "!org.apache.commons.ognl.OgnlOps.less";
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTIn.java b/src/main/java/org/apache/commons/ognl/ASTIn.java
index 8ebe91c..4c990b8 100644
--- a/src/main/java/org/apache/commons/ognl/ASTIn.java
+++ b/src/main/java/org/apache/commons/ognl/ASTIn.java
@@ -91,7 +91,7 @@
     {
         throw new UnsupportedCompilationException( "Map expressions not supported as native java yet." );
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTInstanceof.java b/src/main/java/org/apache/commons/ognl/ASTInstanceof.java
index ddfc72f..9eb4b5d 100644
--- a/src/main/java/org/apache/commons/ognl/ASTInstanceof.java
+++ b/src/main/java/org/apache/commons/ognl/ASTInstanceof.java
@@ -43,7 +43,7 @@
         this.targetType = targetType;
     }
 
-    String getTargetType() 
+    String getTargetType()
     {
         return targetType;
     }
@@ -72,7 +72,7 @@
 
             String ret = "";
 
-            if ( ASTConst.class.isInstance( children[0] ) )
+            if (children[0] instanceof ASTConst)
             {
                 ret = ( (Boolean) getValueBody( context, target ) ).toString();
             }
@@ -95,7 +95,7 @@
     {
         return toGetSourceString( context, target );
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTLess.java b/src/main/java/org/apache/commons/ognl/ASTLess.java
index c7e8ed7..fb8c8a4 100644
--- a/src/main/java/org/apache/commons/ognl/ASTLess.java
+++ b/src/main/java/org/apache/commons/ognl/ASTLess.java
@@ -53,7 +53,7 @@
     {
         return "org.apache.commons.ognl.OgnlOps.less";
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTLessEq.java b/src/main/java/org/apache/commons/ognl/ASTLessEq.java
index e68ac33..2fd093b 100644
--- a/src/main/java/org/apache/commons/ognl/ASTLessEq.java
+++ b/src/main/java/org/apache/commons/ognl/ASTLessEq.java
@@ -53,7 +53,7 @@
         return "!org.apache.commons.ognl.OgnlOps.greater";
     }
 
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTList.java b/src/main/java/org/apache/commons/ognl/ASTList.java
index 66f0707..eb019a7 100644
--- a/src/main/java/org/apache/commons/ognl/ASTList.java
+++ b/src/main/java/org/apache/commons/ognl/ASTList.java
@@ -66,14 +66,8 @@
 
     public String toGetSourceString( OgnlContext context, Object target )
     {
-        String result = "";
-        boolean array = false;
-
-        if ( parent != null && ASTCtor.class.isInstance( parent ) && ( (ASTCtor) parent ).isArray() )
-        {
-
-            array = true;
-        }
+        StringBuilder result = new StringBuilder();
+        boolean array = parent instanceof ASTCtor && ((ASTCtor) parent).isArray();
 
         context.setCurrentType( List.class );
         context.setCurrentAccessor( List.class );
@@ -84,10 +78,10 @@
             {
                 return "java.util.Arrays.asList( new Object[0])";
             }
-            result += "java.util.Arrays.asList( new Object[] ";
+            result.append("java.util.Arrays.asList( new Object[] ");
         }
 
-        result += "{ ";
+        result.append("{ ");
 
         try
         {
@@ -96,7 +90,7 @@
             {
                 if ( i > 0 )
                 {
-                    result = result + ", ";
+                    result.append(", ");
                 }
 
                 Class prevType = context.getCurrentType();
@@ -105,7 +99,7 @@
                 String value = children[i].toGetSourceString( context, target );
 
                 // to undo type setting of constants when used as method parameters
-                if ( ASTConst.class.isInstance( children[i] ) )
+                if (children[i] instanceof ASTConst)
                 {
 
                     context.setCurrentType( prevType );
@@ -123,8 +117,8 @@
                 {
                     cast = "";
                 }
-                
-                if ( !ASTConst.class.isInstance( children[i] ) )
+
+                if ( !(children[i] instanceof ASTConst))
                 {
                     value = cast + value;
                 }
@@ -170,7 +164,7 @@
                                     + ctorClass.getName() + ".class)", ctorClass );
 
                     }
-                    else if ( ( NodeType.class.isInstance( children[i] )
+                    else if ( ( children[i] instanceof NodeType
                         && ( (NodeType) children[i] ).getGetterClass() != null
                         && Number.class.isAssignableFrom( ( (NodeType) children[i] ).getGetterClass() ) )
                         || valueClass.isPrimitive() )
@@ -194,7 +188,7 @@
                 {
                     value = "null";
                 }
-                result += value;
+                result.append(value);
             }
 
         }
@@ -206,20 +200,20 @@
         context.setCurrentType( List.class );
         context.setCurrentAccessor( List.class );
 
-        result += "}";
+        result.append("}");
 
         if ( !array )
         {
-            result += ")";
+            result.append(")");
         }
-        return result;
+        return result.toString();
     }
 
     public String toSetSourceString( OgnlContext context, Object target )
     {
         throw new UnsupportedCompilationException( "Can't generate setter for ASTList." );
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTMethod.java b/src/main/java/org/apache/commons/ognl/ASTMethod.java
index c213f59..0a52322 100644
--- a/src/main/java/org/apache/commons/ognl/ASTMethod.java
+++ b/src/main/java/org/apache/commons/ognl/ASTMethod.java
@@ -169,10 +169,7 @@
 
                 return "";
             }
-            else
-            {
-                getterClass = method.getReturnType();
-            }
+            getterClass = method.getReturnType();
 
             // TODO: This is a hacky workaround until javassist supports varargs method invocations
             boolean varArgs = method.isVarArgs();
@@ -277,10 +274,10 @@
         }
 
         String post = "";
-        String result = "." + method.getName() + "(";
+        StringBuilder result = new StringBuilder("." + method.getName() + "(");
 
         if ( method.getReturnType() != void.class && method.getReturnType().isPrimitive() && ( parent == null
-            || !ASTTest.class.isInstance( parent ) ) )
+            || !(parent instanceof ASTTest)) )
         {
             Class wrapper = OgnlRuntime.getPrimitiveWrapperClass( method.getReturnType() );
 
@@ -313,7 +310,7 @@
                 {
                     if ( i > 0 )
                     {
-                        result += ", ";
+                        result.append(", ");
                     }
 
                     Class prevType = context.getCurrentType();
@@ -334,8 +331,8 @@
 
                     if ( parmString == null || parmString.trim().length() < 1 )
                     {
-                        if ( ASTProperty.class.isInstance( child ) || ASTMethod.class.isInstance( child )
-                            || ASTStaticMethod.class.isInstance( child ) || ASTChain.class.isInstance( child ) )
+                        if ( child instanceof ASTProperty || child instanceof ASTMethod
+                            || child instanceof ASTStaticMethod || child instanceof ASTChain)
                         {
                             throw new UnsupportedCompilationException(
                                 "ASTMethod setter child returned null from a sub property expression." );
@@ -344,7 +341,7 @@
                     }
 
                     // to undo type setting of constants when used as method parameters
-                    if ( ASTConst.class.isInstance( child ) )
+                    if (child instanceof ASTConst)
                     {
                         context.setCurrentType( prevType );
                     }
@@ -376,7 +373,7 @@
                             ASTMethodUtil.getParmString( context, parms[i], parmString, child, valueClass, ".class)" );
                     }
 
-                    result += parmString;
+                    result.append(parmString);
                 }
 
                 if ( prevCast != null )
diff --git a/src/main/java/org/apache/commons/ognl/ASTMethodUtil.java b/src/main/java/org/apache/commons/ognl/ASTMethodUtil.java
index b702e8a..55e9eab 100644
--- a/src/main/java/org/apache/commons/ognl/ASTMethodUtil.java
+++ b/src/main/java/org/apache/commons/ognl/ASTMethodUtil.java
@@ -44,7 +44,7 @@
         }
 
         // to undo type setting of constants when used as method parameters
-        if ( ASTConst.class.isInstance( child ) )
+        if (child instanceof ASTConst)
         {
             context.setCurrentType( prevType );
         }
@@ -62,7 +62,7 @@
             cast = "";
         }
 
-        if ( !ASTConst.class.isInstance( child ) )
+        if ( !(child instanceof ASTConst))
         {
             parmString = cast + parmString;
         }
@@ -108,7 +108,7 @@
                                                         parm );
 
         }
-        else if ( ( NodeType.class.isInstance( child ) && ( (NodeType) child ).getGetterClass() != null
+        else if ( ( child instanceof NodeType && ( (NodeType) child ).getGetterClass() != null
             && Number.class.isAssignableFrom( ( (NodeType) child ).getGetterClass() ) ) || ( valueClass != null
             && valueClass.isPrimitive() ) )
         {
diff --git a/src/main/java/org/apache/commons/ognl/ASTMultiply.java b/src/main/java/org/apache/commons/ognl/ASTMultiply.java
index 808ad4e..ce7c986 100644
--- a/src/main/java/org/apache/commons/ognl/ASTMultiply.java
+++ b/src/main/java/org/apache/commons/ognl/ASTMultiply.java
@@ -56,7 +56,7 @@
     {
         return "*";
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTNegate.java b/src/main/java/org/apache/commons/ognl/ASTNegate.java
index f2765a8..d40322c 100644
--- a/src/main/java/org/apache/commons/ognl/ASTNegate.java
+++ b/src/main/java/org/apache/commons/ognl/ASTNegate.java
@@ -45,16 +45,13 @@
     {
         String source = children[0].toGetSourceString( context, target );
 
-        if ( !ASTNegate.class.isInstance( children[0] ) )
+        if ( !(children[0] instanceof ASTNegate))
         {
             return "-" + source;
         }
-        else
-        {
-            return "-(" + source + ")";
-        }
+        return "-(" + source + ")";
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTNot.java b/src/main/java/org/apache/commons/ognl/ASTNot.java
index 9927c83..52b6f1a 100644
--- a/src/main/java/org/apache/commons/ognl/ASTNot.java
+++ b/src/main/java/org/apache/commons/ognl/ASTNot.java
@@ -57,7 +57,7 @@
             {
                 srcString = "null";
             }
-            
+
             context.setCurrentType( Boolean.TYPE );
 
             return "(! org.apache.commons.ognl.OgnlOps.booleanValue(" + srcString + ") )";
@@ -68,7 +68,7 @@
             throw OgnlOps.castToRuntime( t );
         }
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTNotEq.java b/src/main/java/org/apache/commons/ognl/ASTNotEq.java
index 9f59fae..e09dc7d 100644
--- a/src/main/java/org/apache/commons/ognl/ASTNotEq.java
+++ b/src/main/java/org/apache/commons/ognl/ASTNotEq.java
@@ -53,7 +53,7 @@
     {
         return "!org.apache.commons.ognl.OgnlOps.equal";
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTNotIn.java b/src/main/java/org/apache/commons/ognl/ASTNotIn.java
index ba4b76a..d96e390 100644
--- a/src/main/java/org/apache/commons/ognl/ASTNotIn.java
+++ b/src/main/java/org/apache/commons/ognl/ASTNotIn.java
@@ -85,7 +85,7 @@
             throw OgnlOps.castToRuntime( t );
         }
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTOr.java b/src/main/java/org/apache/commons/ognl/ASTOr.java
index 7934e53..304352d 100644
--- a/src/main/java/org/apache/commons/ognl/ASTOr.java
+++ b/src/main/java/org/apache/commons/ognl/ASTOr.java
@@ -90,7 +90,7 @@
         {
             throw new UnsupportedCompilationException( "Can only compile boolean expressions with two children." );
         }
-        
+
         String result = "(";
 
         try
@@ -101,7 +101,7 @@
             {
                 first = OgnlRuntime.getCompiler( context ).createLocalReference( context, first, context.getCurrentType() );
             }
-            
+
             Class firstType = context.getCurrentType();
 
             String second = OgnlRuntime.getChildSource( context, target, children[1] );
@@ -109,7 +109,7 @@
             {
                 second = OgnlRuntime.getCompiler( context ).createLocalReference( context, second, context.getCurrentType() );
             }
-            
+
             Class secondType = context.getCurrentType();
 
             boolean mismatched =
@@ -146,13 +146,13 @@
         {
             throw new UnsupportedCompilationException( "Can only compile boolean expressions with two children." );
         }
-        
+
         String pre = (String) context.get( "_currentChain" );
         if ( pre == null )
         {
             pre = "";
         }
-        
+
         String result = "";
 
         try
@@ -197,7 +197,7 @@
 
         return result;
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTProject.java b/src/main/java/org/apache/commons/ognl/ASTProject.java
index 7230714..b0973e8 100644
--- a/src/main/java/org/apache/commons/ognl/ASTProject.java
+++ b/src/main/java/org/apache/commons/ognl/ASTProject.java
@@ -68,7 +68,7 @@
     {
         throw new UnsupportedCompilationException( "Projection expressions not supported as native java yet." );
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTProperty.java b/src/main/java/org/apache/commons/ognl/ASTProperty.java
index 5243baf..8a5caf3 100644
--- a/src/main/java/org/apache/commons/ognl/ASTProperty.java
+++ b/src/main/java/org/apache/commons/ognl/ASTProperty.java
@@ -189,26 +189,23 @@
 
                     return "." + m.getName() + "(" + srcString + ")";
                 }
-                else
+                PropertyAccessor propertyAccessor = OgnlRuntime.getPropertyAccessor( target.getClass() );
+
+                // System.out.println("child value : " + _children[0].getValue(context, context.getCurrentObject())
+                // + " using propaccessor " + p.getClass().getName()
+                // + " and srcString " + srcString + " on target: " + target);
+
+                Object currentObject = context.getCurrentObject();
+                if ( child instanceof ASTConst && currentObject instanceof Number)
                 {
-                    PropertyAccessor propertyAccessor = OgnlRuntime.getPropertyAccessor( target.getClass() );
-
-                    // System.out.println("child value : " + _children[0].getValue(context, context.getCurrentObject())
-                    // + " using propaccessor " + p.getClass().getName()
-                    // + " and srcString " + srcString + " on target: " + target);
-
-                    Object currentObject = context.getCurrentObject();
-                    if ( ASTConst.class.isInstance( child ) && Number.class.isInstance( currentObject ) )
-                    {
-                        context.setCurrentType( OgnlRuntime.getPrimitiveWrapperClass( currentObject.getClass() ) );
-                    }
-                    Object indexValue = propertyAccessor.getProperty( context, target, value );
-                    result = propertyAccessor.getSourceAccessor( context, target, srcString );
-                    getterClass = context.getCurrentType();
-                    context.setCurrentObject( indexValue );
-
-                    return result;
+                    context.setCurrentType( OgnlRuntime.getPrimitiveWrapperClass( currentObject.getClass() ) );
                 }
+                Object indexValue = propertyAccessor.getProperty( context, target, value );
+                result = propertyAccessor.getSourceAccessor( context, target, srcString );
+                getterClass = context.getCurrentType();
+                context.setCurrentObject( indexValue );
+
+                return result;
             }
 
             String name = ( (ASTConst) child ).getValue().toString();
@@ -236,14 +233,10 @@
                 }
                 else
                 {
-                    if ( pd instanceof ObjectIndexedPropertyDescriptor )
-                    {
-                        m = ( (ObjectIndexedPropertyDescriptor) pd ).getIndexedReadMethod();
-                    }
-                    else
-                    {
+                    if ( !(pd instanceof ObjectIndexedPropertyDescriptor) ) {
                         throw new OgnlException( "property '" + name + "' is not an indexed property" );
                     }
+                    m = ( (ObjectIndexedPropertyDescriptor) pd ).getIndexedReadMethod();
                 }
 
                 if ( parent == null )
@@ -307,8 +300,7 @@
 
                         String srcString = child.toGetSourceString( context, context.getRoot() );
 
-                        if ( ASTConst.class.isInstance( child ) && String.class.isInstance(
-                            context.getCurrentObject() ) )
+                        if ( child instanceof ASTConst && context.getCurrentObject() instanceof String)
                         {
                             srcString = "\"" + srcString + "\"";
                         }
@@ -379,11 +371,11 @@
 
     Method getIndexedWriteMethod( PropertyDescriptor pd )
     {
-        if ( IndexedPropertyDescriptor.class.isInstance( pd ) )
+        if (pd instanceof IndexedPropertyDescriptor)
         {
             return ( (IndexedPropertyDescriptor) pd ).getIndexedWriteMethod();
         }
-        else if ( ObjectIndexedPropertyDescriptor.class.isInstance( pd ) )
+        if (pd instanceof ObjectIndexedPropertyDescriptor)
         {
             return ( (ObjectIndexedPropertyDescriptor) pd ).getIndexedWriteMethod();
         }
@@ -425,50 +417,11 @@
                 // System.out.println("astproperty setter using indexed value " + value + " and srcString: " +
                 // srcString);
 
-                if ( context.get( "_indexedMethod" ) != null )
-                {
-                    m = (Method) context.remove( "_indexedMethod" );
-                    PropertyDescriptor pd = (PropertyDescriptor) context.remove( "_indexedDescriptor" );
-
-                    boolean lastChild = lastChild( context );
-                    if ( lastChild )
-                    {
-                        m = getIndexedWriteMethod( pd );
-
-                        if ( m == null )
-                        {
-                            throw new UnsupportedCompilationException(
-                                "Indexed property has no corresponding write method." );
-                        }
-                    }
-
-                    setterClass = m.getParameterTypes()[0];
-
-                    Object indexedValue = null;
-                    if ( !lastChild )
-                    {
-                        indexedValue = OgnlRuntime.callMethod( context, target, m.getName(), new Object[]{ value } );
-                    }
-                    context.setCurrentType( setterClass );
-                    context.setCurrentAccessor(
-                        OgnlRuntime.getCompiler( context ).getSuperOrInterfaceClass( m, m.getDeclaringClass() ) );
-
-                    if ( !lastChild )
-                    {
-                        context.setCurrentObject( indexedValue );
-                        return "." + m.getName() + "(" + srcString + ")";
-                    }
-                    else
-                    {
-                        return "." + m.getName() + "(" + srcString + ", $3)";
-                    }
-                }
-                else
-                {
+                if ( context.get( "_indexedMethod" ) == null ) {
                     PropertyAccessor propertyAccessor = OgnlRuntime.getPropertyAccessor( target.getClass() );
 
                     Object currentObject = context.getCurrentObject();
-                    if ( ASTConst.class.isInstance( child ) && Number.class.isInstance( currentObject ) )
+                    if ( child instanceof ASTConst && currentObject instanceof Number)
                     {
                         context.setCurrentType( OgnlRuntime.getPrimitiveWrapperClass( currentObject.getClass() ) );
                     }
@@ -496,6 +449,38 @@
                      */
                     return result;
                 }
+                m = (Method) context.remove( "_indexedMethod" );
+                PropertyDescriptor pd = (PropertyDescriptor) context.remove( "_indexedDescriptor" );
+
+                boolean lastChild = lastChild( context );
+                if ( lastChild )
+                {
+                    m = getIndexedWriteMethod( pd );
+
+                    if ( m == null )
+                    {
+                        throw new UnsupportedCompilationException(
+                            "Indexed property has no corresponding write method." );
+                    }
+                }
+
+                setterClass = m.getParameterTypes()[0];
+
+                Object indexedValue = null;
+                if ( !lastChild )
+                {
+                    indexedValue = OgnlRuntime.callMethod( context, target, m.getName(), new Object[]{ value } );
+                }
+                context.setCurrentType( setterClass );
+                context.setCurrentAccessor(
+                    OgnlRuntime.getCompiler( context ).getSuperOrInterfaceClass( m, m.getDeclaringClass() ) );
+
+                if ( !lastChild )
+                {
+                    context.setCurrentObject( indexedValue );
+                    return "." + m.getName() + "(" + srcString + ")";
+                }
+                return "." + m.getName() + "(" + srcString + ", $3)";
             }
 
             String name = ( (ASTConst) child ).getValue().toString();
@@ -532,16 +517,12 @@
                 }
                 else
                 {
-                    if ( pd instanceof ObjectIndexedPropertyDescriptor )
-                    {
-                        ObjectIndexedPropertyDescriptor opd = (ObjectIndexedPropertyDescriptor) pd;
-
-                        m = lastChild( context ) ? opd.getIndexedWriteMethod() : opd.getIndexedReadMethod();
-                    }
-                    else
-                    {
+                    if ( !(pd instanceof ObjectIndexedPropertyDescriptor) ) {
                         throw new OgnlException( "property '" + name + "' is not an indexed property" );
                     }
+                    ObjectIndexedPropertyDescriptor opd = (ObjectIndexedPropertyDescriptor) pd;
+
+                    m = lastChild( context ) ? opd.getIndexedWriteMethod() : opd.getIndexedReadMethod();
                 }
 
                 if ( parent == null )
@@ -595,8 +576,7 @@
 
                         String srcString = child.toGetSourceString( context, context.getRoot() );
 
-                        if ( ASTConst.class.isInstance( child ) && String.class.isInstance(
-                            context.getCurrentObject() ) )
+                        if ( child instanceof ASTConst && context.getCurrentObject() instanceof String)
                         {
                             srcString = "\"" + srcString + "\"";
                         }
@@ -648,7 +628,7 @@
         String srcString = child.toGetSourceString( context, context.getRoot() );
         srcString = ExpressionCompiler.getRootExpression( child, context.getRoot(), context ) + srcString;
 
-        if ( ASTChain.class.isInstance( child ) )
+        if (child instanceof ASTChain)
         {
             String cast = (String) context.remove( ExpressionCompiler.PRE_CAST );
             if ( cast != null )
@@ -657,7 +637,7 @@
             }
         }
 
-        if ( ASTConst.class.isInstance( child ) && String.class.isInstance( context.getCurrentObject() ) )
+        if ( child instanceof ASTConst && context.getCurrentObject() instanceof String)
         {
             srcString = "\"" + srcString + "\"";
         }
diff --git a/src/main/java/org/apache/commons/ognl/ASTRemainder.java b/src/main/java/org/apache/commons/ognl/ASTRemainder.java
index 00a27c8..b1aaea1 100644
--- a/src/main/java/org/apache/commons/ognl/ASTRemainder.java
+++ b/src/main/java/org/apache/commons/ognl/ASTRemainder.java
@@ -47,7 +47,7 @@
     {
         return "%";
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTRootVarRef.java b/src/main/java/org/apache/commons/ognl/ASTRootVarRef.java
index c630415..c747749 100644
--- a/src/main/java/org/apache/commons/ognl/ASTRootVarRef.java
+++ b/src/main/java/org/apache/commons/ognl/ASTRootVarRef.java
@@ -55,7 +55,7 @@
         {
             getterClass = target.getClass();
         }
-        
+
         if ( getterClass != null )
         {
 
@@ -66,10 +66,7 @@
         {
             return "";
         }
-        else
-        {
-            return ExpressionCompiler.getRootExpression( this, target, context );
-        }
+        return ExpressionCompiler.getRootExpression( this, target, context );
     }
 
     public String toSetSourceString( OgnlContext context, Object target )
@@ -78,12 +75,9 @@
         {
             return "";
         }
-        else
-        {
-            return "$3";
-        }
+        return "$3";
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTSelect.java b/src/main/java/org/apache/commons/ognl/ASTSelect.java
index 75e6d82..f2c5515 100644
--- a/src/main/java/org/apache/commons/ognl/ASTSelect.java
+++ b/src/main/java/org/apache/commons/ognl/ASTSelect.java
@@ -72,7 +72,7 @@
     {
         throw new UnsupportedCompilationException( "Eval expressions not supported as native java yet." );
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTSelectFirst.java b/src/main/java/org/apache/commons/ognl/ASTSelectFirst.java
index 2ce21ed..948e2d0 100644
--- a/src/main/java/org/apache/commons/ognl/ASTSelectFirst.java
+++ b/src/main/java/org/apache/commons/ognl/ASTSelectFirst.java
@@ -70,7 +70,7 @@
     {
         throw new UnsupportedCompilationException( "Eval expressions not supported as native java yet." );
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTSelectLast.java b/src/main/java/org/apache/commons/ognl/ASTSelectLast.java
index bce7de2..33297f2 100644
--- a/src/main/java/org/apache/commons/ognl/ASTSelectLast.java
+++ b/src/main/java/org/apache/commons/ognl/ASTSelectLast.java
@@ -70,7 +70,7 @@
     {
         throw new UnsupportedCompilationException( "Eval expressions not supported as native java yet." );
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTSequence.java b/src/main/java/org/apache/commons/ognl/ASTSequence.java
index b2bd571..0142420 100644
--- a/src/main/java/org/apache/commons/ognl/ASTSequence.java
+++ b/src/main/java/org/apache/commons/ognl/ASTSequence.java
@@ -109,12 +109,12 @@
             // System.out.println("astsequence child : " + _children[i].getClass().getName());
             String seqValue = children[i].toGetSourceString( context, target );
 
-            if ( ( i + 1 ) < children.length && ASTOr.class.isInstance( children[i] ) )
+            if ( ( i + 1 ) < children.length && children[i] instanceof ASTOr)
             {
                 seqValue = "(" + seqValue + ")";
             }
 
-            if ( i > 0 && ASTProperty.class.isInstance( children[i] ) && seqValue != null
+            if ( i > 0 && children[i] instanceof ASTProperty && seqValue != null
                 && !seqValue.trim().isEmpty() )
             {
                 String pre = (String) context.get( "_currentChain" );
@@ -122,7 +122,7 @@
                 {
                     pre = "";
                 }
-                
+
                 seqValue =
                     ExpressionCompiler.getRootExpression( children[i], context.getRoot(), context ) + pre + seqValue;
                 context.setCurrentAccessor( context.getRoot().getClass() );
@@ -144,7 +144,7 @@
             }
             // set last known type from last child with a type
 
-            if ( NodeType.class.isInstance( children[i] ) && ( (NodeType) children[i] ).getGetterClass() != null )
+            if ( children[i] instanceof NodeType && ( (NodeType) children[i] ).getGetterClass() != null )
             {
                 lastType = (NodeType) children[i];
             }
@@ -157,7 +157,7 @@
 
         return result;
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTShiftLeft.java b/src/main/java/org/apache/commons/ognl/ASTShiftLeft.java
index 06a289c..113d61b 100644
--- a/src/main/java/org/apache/commons/ognl/ASTShiftLeft.java
+++ b/src/main/java/org/apache/commons/ognl/ASTShiftLeft.java
@@ -47,7 +47,7 @@
     {
         return "<<";
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTShiftRight.java b/src/main/java/org/apache/commons/ognl/ASTShiftRight.java
index b1cf854..f5de697 100644
--- a/src/main/java/org/apache/commons/ognl/ASTShiftRight.java
+++ b/src/main/java/org/apache/commons/ognl/ASTShiftRight.java
@@ -47,7 +47,7 @@
     {
         return ">>";
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTStaticField.java b/src/main/java/org/apache/commons/ognl/ASTStaticField.java
index c39ed58..f6f4ad8 100644
--- a/src/main/java/org/apache/commons/ognl/ASTStaticField.java
+++ b/src/main/java/org/apache/commons/ognl/ASTStaticField.java
@@ -92,15 +92,7 @@
                 result = Modifier.isFinal( field.getModifiers() );
             }
         }
-        catch ( ClassNotFoundException e )
-        {
-            cause = e;
-        }
-        catch ( NoSuchFieldException e )
-        {
-            cause = e;
-        }
-        catch ( SecurityException e )
+        catch ( ClassNotFoundException | SecurityException | NoSuchFieldException e )
         {
             cause = e;
         }
@@ -109,7 +101,7 @@
         {
             throw new OgnlException( "Could not get static field " + fieldName + " from class " + className, cause );
         }
-        
+
         return result;
     }
 
@@ -130,26 +122,15 @@
             {
                 return clazz;
             }
-            else if ( clazz.isEnum() )
+            if ( clazz.isEnum() )
             {
                 return clazz;
             }
-            else
-            {
-                Field field = clazz.getField( fieldName );
+            Field field = clazz.getField( fieldName );
 
-                return field.getType();
-            }
+            return field.getType();
         }
-        catch ( ClassNotFoundException e )
-        {
-            cause = e;
-        }
-        catch ( NoSuchFieldException e )
-        {
-            cause = e;
-        }
-        catch ( SecurityException e )
+        catch ( ClassNotFoundException | SecurityException | NoSuchFieldException e )
         {
             cause = e;
         }
@@ -209,7 +190,7 @@
 
         return className + "." + fieldName;
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTStaticMethod.java b/src/main/java/org/apache/commons/ognl/ASTStaticMethod.java
index c41a8bb..7134dfc 100644
--- a/src/main/java/org/apache/commons/ognl/ASTStaticMethod.java
+++ b/src/main/java/org/apache/commons/ognl/ASTStaticMethod.java
@@ -84,7 +84,7 @@
 
     public String toGetSourceString( OgnlContext context, Object target )
     {
-        String result = className + "#" + methodName + "(";
+        StringBuilder result = new StringBuilder(className + "#" + methodName + "(");
 
         try
         {
@@ -113,7 +113,7 @@
                 {
                     if ( i > 0 )
                     {
-                        result = result + ", ";
+                        result.append(", ");
                     }
 
                     Class prevType = context.getCurrentType();
@@ -150,7 +150,7 @@
                                 + ")org.apache.commons.ognl.OgnlOps.convertValue(" + parmString + ","
                                 + parms[i].getName() + ".class)", parms[i] );
                         }
-                        else if ( ( NodeType.class.isInstance( child ) && ( (NodeType) child ).getGetterClass() != null
+                        else if ( ( child instanceof NodeType && ( (NodeType) child ).getGetterClass() != null
                             && Number.class.isAssignableFrom( ( (NodeType) child ).getGetterClass() ) )
                             || valueClass.isPrimitive() )
                         {
@@ -162,11 +162,11 @@
                         }
                     }
 
-                    result += parmString;
+                    result.append(parmString);
                 }
             }
 
-            result += ")";
+            result.append(")");
 
             try
             {
@@ -192,7 +192,7 @@
             throw OgnlOps.castToRuntime( t );
         }
 
-        return result;
+        return result.toString();
     }
 
     public String toSetSourceString( OgnlContext context, Object target )
diff --git a/src/main/java/org/apache/commons/ognl/ASTSubtract.java b/src/main/java/org/apache/commons/ognl/ASTSubtract.java
index b725946..da84eef 100644
--- a/src/main/java/org/apache/commons/ognl/ASTSubtract.java
+++ b/src/main/java/org/apache/commons/ognl/ASTSubtract.java
@@ -47,7 +47,7 @@
     {
         return "-";
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTTest.java b/src/main/java/org/apache/commons/ognl/ASTTest.java
index b47c916..62bb200 100644
--- a/src/main/java/org/apache/commons/ognl/ASTTest.java
+++ b/src/main/java/org/apache/commons/ognl/ASTTest.java
@@ -64,13 +64,13 @@
         {
             throw new UnsupportedCompilationException( "evaluation resulted in null expression." );
         }
-        
+
         if ( children.length != 3 )
         {
             throw new UnsupportedCompilationException( "Can only compile test expressions with two children."
                 + children.length );
         }
-        
+
         String result = "";
 
         try
@@ -81,8 +81,8 @@
             {
                 first = OgnlRuntime.getCompiler( context ).createLocalReference( context, first, context.getCurrentType() );
             }
-            
-            if ( ExpressionNode.class.isInstance( children[0] ) )
+
+            if (children[0] instanceof ExpressionNode)
             {
                 first = "(" + first + ")";
             }
@@ -94,8 +94,8 @@
             {
                 second = OgnlRuntime.getCompiler( context ).createLocalReference( context, second, context.getCurrentType() );
             }
-            
-            if ( ExpressionNode.class.isInstance( children[1] ) )
+
+            if (children[1] instanceof ExpressionNode)
             {
                 second = "(" + second + ")";
             }
@@ -106,10 +106,10 @@
             if ( !OgnlRuntime.isBoolean( third ) && !context.getCurrentType().isPrimitive() )
             {
                 third = OgnlRuntime.getCompiler( context ).createLocalReference( context, third, context.getCurrentType() );
-            
+
             }
-            
-            if ( ExpressionNode.class.isInstance( children[2] ) )
+
+            if (children[2] instanceof ExpressionNode)
             {
                 third = "(" + third + ")";
             }
@@ -144,7 +144,7 @@
             throw OgnlOps.castToRuntime( t );
         }
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTThisVarRef.java b/src/main/java/org/apache/commons/ognl/ASTThisVarRef.java
index db934d7..dd9b13a 100644
--- a/src/main/java/org/apache/commons/ognl/ASTThisVarRef.java
+++ b/src/main/java/org/apache/commons/ognl/ASTThisVarRef.java
@@ -59,7 +59,7 @@
     {
         throw new UnsupportedCompilationException( "Unable to compile this references." );
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTUnsignedShiftRight.java b/src/main/java/org/apache/commons/ognl/ASTUnsignedShiftRight.java
index 1cda285..037d29b 100644
--- a/src/main/java/org/apache/commons/ognl/ASTUnsignedShiftRight.java
+++ b/src/main/java/org/apache/commons/ognl/ASTUnsignedShiftRight.java
@@ -83,7 +83,7 @@
 
         return result;
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ASTVarRef.java b/src/main/java/org/apache/commons/ognl/ASTVarRef.java
index 4d56faf..53d5fef 100644
--- a/src/main/java/org/apache/commons/ognl/ASTVarRef.java
+++ b/src/main/java/org/apache/commons/ognl/ASTVarRef.java
@@ -115,7 +115,7 @@
         {
             throw new UnsupportedCompilationException( "Current context object is null, can't compile var reference." );
         }
-        
+
         String pre = "";
         String post = "";
         if ( context.getCurrentType() != null )
@@ -124,7 +124,7 @@
             post = ")";
         }
 
-        if ( parent != null && ASTAssign.class.isInstance( parent ) )
+        if ( parent != null && parent instanceof ASTAssign)
         {
             core = "$1.put(\"" + name + "\",";
             last = pre + "$1.get(\"" + name + "\")" + post;
diff --git a/src/main/java/org/apache/commons/ognl/ASTXor.java b/src/main/java/org/apache/commons/ognl/ASTXor.java
index 4e11c0c..7c9ed1e 100644
--- a/src/main/java/org/apache/commons/ognl/ASTXor.java
+++ b/src/main/java/org/apache/commons/ognl/ASTXor.java
@@ -55,7 +55,7 @@
     {
         return "^";
     }
-    
+
     public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException
     {
diff --git a/src/main/java/org/apache/commons/ognl/ArrayPropertyAccessor.java b/src/main/java/org/apache/commons/ognl/ArrayPropertyAccessor.java
index 82ed58e..5c32cf0 100644
--- a/src/main/java/org/apache/commons/ognl/ArrayPropertyAccessor.java
+++ b/src/main/java/org/apache/commons/ognl/ArrayPropertyAccessor.java
@@ -77,16 +77,12 @@
             }
             if ( result == null )
             {
-                if ( index instanceof Number )
-                {
-                    int i = ( (Number) index ).intValue();
-
-                    result = ( i >= 0 ) ? Array.get( target, i ) : null;
-                }
-                else
-                {
+                if ( !(index instanceof Number) ) {
                     throw new NoSuchPropertyException( target, index );
                 }
+                int i = ( (Number) index ).intValue();
+
+                result = ( i >= 0 ) ? Array.get( target, i ) : null;
             }
         }
         return result;
@@ -130,14 +126,10 @@
         }
         else
         {
-            if ( name instanceof String )
-            {
-                super.setProperty( context, target, name, value );
-            }
-            else
-            {
+            if ( !(name instanceof String) ) {
                 throw new NoSuchPropertyException( target, name );
             }
+            super.setProperty( context, target, name, value );
         }
     }
 
@@ -192,7 +184,7 @@
             // means it needs to be cast first as well
 
             String toString =
-                String.class.isInstance( index ) && context.getCurrentType() != Object.class ? "" : ".toString()";
+                index instanceof String && context.getCurrentType() != Object.class ? "" : ".toString()";
 
             indexStr = format( "org.apache.commons.ognl.OgnlOps#getIntValue(%s%s)", indexStr, toString );
         }
diff --git a/src/main/java/org/apache/commons/ognl/BooleanExpression.java b/src/main/java/org/apache/commons/ognl/BooleanExpression.java
index 3288e22..7dd947f 100644
--- a/src/main/java/org/apache/commons/ognl/BooleanExpression.java
+++ b/src/main/java/org/apache/commons/ognl/BooleanExpression.java
@@ -89,7 +89,7 @@
             {
                 return "false";
             }
-            else if ( "(true)".equals( ret ) )
+            if ( "(true)".equals( ret ) )
             {
                 return "true";
             }
diff --git a/src/main/java/org/apache/commons/ognl/ClassCacheInspector.java b/src/main/java/org/apache/commons/ognl/ClassCacheInspector.java
index 4161daf..bd61132 100644
--- a/src/main/java/org/apache/commons/ognl/ClassCacheInspector.java
+++ b/src/main/java/org/apache/commons/ognl/ClassCacheInspector.java
@@ -28,7 +28,7 @@
 
     /**
      * Invoked just before storing a class type within a cache instance.
-     * 
+     *
      * @param type The class that is to be stored.
      * @return True if the class can be cached, false otherwise.
      */
diff --git a/src/main/java/org/apache/commons/ognl/DefaultMemberAccess.java b/src/main/java/org/apache/commons/ognl/DefaultMemberAccess.java
index 87a7c9f..a44c491 100644
--- a/src/main/java/org/apache/commons/ognl/DefaultMemberAccess.java
+++ b/src/main/java/org/apache/commons/ognl/DefaultMemberAccess.java
@@ -50,7 +50,6 @@
     public DefaultMemberAccess( boolean allowPrivateAccess, boolean allowProtectedAccess,
                                 boolean allowPackageProtectedAccess )
     {
-        super();
         this.allowPrivateAccess = allowPrivateAccess;
         this.allowProtectedAccess = allowProtectedAccess;
         this.allowPackageProtectedAccess = allowPackageProtectedAccess;
diff --git a/src/main/java/org/apache/commons/ognl/ElementsAccessor.java b/src/main/java/org/apache/commons/ognl/ElementsAccessor.java
index 3f5cf18..973cfdd 100644
--- a/src/main/java/org/apache/commons/ognl/ElementsAccessor.java
+++ b/src/main/java/org/apache/commons/ognl/ElementsAccessor.java
@@ -33,7 +33,7 @@
 {
     /**
      * Returns an iterator over the elements of the given target object.
-     * 
+     *
      * @param target the object to get the elements of
      * @return an iterator over the elements of the given object
      * @throws OgnlException if there is an error getting the given object's elements
diff --git a/src/main/java/org/apache/commons/ognl/Evaluation.java b/src/main/java/org/apache/commons/ognl/Evaluation.java
index 319ef8f..e348dac 100644
--- a/src/main/java/org/apache/commons/ognl/Evaluation.java
+++ b/src/main/java/org/apache/commons/ognl/Evaluation.java
@@ -50,7 +50,6 @@
      */
     public Evaluation( SimpleNode node, Object source )
     {
-        super();
         this.node = node;
         this.source = source;
     }
@@ -278,33 +277,32 @@
      */
     public String toString( boolean compact, boolean showChildren, String depth )
     {
-        String stringResult;
+        StringBuilder stringResult;
 
         if ( compact )
         {
-            stringResult = depth + "<" + node.getClass().getName() + " " + System.identityHashCode( this ) + ">";
+            stringResult = new StringBuilder(depth + "<" + node.getClass().getName() + " " + System.identityHashCode(this) + ">");
         }
         else
         {
             String ss = ( source != null ) ? source.getClass().getName() : "null", rs =
                 ( result != null ) ? result.getClass().getName() : "null";
 
-            stringResult =
-                depth + "<" + node.getClass().getName() + ": [" + ( setOperation ? "set" : "get" ) + "] source = " + ss
-                    + ", result = " + result + " [" + rs + "]>";
+            stringResult = new StringBuilder(depth + "<" + node.getClass().getName() + ": [" + (setOperation ? "set" : "get") + "] source = " + ss
+                    + ", result = " + result + " [" + rs + "]>");
         }
         if ( showChildren )
         {
             Evaluation child = firstChild;
 
-            stringResult += "\n";
+            stringResult.append("\n");
             while ( child != null )
             {
-                stringResult += child.toString( compact, depth + "  " );
+                stringResult.append(child.toString(compact, depth + "  "));
                 child = child.next;
             }
         }
-        return stringResult;
+        return stringResult.toString();
     }
 
     /**
diff --git a/src/main/java/org/apache/commons/ognl/ExpressionNode.java b/src/main/java/org/apache/commons/ognl/ExpressionNode.java
index 76e4a7b..4fdf017 100644
--- a/src/main/java/org/apache/commons/ognl/ExpressionNode.java
+++ b/src/main/java/org/apache/commons/ognl/ExpressionNode.java
@@ -94,13 +94,13 @@
 
                 String value = children[i].toGetSourceString( context, target );
 
-                if ( ( ASTProperty.class.isInstance( children[i] ) || ASTMethod.class.isInstance( children[i] )
-                    || ASTSequence.class.isInstance( children[i] ) || ASTChain.class.isInstance( children[i] ) )
+                if ( ( children[i] instanceof ASTProperty || children[i] instanceof ASTMethod
+                    || children[i] instanceof ASTSequence || children[i] instanceof ASTChain)
                     && value != null && !value.trim().isEmpty() )
                 {
 
                     String pre = null;
-                    if ( ASTMethod.class.isInstance( children[i] ) )
+                    if (children[i] instanceof ASTMethod)
                     {
                         pre = (String) context.get( "_currentChain" );
                     }
diff --git a/src/main/java/org/apache/commons/ognl/ListPropertyAccessor.java b/src/main/java/org/apache/commons/ognl/ListPropertyAccessor.java
index db05704..bafd9cc 100644
--- a/src/main/java/org/apache/commons/ognl/ListPropertyAccessor.java
+++ b/src/main/java/org/apache/commons/ognl/ListPropertyAccessor.java
@@ -154,7 +154,7 @@
     {
         if ( index instanceof String )
         {
-            String key = ( (String) index ).replaceAll( "\"", "" );
+            String key = ( (String) index ).replace( "\"", "" );
             if ( "size".equals( key ) )
             {
                 return int.class;
@@ -181,9 +181,9 @@
     @Override
     public String getSourceAccessor( OgnlContext context, Object target, Object index )
     {
-        String indexStr = index.toString().replaceAll( "\"", "" );
+        String indexStr = index.toString().replace( "\"", "" );
 
-        if ( String.class.isInstance( index ) )
+        if (index instanceof String)
         {
             if ( "size".equals( indexStr ) )
             {
@@ -213,7 +213,7 @@
     @Override
     public String getSourceSetter( OgnlContext context, Object target, Object index )
     {
-        String indexStr = index.toString().replaceAll( "\"", "" );
+        String indexStr = index.toString().replace( "\"", "" );
 
         // TODO: This feels really inefficient, must be some better way
         // check if the index string represents a method on a custom class implementing java.util.List instead..
@@ -231,7 +231,7 @@
     {
         Object currentObject = context.getCurrentObject();
         Class<?> currentType = context.getCurrentType();
-        if ( currentObject != null && !Number.class.isInstance( currentObject ) )
+        if ( currentObject != null && !(currentObject instanceof Number))
         {
             try
             {
@@ -274,7 +274,7 @@
         {
             // means it needs to be cast first as well
 
-            String toString = String.class.isInstance( index ) && currentType != Object.class ? "" : ".toString()";
+            String toString = index instanceof String && currentType != Object.class ? "" : ".toString()";
 
             indexStr = "org.apache.commons.ognl.OgnlOps#getIntValue(" + indexStr + toString + ")";
         }
diff --git a/src/main/java/org/apache/commons/ognl/MapPropertyAccessor.java b/src/main/java/org/apache/commons/ognl/MapPropertyAccessor.java
index 2e92e27..df526d4 100644
--- a/src/main/java/org/apache/commons/ognl/MapPropertyAccessor.java
+++ b/src/main/java/org/apache/commons/ognl/MapPropertyAccessor.java
@@ -118,26 +118,26 @@
         context.setCurrentAccessor( Map.class );
         context.setCurrentType( Object.class );
 
-        if ( String.class.isInstance( index ) && !indexedAccess )
+        if ( index instanceof String && !indexedAccess )
         {
-            String key = indexStr.replaceAll( "\"", "" );
+            String key = indexStr.replace( "\"", "" );
 
             if ( "size".equals( key ) )
             {
                 context.setCurrentType( int.class );
                 return ".size()";
             }
-            else if ( "keys".equals( key ) || "keySet".equals( key ) )
+            if ( "keys".equals( key ) || "keySet".equals( key ) )
             {
                 context.setCurrentType( Set.class );
                 return ".keySet()";
             }
-            else if ( "values".equals( key ) )
+            if ( "values".equals( key ) )
             {
                 context.setCurrentType( Collection.class );
                 return ".values()";
             }
-            else if ( "isEmpty".equals( key ) )
+            if ( "isEmpty".equals( key ) )
             {
                 context.setCurrentType( boolean.class );
                 return ".isEmpty()";
@@ -154,9 +154,9 @@
 
         String indexStr = index.toString();
 
-        if ( String.class.isInstance( index ) )
+        if (index instanceof String)
         {
-            String key = indexStr.replaceAll( "\"", "" );
+            String key = indexStr.replace( "\"", "" );
 
             if ( "size".equals( key ) || "keys".equals( key ) || "keySet".equals( key ) || "values".equals( key )
                 || "isEmpty".equals( key ) )
diff --git a/src/main/java/org/apache/commons/ognl/MethodAccessor.java b/src/main/java/org/apache/commons/ognl/MethodAccessor.java
index 8150ba7..6353c09 100644
--- a/src/main/java/org/apache/commons/ognl/MethodAccessor.java
+++ b/src/main/java/org/apache/commons/ognl/MethodAccessor.java
@@ -29,7 +29,7 @@
 {
     /**
      * Calls the static method named with the arguments given on the class given.
-     * 
+     *
      * @param context expression context in which the method should be called
      * @param targetClass the object in which the method exists
      * @param methodName the name of the method
@@ -42,7 +42,7 @@
 
     /**
      * Calls the method named with the arguments given.
-     * 
+     *
      * @param context expression context in which the method should be called
      * @param target the object in which the method exists
      * @param methodName the name of the method
diff --git a/src/main/java/org/apache/commons/ognl/Node.java b/src/main/java/org/apache/commons/ognl/Node.java
index 5cc3d15..6ab0b5c 100644
--- a/src/main/java/org/apache/commons/ognl/Node.java
+++ b/src/main/java/org/apache/commons/ognl/Node.java
@@ -77,14 +77,14 @@
 
     /**
      * Gets the compiled bytecode enhanced expression accessor for getting/setting values.
-     * 
+     *
      * @return The accessor for this node, or null if none has been compiled for it.
      */
     ExpressionAccessor getAccessor();
 
     /**
      * Sets a new compiled accessor for this node expression.
-     * 
+     *
      * @param accessor The compiled representation of this node.
      */
     void setAccessor( ExpressionAccessor accessor );
diff --git a/src/main/java/org/apache/commons/ognl/NodeType.java b/src/main/java/org/apache/commons/ognl/NodeType.java
index 6b28dc8..cd6847e 100644
--- a/src/main/java/org/apache/commons/ognl/NodeType.java
+++ b/src/main/java/org/apache/commons/ognl/NodeType.java
@@ -27,14 +27,14 @@
 {
     /**
      * The type returned from the expression - if any.
-     * 
+     *
      * @return The type.
      */
     Class<?> getGetterClass();
 
     /**
      * The type used to set the value - if any.
-     * 
+     *
      * @return The type.
      */
     Class<?> getSetterClass();
diff --git a/src/main/java/org/apache/commons/ognl/NumericExpression.java b/src/main/java/org/apache/commons/ognl/NumericExpression.java
index 06dc46a..266ba46 100644
--- a/src/main/java/org/apache/commons/ognl/NumericExpression.java
+++ b/src/main/java/org/apache/commons/ognl/NumericExpression.java
@@ -108,13 +108,13 @@
         StringBuilder ret = new StringBuilder( source );
         Object value = context.getCurrentObject();
 
-        if ( ASTConst.class.isInstance( child ) && value != null )
+        if ( child instanceof ASTConst && value != null )
         {
             return value.toString();
         }
 
         if ( context.getCurrentType() != null && !context.getCurrentType().isPrimitive()
-            && context.getCurrentObject() != null && Number.class.isInstance( context.getCurrentObject() ) )
+            && context.getCurrentObject() != null && context.getCurrentObject() instanceof Number)
         {
             ret = new StringBuilder( "((" ).append(
                 ExpressionCompiler.getCastString( context.getCurrentObject().getClass() ) ).append( ")" ).append(
@@ -122,7 +122,7 @@
                 OgnlRuntime.getNumericValueGetter( context.getCurrentObject().getClass() ) );
         }
         else if ( context.getCurrentType() != null && context.getCurrentType().isPrimitive()
-            && ( ASTConst.class.isInstance( child ) || NumericExpression.class.isInstance( child ) ) )
+            && ( child instanceof ASTConst || child instanceof NumericExpression) )
         {
             @SuppressWarnings( "unchecked" ) // checked by the condition in the if clause
             Class<? extends Number> numberClass = (Class<? extends Number>) context.getCurrentType();
@@ -136,7 +136,7 @@
             context.setCurrentType( Double.TYPE );
         }
 
-        if ( NumericExpression.class.isInstance( child ) )
+        if (child instanceof NumericExpression)
         {
             ret = new StringBuilder( "(" ).append( ret ).append( ")" );
         }
diff --git a/src/main/java/org/apache/commons/ognl/ObjectIndexedPropertyDescriptor.java b/src/main/java/org/apache/commons/ognl/ObjectIndexedPropertyDescriptor.java
index 7d5096b..7dd000e 100644
--- a/src/main/java/org/apache/commons/ognl/ObjectIndexedPropertyDescriptor.java
+++ b/src/main/java/org/apache/commons/ognl/ObjectIndexedPropertyDescriptor.java
@@ -29,7 +29,7 @@
  * IndexedPropertyDescriptor this allows the "key" to be an arbitrary object rather than just an int. Consequently it
  * does not have a "readMethod" or "writeMethod" because it only expects a pattern like:
  * </p>
- * 
+ *
  * <pre>
  *    public void set<i>Property</i>(<i>KeyType</i>, <i>ValueType</i>);
  *    public <i>ValueType</i> get<i>Property</i>(<i>KeyType</i>);
@@ -42,12 +42,12 @@
  * <p>
  * For example, if an object were to have methods that accessed and "attributes" property it would be natural to index
  * them by String rather than by integer and expose the attributes as a map with a different property name:
- * 
+ *
  * <pre>
  * public void setAttribute( String name, Object value );
- * 
+ *
  * public Object getAttribute( String name );
- * 
+ *
  * public Map getAttributes();
  * </pre>
  * <p>
diff --git a/src/main/java/org/apache/commons/ognl/ObjectPropertyAccessor.java b/src/main/java/org/apache/commons/ognl/ObjectPropertyAccessor.java
index 5cb3d59..ba5c743 100644
--- a/src/main/java/org/apache/commons/ognl/ObjectPropertyAccessor.java
+++ b/src/main/java/org/apache/commons/ognl/ObjectPropertyAccessor.java
@@ -52,16 +52,10 @@
             {
                 result = OgnlRuntime.getFieldValue( ognlContext, target, name, true );
             }
-        }
-        catch ( IntrospectionException ex )
-        {
-            throw new OgnlException( name, ex );
-        }
-        catch ( OgnlException ex )
+        } catch ( OgnlException ex )
         {
             throw ex;
-        }
-        catch ( Exception ex )
+        } catch ( Exception ex )
         {
             throw new OgnlException( name, ex );
         }
@@ -90,19 +84,13 @@
                 Method m = OgnlRuntime.getWriteMethod( target.getClass(), name );
                 if ( m != null )
                 {
-                    result = m.invoke( target, new Object[] { value } );
+                    result = m.invoke( target, value );
                 }
             }
-        }
-        catch ( IntrospectionException ex )
-        {
-            throw new OgnlException( name, ex );
-        }
-        catch ( OgnlException ex )
+        } catch ( OgnlException ex )
         {
             throw ex;
-        }
-        catch ( Exception ex )
+        } catch ( Exception ex )
         {
             throw new OgnlException( name, ex );
         }
@@ -187,7 +175,7 @@
 
                 if ( String.class.isAssignableFrom( index.getClass() ) && !target.getClass().isArray() )
                 {
-                    String key = ( (String) index ).replaceAll( "\"", "" );
+                    String key = ( (String) index ).replace( "\"", "" );
                     try
                     {
                         Field f = target.getClass().getField( key );
@@ -220,7 +208,7 @@
         try
         {
 
-            String methodName = index.toString().replaceAll( "\"", "" );
+            String methodName = index.toString().replace( "\"", "" );
             Method m = OgnlRuntime.getReadMethod( target.getClass(), methodName );
 
             // try last ditch effort of checking if they were trying to do reflection via a return method value
@@ -229,7 +217,7 @@
             {
                 m =
                     OgnlRuntime.getReadMethod( target.getClass(),
-                                               context.getCurrentObject().toString().replaceAll( "\"", "" ) );
+                                               context.getCurrentObject().toString().replace( "\"", "" ) );
             }
             // System.out.println("tried to get read method from target: " + target.getClass() + " with methodName:" +
             // methodName + " result: " + m);
@@ -278,14 +266,14 @@
         try
         {
 
-            String methodName = index.toString().replaceAll( "\"", "" );
+            String methodName = index.toString().replace( "\"", "" );
             Method m = OgnlRuntime.getWriteMethod( target.getClass(), methodName );
 
             if ( m == null && context.getCurrentObject() != null && context.getCurrentObject().toString() != null )
             {
                 m =
                     OgnlRuntime.getWriteMethod( target.getClass(),
-                                                context.getCurrentObject().toString().replaceAll( "\"", "" ) );
+                                                context.getCurrentObject().toString().replace( "\"", "" ) );
             }
 
             if ( m == null || m.getParameterTypes() == null || m.getParameterTypes().length <= 0 )
diff --git a/src/main/java/org/apache/commons/ognl/Ognl.java b/src/main/java/org/apache/commons/ognl/Ognl.java
index 1d1ed1f..6d1394b 100644
--- a/src/main/java/org/apache/commons/ognl/Ognl.java
+++ b/src/main/java/org/apache/commons/ognl/Ognl.java
@@ -32,9 +32,9 @@
  * The simplest use of the Ognl class is to get the value of an expression from an object, without extra context or
  * pre-parsing.
  * </p>
- * 
+ *
  * <pre>
- * 
+ *
  * import org.apache.commons.ognl.Ognl;
  * import org.apache.commons.ognl.OgnlException;
  * ...
@@ -46,7 +46,7 @@
  * {
  *     // Report error or recover
  * }
- * 
+ *
  * </pre>
  * <p>
  * This will parse the expression given and evaluate it against the root object given, returning the result. If there is
@@ -68,9 +68,9 @@
  * Here is an example that shows how to extract the <code>documentName</code> property out of the root object and append
  * a string with the current user name in parens:
  * </p>
- * 
+ *
  * <pre>
- * 
+ *
  * private Map&lt;String, Object&gt; context = new HashMap&lt;String, Object&gt;();
  * ...
  * public void setUserName( String value )
@@ -88,7 +88,7 @@
  * {
  *     // Report error or recover
  * }
- * 
+ *
  * </pre>
  */
 public abstract class Ognl
@@ -97,7 +97,7 @@
     /**
      * Parses the given OGNL expression and returns a tree representation of the expression that can be used by
      * <code>Ognl</code> static methods.
-     * 
+     *
      * @param expression the OGNL expression to be parsed
      * @return a tree representation of the expression
      * @throws ExpressionSyntaxException if the expression is malformed
@@ -111,11 +111,7 @@
             OgnlParser parser = new OgnlParser( new StringReader( expression ) );
             return parser.topLevelExpression();
         }
-        catch ( ParseException e )
-        {
-            throw new ExpressionSyntaxException( expression, e );
-        }
-        catch ( TokenMgrError e )
+        catch ( ParseException | TokenMgrError e )
         {
             throw new ExpressionSyntaxException( expression, e );
         }
@@ -125,7 +121,7 @@
      * Parses and compiles the given expression using the {@link org.apache.commons.ognl.enhance.OgnlExpressionCompiler}
      * returned from
      * {@link org.apache.commons.ognl.OgnlRuntime#getCompiler(OgnlContext)}.
-     * 
+     *
      * @param context The context to use.
      * @param root The root object for the given expression.
      * @param expression The expression to compile.
@@ -148,7 +144,7 @@
 
     /**
      * Creates and returns a new standard naming context for evaluating an OGNL expression.
-     * 
+     *
      * @param root the root of the object graph
      * @return a new Map with the keys <code>root</code> and <code>context</code> set appropriately
      */
@@ -159,7 +155,7 @@
 
     /**
      * Creates and returns a new standard naming context for evaluating an OGNL expression.
-     * 
+     *
      * @param root The root of the object graph.
      * @param classResolver The resolver used to instantiate {@link Class} instances referenced in the expression.
      * @return a new OgnlContext with the keys <code>root</code> and <code>context</code> set appropriately
@@ -171,7 +167,7 @@
 
     /**
      * Creates and returns a new standard naming context for evaluating an OGNL expression.
-     * 
+     *
      * @param root The root of the object graph.
      * @param classResolver The resolver used to instantiate {@link Class} instances referenced in the expression.
      * @param converter Converter used to convert return types of an expression in to their desired types.
@@ -185,7 +181,7 @@
 
     /**
      * Creates and returns a new standard naming context for evaluating an OGNL expression.
-     * 
+     *
      * @param root The root of the object graph.
      * @param classResolver The resolver used to instantiate {@link Class} instances referenced in the expression.
      * @param converter Converter used to convert return types of an expression in to their desired types.
@@ -202,7 +198,7 @@
     /**
      * Appends the standard naming context for evaluating an OGNL expression into the context given so that cached maps
      * can be used as a context.
-     * 
+     *
      * @param root the root of the object graph
      * @param context the context to which OGNL context will be added.
      * @return Context Map with the keys <code>root</code> and <code>context</code> set appropriately
@@ -215,7 +211,7 @@
     /**
      * Appends the standard naming context for evaluating an OGNL expression into the context given so that cached maps
      * can be used as a context.
-     * 
+     *
      * @param root The root of the object graph.
      * @param classResolver The resolver used to instantiate {@link Class} instances referenced in the expression.
      * @param context The context to which OGNL context will be added.
@@ -230,7 +226,7 @@
     /**
      * Appends the standard naming context for evaluating an OGNL expression into the context given so that cached maps
      * can be used as a context.
-     * 
+     *
      * @param root The root of the object graph.
      * @param classResolver The resolver used to instantiate {@link Class} instances referenced in the expression.
      * @param converter Converter used to convert return types of an expression in to their desired types.
@@ -246,7 +242,7 @@
     /**
      * Appends the standard naming context for evaluating an OGNL expression into the context given so that cached maps
      * can be used as a context.
-     * 
+     *
      * @param root the root of the object graph
      * @param classResolver The class loading resolver that should be used to resolve class references.
      * @param converter The type converter to be used by default.
@@ -290,7 +286,7 @@
     /**
      * Configures the {@link ClassResolver} to use for the given context. Will be used during expression parsing /
      * execution to resolve class names.
-     * 
+     *
      * @param context The context to place the resolver.
      * @param classResolver The resolver to use to resolve classes.
      */
@@ -301,7 +297,7 @@
 
     /**
      * Gets the previously stored {@link ClassResolver} for the given context - if any.
-     * 
+     *
      * @param context The context to get the configured resolver from.
      * @return The resolver instance, or null if none found.
      */
@@ -313,7 +309,7 @@
     /**
      * Configures the type converter to use for a given context. This will be used to convert into / out of various java
      * class types.
-     * 
+     *
      * @param context The context to configure it for.
      * @param converter The converter to use.
      */
@@ -324,7 +320,7 @@
 
     /**
      * Gets the currently configured {@link TypeConverter} for the given context - if any.
-     * 
+     *
      * @param context The context to get the converter from.
      * @return The converter - or null if none found.
      */
@@ -336,7 +332,7 @@
     /**
      * Configures the specified context with a {@link MemberAccess} instance for handling field/method protection
      * levels.
-     * 
+     *
      * @param context The context to configure.
      * @param memberAccess The access resolver to configure the context with.
      */
@@ -347,7 +343,7 @@
 
     /**
      * Gets the currently stored {@link MemberAccess} object for the given context - if any.
-     * 
+     *
      * @param context The context to get the object from.
      * @return The configured {@link MemberAccess} instance in the specified context - or null if none found.
      */
@@ -359,7 +355,7 @@
     /**
      * Sets the root object to use for all expressions in the given context - doesn't necessarily replace root object
      * instances explicitly passed in to other expression resolving methods on this class.
-     * 
+     *
      * @param context The context to store the root object in.
      * @param root The root object.
      */
@@ -370,7 +366,7 @@
 
     /**
      * Gets the stored root object for the given context - if any.
-     * 
+     *
      * @param context The context to get the root object from.
      * @return The root object - or null if none found.
      */
@@ -381,7 +377,7 @@
 
     /**
      * Gets the last {@link Evaluation} executed on the given context.
-     * 
+     *
      * @param context The context to get the evaluation from.
      * @return The {@link Evaluation} - or null if none was found.
      */
@@ -393,7 +389,7 @@
     /**
      * Evaluates the given OGNL expression tree to extract a value from the given root object. The default context is
      * set for the given context and root via <code>addDefaultContext()</code>.
-     * 
+     *
      * @param tree the OGNL expression tree to evaluate, as returned by parseExpression()
      * @param context the naming context for the evaluation
      * @param root the root object for the OGNL expression
@@ -412,7 +408,7 @@
     /**
      * Evaluates the given OGNL expression tree to extract a value from the given root object. The default context is
      * set for the given context and root via <code>addDefaultContext()</code>.
-     * 
+     *
      * @param tree the OGNL expression tree to evaluate, as returned by parseExpression()
      * @param context the naming context for the evaluation
      * @param root the root object for the OGNL expression
@@ -450,7 +446,7 @@
 
     /**
      * Gets the value represented by the given pre-compiled expression on the specified root object.
-     * 
+     *
      * @param expression The pre-compiled expression, as found in {@link Node#getAccessor()}.
      * @param context The ognl context.
      * @param root The object to retrieve the expression value from.
@@ -464,7 +460,7 @@
 
     /**
      * Gets the value represented by the given pre-compiled expression on the specified root object.
-     * 
+     *
      * @param expression The pre-compiled expression, as found in {@link Node#getAccessor()}.
      * @param context The ognl context.
      * @param root The object to retrieve the expression value from.
@@ -481,7 +477,7 @@
 
     /**
      * Evaluates the given OGNL expression to extract a value from the given root object in a given context
-     * 
+     *
      * @see #parseExpression(String)
      * @see #getValue(Object,Object)
      * @param expression the OGNL expression to be parsed
@@ -501,7 +497,7 @@
 
     /**
      * Evaluates the given OGNL expression to extract a value from the given root object in a given context
-     * 
+     *
      * @see #parseExpression(String)
      * @see #getValue(Object,Object)
      * @param expression the OGNL expression to be parsed
@@ -522,7 +518,7 @@
 
     /**
      * Evaluates the given OGNL expression tree to extract a value from the given root object.
-     * 
+     *
      * @param tree the OGNL expression tree to evaluate, as returned by parseExpression()
      * @param root the root object for the OGNL expression
      * @return the result of evaluating the expression
@@ -539,7 +535,7 @@
 
     /**
      * Evaluates the given OGNL expression tree to extract a value from the given root object.
-     * 
+     *
      * @param tree the OGNL expression tree to evaluate, as returned by parseExpression()
      * @param root the root object for the OGNL expression
      * @param resultType the converted type of the resultant object, using the context's type converter
@@ -557,7 +553,7 @@
 
     /**
      * Convenience method that combines calls to <code> parseExpression </code> and <code> getValue</code>.
-     * 
+     *
      * @see #parseExpression(String)
      * @see #getValue(Object,Object)
      * @param expression the OGNL expression to be parsed
@@ -577,7 +573,7 @@
 
     /**
      * Convenience method that combines calls to <code> parseExpression </code> and <code> getValue</code>.
-     * 
+     *
      * @see #parseExpression(String)
      * @see #getValue(Object,Object)
      * @param expression the OGNL expression to be parsed
@@ -599,7 +595,7 @@
     /**
      * Evaluates the given OGNL expression tree to insert a value into the object graph rooted at the given root object.
      * The default context is set for the given context and root via <code>addDefaultContext()</code>.
-     * 
+     *
      * @param tree the OGNL expression tree to evaluate, as returned by parseExpression()
      * @param context the naming context for the evaluation
      * @param root the root object for the OGNL expression
@@ -626,7 +622,7 @@
 
     /**
      * Sets the value given using the pre-compiled expression on the specified root object.
-     * 
+     *
      * @param expression The pre-compiled expression, as found in {@link Node#getAccessor()}.
      * @param context The ognl context.
      * @param root The object to set the expression value on.
@@ -640,7 +636,7 @@
     /**
      * Evaluates the given OGNL expression to insert a value into the object graph rooted at the given root object given
      * the context.
-     * 
+     *
      * @param expression the OGNL expression to be parsed
      * @param root the root object for the OGNL expression
      * @param context the naming context for the evaluation
@@ -658,7 +654,7 @@
 
     /**
      * Evaluates the given OGNL expression tree to insert a value into the object graph rooted at the given root object.
-     * 
+     *
      * @param tree the OGNL expression tree to evaluate, as returned by parseExpression()
      * @param root the root object for the OGNL expression
      * @param value the value to insert into the object graph
@@ -675,7 +671,7 @@
 
     /**
      * Convenience method that combines calls to <code> parseExpression </code> and <code> setValue</code>.
-     * 
+     *
      * @see #parseExpression(String)
      * @see #setValue(Object,Object,Object)
      * @param expression the OGNL expression to be parsed
@@ -695,7 +691,7 @@
 
     /**
      * Checks if the specified {@link Node} instance represents a constant expression.
-     * 
+     *
      * @param tree The {@link Node} to check.
      * @param context The context to use.
      * @return True if the node is a constant - false otherwise.
@@ -709,7 +705,7 @@
 
     /**
      * Checks if the specified expression represents a constant expression.
-     * 
+     *
      * @param expression The expression to check.
      * @param context The context to use.
      * @return True if the node is a constant - false otherwise.
@@ -723,7 +719,7 @@
 
     /**
      * Same as {@link #isConstant(Object, java.util.Map)} - only the {@link Map} context is created for you.
-     * 
+     *
      * @param tree The {@link Node} to check.
      * @return True if the node represents a constant expression - false otherwise.
      * @throws OgnlException If an exception occurs.
@@ -736,7 +732,7 @@
 
     /**
      * Same as {@link #isConstant(String, java.util.Map)} - only the {@link Map} instance is created for you.
-     * 
+     *
      * @param expression The expression to check.
      * @return True if the expression represents a constant - false otherwise.
      * @throws OgnlException If an exception occurs.
diff --git a/src/main/java/org/apache/commons/ognl/OgnlCache.java b/src/main/java/org/apache/commons/ognl/OgnlCache.java
index 6a0fe58..2d836d2 100644
--- a/src/main/java/org/apache/commons/ognl/OgnlCache.java
+++ b/src/main/java/org/apache/commons/ognl/OgnlCache.java
@@ -112,14 +112,7 @@
         cacheFactory.createClassCache( new PropertyDescriptorCacheEntryFactory() );
 
     private final ClassCache<List<Constructor<?>>> constructorCache =
-        cacheFactory.createClassCache( new ClassCacheEntryFactory<List<Constructor<?>>>()
-        {
-            public List<Constructor<?>> create( Class<?> key )
-                throws CacheException
-            {
-                return Arrays.<Constructor<?>>asList( key.getConstructors() );
-            }
-        } );
+        cacheFactory.createClassCache(key -> Arrays.<Constructor<?>>asList( key.getConstructors() ));
 
     private final Cache<DeclaredMethodCacheEntry, Map<String, List<Method>>> _methodCache =
         cacheFactory.createCache( new DeclaredMethodCacheEntryFactory() );
@@ -131,26 +124,13 @@
         cacheFactory.createClassCache( new FieldCacheEntryFactory() );
 
     private final Cache<Method, Class<?>[]> _methodParameterTypesCache =
-        cacheFactory.createCache( new CacheEntryFactory<Method, Class<?>[]>()
-        {
-            public Class<?>[] create( Method key )
-                throws CacheException
-            {
-                return key.getParameterTypes( );
-            }
-        } );
+        cacheFactory.createCache(Method::getParameterTypes);
 
     private final Cache<GenericMethodParameterTypeCacheEntry, Class<?>[]> _genericMethodParameterTypesCache =
         cacheFactory.createCache( new GenericMethodParameterTypeFactory() );
 
     private final Cache<Constructor<?>, Class<?>[]> _ctorParameterTypesCache =
-        cacheFactory.createCache( new CacheEntryFactory<Constructor<?>, Class<?>[]>()
-        {
-            public Class<?>[] create( Constructor<?> key ) throws CacheException
-            {
-                return key.getParameterTypes( );
-            }
-        } );
+        cacheFactory.createCache(Constructor::getParameterTypes);
 
     private final Cache<Method, MethodAccessEntryValue> _methodAccessCache =
         cacheFactory.createCache( new MethodAccessCacheEntryFactory( ) );
diff --git a/src/main/java/org/apache/commons/ognl/OgnlContext.java b/src/main/java/org/apache/commons/ognl/OgnlContext.java
index ddf7143..78a71b0 100644
--- a/src/main/java/org/apache/commons/ognl/OgnlContext.java
+++ b/src/main/java/org/apache/commons/ognl/OgnlContext.java
@@ -111,12 +111,12 @@
             s = System.getProperty( PROPERTY_KEY_PREFIX + ".traceEvaluations" );
             if ( s != null )
             {
-                defaultTraceEvaluations = Boolean.valueOf( s.trim() );
+                defaultTraceEvaluations = Boolean.parseBoolean( s.trim() );
             }
             s = System.getProperty( PROPERTY_KEY_PREFIX + ".keepLastEvaluation" );
             if ( s != null )
             {
-                defaultKeepLastEvaluation = Boolean.valueOf( s.trim() );
+                defaultKeepLastEvaluation = Boolean.parseBoolean( s.trim() );
             }
         }
         catch ( SecurityException ex )
@@ -163,7 +163,6 @@
 
     public OgnlContext( Map<String, Object> values )
     {
-        super();
         this.values = values;
     }
 
@@ -344,7 +343,7 @@
 
     /**
      * Gets the current class type being evaluated on the stack, as set by {@link #setCurrentType(Class)}.
-     * 
+     *
      * @return The current object type, may be null.
      */
     public Class<?> getCurrentType()
@@ -365,7 +364,7 @@
     /**
      * Represents the last known object type on the evaluation stack, will be the value of the last known
      * {@link #getCurrentType()}.
-     * 
+     *
      * @return The previous type of object on the stack, may be null.
      */
     public Class<?> getPreviousType()
diff --git a/src/main/java/org/apache/commons/ognl/OgnlException.java b/src/main/java/org/apache/commons/ognl/OgnlException.java
index 82deb81..a9da138 100644
--- a/src/main/java/org/apache/commons/ognl/OgnlException.java
+++ b/src/main/java/org/apache/commons/ognl/OgnlException.java
@@ -37,7 +37,7 @@
     {
         try
         {
-            initCause = OgnlException.class.getMethod( "initCause", new Class[] { Throwable.class } );
+            initCause = OgnlException.class.getMethod( "initCause", Throwable.class );
         }
         catch ( NoSuchMethodException e )
         {
@@ -52,7 +52,7 @@
 
     /**
      * Why this exception was thrown.
-     * 
+     *
      * @serial
      */
     private final Throwable reason;
@@ -65,7 +65,7 @@
 
     /**
      * Constructs an OgnlException with the given message but no encapsulated exception.
-     * 
+     *
      * @param msg the exception's detail message
      */
     public OgnlException( String msg )
@@ -75,7 +75,7 @@
 
     /**
      * Constructs an OgnlException with the given message and encapsulated exception.
-     * 
+     *
      * @param msg the exception's detail message
      * @param reason the encapsulated exception
      */
@@ -99,7 +99,7 @@
 
     /**
      * Returns the encapsulated exception, or null if there is none.
-     * 
+     *
      * @return the encapsulated exception
      */
     public Throwable getReason()
@@ -109,7 +109,7 @@
 
     /**
      * Returns the Evaluation that was the root evaluation when the exception was thrown.
-     * 
+     *
      * @return The {@link Evaluation}.
      */
     public Evaluation getEvaluation()
@@ -119,7 +119,7 @@
 
     /**
      * Sets the Evaluation that was current when this exception was thrown.
-     * 
+     *
      * @param value The {@link Evaluation}.
      */
     public void setEvaluation( Evaluation value )
@@ -129,7 +129,7 @@
 
     /**
      * Returns a string representation of this exception.
-     * 
+     *
      * @return a string representation of this exception
      */
     @Override
diff --git a/src/main/java/org/apache/commons/ognl/OgnlOps.java b/src/main/java/org/apache/commons/ognl/OgnlOps.java
index a527b91..58fd1c7 100644
--- a/src/main/java/org/apache/commons/ognl/OgnlOps.java
+++ b/src/main/java/org/apache/commons/ognl/OgnlOps.java
@@ -40,7 +40,7 @@
      * Comparable and the types are compatible (i.e. v1 is of the same or superclass of v2's type) they are compared
      * with Comparable.compareTo(). If both values are non-numeric and not Comparable or of incompatible classes this
      * will throw and IllegalArgumentException.
-     * 
+     *
      * @param v1 First value to compare
      * @param v2 second value to compare
      * @return integer describing the comparison between the two objects. A negative number indicates that v1 < v2.
@@ -87,13 +87,13 @@
                     double dv1 = doubleValue( v1 ),
                     dv2 = doubleValue( v2 );
 
-                    return ( dv1 == dv2 ) ? 0 : ( ( dv1 < dv2 ) ? -1 : 1 );
+                    return Double.compare(dv1, dv2);
 
                 default:
                     long lv1 = longValue( v1 ),
                     lv2 = longValue( v2 );
 
-                    return ( lv1 == lv2 ) ? 0 : ( ( lv1 < lv2 ) ? -1 : 1 );
+                    return Long.compare(lv1, lv2);
             }
         }
         return result;
@@ -102,7 +102,7 @@
     /**
      * Returns true if object1 is equal to object2 in either the sense that they are the same object or, if both are
      * non-null if they are equal in the <CODE>equals()</CODE> sense.
-     * 
+     *
      * @param object1 First object to compare
      * @param object2 Second object to compare
      * @return true if v1 == v2
@@ -171,7 +171,7 @@
     /**
      * Evaluates the given object as a boolean: if it is a Boolean object, it's easy; if it's a Number or a Character,
      * returns true for non-zero objects; and otherwise returns true for non-null objects.
-     * 
+     *
      * @param value an object to interpret as a boolean
      * @return the boolean value implied by the given object
      */
@@ -200,7 +200,7 @@
 
     /**
      * Evaluates the given object as a long integer.
-     * 
+     *
      * @param value an object to interpret as a long integer
      * @return the long integer value implied by the given object
      * @throws NumberFormatException if the given object can't be understood as a long integer
@@ -229,7 +229,7 @@
 
     /**
      * Evaluates the given object as a double-precision floating-point number.
-     * 
+     *
      * @param value an object to interpret as a double
      * @return the double value implied by the given object
      * @throws NumberFormatException if the given object can't be understood as a double
@@ -260,7 +260,7 @@
 
     /**
      * Evaluates the given object as a BigInteger.
-     * 
+     *
      * @param value an object to interpret as a BigInteger
      * @return the BigInteger value implied by the given object
      * @throws NumberFormatException if the given object can't be understood as a BigInteger
@@ -297,7 +297,7 @@
 
     /**
      * Evaluates the given object as a BigDecimal.
-     * 
+     *
      * @param value an object to interpret as a BigDecimal
      * @return the BigDecimal value implied by the given object
      * @throws NumberFormatException if the given object can't be understood as a BigDecimal
@@ -330,7 +330,7 @@
 
     /**
      * Evaluates the given object as a String and trims it if the trim flag is true.
-     * 
+     *
      * @param value an object to interpret as a String
      * @param trim if true trims the result
      * @return the String value implied by the given object as returned by the toString() method, or "null" if the
@@ -357,7 +357,7 @@
 
     /**
      * Evaluates the given object as a String.
-     * 
+     *
      * @param value an object to interpret as a String
      * @return the String value implied by the given object as returned by the toString() method, or "null" if the
      *         object is null.
@@ -369,7 +369,7 @@
 
     /**
      * Returns a constant from the NumericTypes interface that represents the numeric type of the given object.
-     * 
+     *
      * @param value an object that needs to be interpreted as a number
      * @return the appropriate constant from the NumericTypes interface
      */
@@ -597,7 +597,7 @@
     /**
      * Returns the value converted numerically to the given class type This method also detects when arrays are being
      * converted and converts the components of one array to the type of the other.
-     * 
+     *
      * @param value an object to be converted to the given type
      * @param toType class type to be converted to
      * @return converted value of the type given, or value if the value cannot be converted to the given type.
@@ -785,7 +785,7 @@
      * <li>{@link Number} instances have their intValue() methods invoked.</li>
      * <li>All other types result in calling Integer.parseInt(value.toString());</li>
      * </ul>
-     * 
+     *
      * @param value The object to get the value of.
      * @return A valid integer.
      */
@@ -798,13 +798,13 @@
                 return -1;
             }
 
-            if ( Number.class.isInstance( value ) )
+            if (value instanceof Number)
             {
 
                 return ( (Number) value ).intValue();
             }
 
-            String str = String.class.isInstance( value ) ? (String) value : value.toString();
+            String str = value instanceof String ? (String) value : value.toString();
 
             return Integer.parseInt( str );
         }
@@ -817,7 +817,7 @@
     /**
      * Returns the constant from the NumericTypes interface that best expresses the type of a numeric operation on the
      * two given objects.
-     * 
+     *
      * @param v1 one argument to a numeric operator
      * @param v2 the other argument
      * @return the appropriate constant from the NumericTypes interface
@@ -830,7 +830,7 @@
     /**
      * Returns the constant from the NumericTypes interface that best expresses the type of an operation, which can be
      * either numeric or not, on the two given types.
-     * 
+     *
      * @param t1 type of one argument to an operator
      * @param t2 type of the other argument
      * @param canBeNonNumeric whether the operator can be interpreted as non-numeric
@@ -873,28 +873,24 @@
             }
             return Math.max( DOUBLE, t1 );
         }
-        else if ( t2 >= MIN_REAL_TYPE )
-        {
-            if ( t1 < INT )
-            {
-                return t2;
-            }
-            if ( t1 == BIGINT )
-            {
-                return BIGDEC;
-            }
-            return Math.max( DOUBLE, t2 );
-        }
-        else
-        {
+        if ( t2 < MIN_REAL_TYPE ) {
             return Math.max( t1, t2 );
         }
+        if ( t1 < INT )
+        {
+            return t2;
+        }
+        if ( t1 == BIGINT )
+        {
+            return BIGDEC;
+        }
+        return Math.max( DOUBLE, t2 );
     }
 
     /**
      * Returns the constant from the NumericTypes interface that best expresses the type of an operation, which can be
      * either numeric or not, on the two given objects.
-     * 
+     *
      * @param v1 one argument to an operator
      * @param v2 the other argument
      * @param canBeNonNumeric whether the operator can be interpreted as non-numeric
@@ -908,7 +904,7 @@
     /**
      * Returns a new Number object of an appropriate type to hold the given integer value. The type of the returned
      * object is consistent with the given type argument, which is a constant from the NumericTypes interface.
-     * 
+     *
      * @param type the nominal numeric type of the result, a constant from the NumericTypes interface
      * @param value the integer value to convert to a Number object
      * @return a Number object with the given value, of type implied by the type argument
@@ -952,7 +948,7 @@
      * Returns a new Number object of an appropriate type to hold the given real value. The type of the returned object
      * is always either Float or Double, and is only Float if the given type tag (a constant from the NumericTypes
      * interface) is FLOAT.
-     * 
+     *
      * @param type the nominal numeric type of the result, a constant from the NumericTypes interface
      * @param value the real value to convert to a Number object
      * @return a Number object with the given value, of type implied by the type argument
@@ -1290,18 +1286,18 @@
     /**
      * Utility method that converts incoming exceptions to {@link RuntimeException} instances - or casts them if they
      * already are.
-     * 
+     *
      * @param t The exception to cast.
      * @return The exception cast to a {@link RuntimeException}.
      */
     public static RuntimeException castToRuntime( Throwable t )
     {
-        if ( RuntimeException.class.isInstance( t ) )
+        if (t instanceof RuntimeException)
         {
             return (RuntimeException) t;
         }
 
-        if ( OgnlException.class.isInstance( t ) )
+        if (t instanceof OgnlException)
         {
             throw new UnsupportedCompilationException( "Error evluating expression: " + t.getMessage(), t );
         }
diff --git a/src/main/java/org/apache/commons/ognl/OgnlRuntime.java b/src/main/java/org/apache/commons/ognl/OgnlRuntime.java
index 05e6878..338fed3 100644
--- a/src/main/java/org/apache/commons/ognl/OgnlRuntime.java
+++ b/src/main/java/org/apache/commons/ognl/OgnlRuntime.java
@@ -122,7 +122,7 @@
      */
     private static final String NULL_OBJECT_STRING = "<null>";
 
-    static OgnlCache cache = new OgnlCache();
+    static final OgnlCache cache = new OgnlCache();
 
     private static final PrimitiveTypes primitiveTypes = new PrimitiveTypes();
 
@@ -395,8 +395,7 @@
     public static Class<?>[] findParameterTypes( Class<?> type, Method method )
         throws CacheException
     {
-        if ( type == null || type.getGenericSuperclass() == null || !ParameterizedType.class.isInstance(
-            type.getGenericSuperclass() ) || method.getDeclaringClass().getTypeParameters() == null )
+        if ( type == null || type.getGenericSuperclass() == null || !(type.getGenericSuperclass() instanceof ParameterizedType) || method.getDeclaringClass().getTypeParameters() == null )
         {
             return getParameterTypes( method );
         }
@@ -508,7 +507,7 @@
         {
             return Boolean.TYPE;
         }
-        else if ( clazz.getSuperclass() == Number.class )
+        if ( clazz.getSuperclass() == Number.class )
         {
             if ( clazz == Integer.class )
             {
@@ -629,11 +628,11 @@
                 {
                     return true;
                 }
-                else if ( class1.isAssignableFrom( class2 ) )
+                if ( class1.isAssignableFrom( class2 ) )
                 {
                     return false;
                 }
-                else if ( class2.isAssignableFrom( class1 ) )
+                if ( class2.isAssignableFrom( class1 ) )
                 {
                     return true;
                 }
@@ -700,7 +699,7 @@
 
     public static boolean getConvertedTypes( OgnlContext context, Object target, Member member, String propertyName,
                                              Class<?>[] parameterTypes, Object[] args, Object[] newArgs )
-        
+
     {
         boolean result = false;
 
@@ -736,7 +735,7 @@
 
     public static Method getConvertedMethodAndArgs( OgnlContext context, Object target, String propertyName,
                                                     List<Method> methods, Object[] args, Object[] newArgs )
-        
+
     {
         Method convertedMethod = null;
         TypeConverter typeConverter = context.getTypeConverter();
@@ -762,7 +761,7 @@
     public static Constructor<?> getConvertedConstructorAndArgs( OgnlContext context, Object target,
                                                                  List<Constructor<?>> constructors, Object[] args,
                                                                  Object[] newArgs )
-        
+
     {
         Constructor<?> constructor = null;
         TypeConverter typeConverter = context.getTypeConverter();
@@ -799,7 +798,7 @@
      */
     public static Method getAppropriateMethod( OgnlContext context, Object source, Object target, String propertyName,
                                                List<Method> methods, Object[] args, Object[] actualArgs )
-        
+
     {
         Method appropriateMethod = null;
         Class<?>[] resultParameterTypes = null;
@@ -809,7 +808,7 @@
             for ( Method method : methods )
             {
                 Class<?> typeClass = target != null ? target.getClass() : null;
-                if ( typeClass == null && source != null && Class.class.isInstance( source ) )
+                if ( typeClass == null && source != null && source instanceof Class)
                 {
                     typeClass = (Class<?>) source;
                 }
@@ -927,15 +926,10 @@
             return invokeMethod( target, method, convertedArgs );
 
         }
-        catch ( NoSuchMethodException e )
+        catch ( NoSuchMethodException | IllegalAccessException e )
         {
             cause = e;
-        }
-        catch ( IllegalAccessException e )
-        {
-            cause = e;
-        }
-        catch ( InvocationTargetException e )
+        } catch ( InvocationTargetException e )
         {
             cause = e.getTargetException();
         }
@@ -1019,26 +1013,13 @@
             }
             return ctor.newInstance( actualArgs );
         }
-        catch ( ClassNotFoundException e )
+        catch ( ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException e )
         {
             cause = e;
-        }
-        catch ( NoSuchMethodException e )
-        {
-            cause = e;
-        }
-        catch ( IllegalAccessException e )
-        {
-            cause = e;
-        }
-        catch ( InvocationTargetException e )
+        } catch ( InvocationTargetException e )
         {
             cause = e.getTargetException();
         }
-        catch ( InstantiationException e )
-        {
-            cause = e;
-        }
 
         throw new MethodFailedException( className, "new", cause );
     }
@@ -1065,30 +1046,23 @@
             method = getReadMethod( targetClass, propertyName, 0 );
         }
 
-        if ( checkAccessAndExistence )
+        if ( checkAccessAndExistence && (( method == null ) || !context.getMemberAccess().isAccessible( context, target, method, propertyName )) )
         {
-            if ( ( method == null ) || !context.getMemberAccess().isAccessible( context, target, method, propertyName ) )
-            {
-                methodValue = NotFound;
-            }
+            methodValue = NotFound;
         }
         if ( methodValue == null )
         {
-            if ( method != null )
-            {
-                try
-                {
-                    methodValue = invokeMethod( target, method, NoArguments );
-                }
-                catch ( InvocationTargetException ex )
-                {
-                    throw new OgnlException( propertyName, ex.getTargetException() );
-                }
-            }
-            else
-            {
+            if ( method == null ) {
                 throw new NoSuchMethodException( propertyName );
             }
+            try
+            {
+                methodValue = invokeMethod( target, method, NoArguments );
+            }
+            catch ( InvocationTargetException ex )
+            {
+                throw new OgnlException( propertyName, ex.getTargetException() );
+            }
         }
         return methodValue;
     }
@@ -1106,12 +1080,9 @@
         boolean result = true;
         Method method = getSetMethod( context, ( target == null ) ? null : target.getClass(), propertyName );
 
-        if ( checkAccessAndExistence )
+        if ( checkAccessAndExistence && (( method == null ) || !context.getMemberAccess().isAccessible( context, target, method, propertyName )) )
         {
-            if ( ( method == null ) || !context.getMemberAccess().isAccessible( context, target, method, propertyName ) )
-            {
-                result = false;
-            }
+            result = false;
         }
 
         if ( result )
@@ -1195,12 +1166,9 @@
         Class<?> targetClass = target == null ? null : target.getClass();
         Field field = getField( targetClass, propertyName );
 
-        if ( checkAccessAndExistence )
+        if ( checkAccessAndExistence && (( field == null ) || !context.getMemberAccess().isAccessible( context, target, field, propertyName )) )
         {
-            if ( ( field == null ) || !context.getMemberAccess().isAccessible( context, target, field, propertyName ) )
-            {
-                result = NotFound;
-            }
+            result = NotFound;
         }
         if ( result == null )
         {
@@ -1212,16 +1180,12 @@
             {
                 Object state;
 
-                if ( !Modifier.isStatic( field.getModifiers() ) )
-                {
-                    state = context.getMemberAccess().setup( context, target, field, propertyName );
-                    result = field.get( target );
-                    context.getMemberAccess().restore( context, target, field, propertyName, state );
-                }
-                else
-                {
+                if ( Modifier.isStatic( field.getModifiers() ) ) {
                     throw new NoSuchFieldException( propertyName );
                 }
+                state = context.getMemberAccess().setup( context, target, field, propertyName );
+                result = field.get( target );
+                context.getMemberAccess().restore( context, target, field, propertyName, state );
 
             }
             catch ( IllegalAccessException ex )
@@ -1301,34 +1265,19 @@
             {
                 return clazz;
             }
-            else if ( clazz.isEnum() )
+            if ( clazz.isEnum() )
             {
                 return Enum.valueOf( (Class<? extends Enum>) clazz, fieldName );
             }
-            else
+            Field field = clazz.getField( fieldName );
+            if ( !Modifier.isStatic(field.getModifiers()) )
             {
-                Field field = clazz.getField( fieldName );
-                if ( !Modifier.isStatic(field.getModifiers()) )
-                {
-                    throw new OgnlException( "Field " + fieldName + " of class " + className + " is not static" );
-                }
-
-                return field.get( null );
+                throw new OgnlException( "Field " + fieldName + " of class " + className + " is not static" );
             }
+
+            return field.get( null );
         }
-        catch ( ClassNotFoundException e )
-        {
-            cause = e;
-        }
-        catch ( NoSuchFieldException e )
-        {
-            cause = e;
-        }
-        catch ( SecurityException e )
-        {
-            cause = e;
-        }
-        catch ( IllegalAccessException e )
+        catch ( ClassNotFoundException | IllegalAccessException | SecurityException | NoSuchFieldException e )
         {
             cause = e;
         }
@@ -1667,14 +1616,10 @@
             }
             else
             {
-                if ( propertyDescriptor instanceof ObjectIndexedPropertyDescriptor )
-                {
-                    method = ( (ObjectIndexedPropertyDescriptor) propertyDescriptor ).getIndexedReadMethod();
-                }
-                else
-                {
+                if ( !(propertyDescriptor instanceof ObjectIndexedPropertyDescriptor) ) {
                     throw new OgnlException( "property '" + name + "' is not an indexed property" );
                 }
+                method = ( (ObjectIndexedPropertyDescriptor) propertyDescriptor ).getIndexedReadMethod();
             }
 
             return callMethod( context, source, method.getName(), args );
@@ -1706,14 +1651,10 @@
             }
             else
             {
-                if ( propertyDescriptor instanceof ObjectIndexedPropertyDescriptor )
-                {
-                    method = ( (ObjectIndexedPropertyDescriptor) propertyDescriptor ).getIndexedWriteMethod();
-                }
-                else
-                {
+                if ( !(propertyDescriptor instanceof ObjectIndexedPropertyDescriptor) ) {
                     throw new OgnlException( "property '" + name + "' is not an indexed property" );
                 }
+                method = ( (ObjectIndexedPropertyDescriptor) propertyDescriptor ).getIndexedWriteMethod();
             }
 
             callMethod( context, source, method.getName(), args );
@@ -1847,7 +1788,7 @@
     {
         try
         {
-            name = name.replaceAll( "\"", "" ).toLowerCase();
+            name = name.replace( "\"", "" ).toLowerCase();
 
             BeanInfo info = Introspector.getBeanInfo( target );
             MethodDescriptor[] methodDescriptors = info.getMethodDescriptors();
@@ -1875,13 +1816,13 @@
                     {
                         return methodDescriptor.getMethod();
                     }
-                    else if ( numParms < 0 )
+                    if ( numParms < 0 )
                     {
                         if ( methodName.equals( name ) )
                         {
                             return methodDescriptor.getMethod();
                         }
-                        else if ( method == null || ( method.getParameterTypes().length > methodParamLen ) )
+                        if ( method == null || ( method.getParameterTypes().length > methodParamLen ) )
                         {
                             method = methodDescriptor.getMethod();
                         }
@@ -1909,13 +1850,10 @@
                     {
                         return methodDescriptor.getMethod();
                     }
-                    else if ( numParms < 0 )
+                    if ( (numParms < 0) && (method == null || ( method.getParameterTypes().length
+                        > methodDescriptor.getMethod().getParameterTypes().length )) )
                     {
-                        if ( method == null || ( method.getParameterTypes().length
-                            > methodDescriptor.getMethod().getParameterTypes().length ) )
-                        {
-                            method = methodDescriptor.getMethod();
-                        }
+                        method = methodDescriptor.getMethod();
                     }
                 }
             }
@@ -1950,7 +1888,7 @@
     {
         try
         {
-            name = name.replaceAll( "\"", "" );
+            name = name.replace( "\"", "" );
 
             BeanInfo info = Introspector.getBeanInfo( target );
             MethodDescriptor[] methods = info.getMethodDescriptors();
@@ -1971,7 +1909,7 @@
                     {
                         return method.getMethod();
                     }
-                    else if ( numParms < 0 )
+                    if ( numParms < 0 )
                     {
                         return method.getMethod();
                     }
@@ -1997,7 +1935,7 @@
                     {
                         return cmethod;
                     }
-                    else if ( numParms < 0 )
+                    if ( numParms < 0 )
                     {
                         return cmethod;
                     }
@@ -2147,7 +2085,7 @@
 
         // handle root / method expressions that may not have proper root java source access
 
-        if ( !ASTConst.class.isInstance( child ) && ( target == null || context.getRoot() != target ) )
+        if ( !(child instanceof ASTConst) && ( target == null || context.getRoot() != target ) )
         {
             source = pre + source;
         }
@@ -2158,7 +2096,7 @@
             context.setCurrentAccessor( context.getRoot().getClass() );
         }
 
-        if ( ASTChain.class.isInstance( child ) )
+        if (child instanceof ASTChain)
         {
             String cast = (String) context.remove( ExpressionCompiler.PRE_CAST );
             if ( cast == null )
diff --git a/src/main/java/org/apache/commons/ognl/PropertyAccessor.java b/src/main/java/org/apache/commons/ognl/PropertyAccessor.java
index f2213f9..c4840fa 100644
--- a/src/main/java/org/apache/commons/ognl/PropertyAccessor.java
+++ b/src/main/java/org/apache/commons/ognl/PropertyAccessor.java
@@ -40,7 +40,7 @@
 
     /**
      * Extracts and returns the property of the given name from the given target object.
-     * 
+     *
      * @param context The current execution context.
      * @param target the object to get the property from
      * @param name the name of the property to get.
@@ -52,7 +52,7 @@
 
     /**
      * Sets the value of the property of the given name in the given target object.
-     * 
+     *
      * @param context The current execution context.
      * @param target the object to set the property in
      * @param name the name of the property to set
@@ -65,7 +65,7 @@
     /**
      * Returns a java string representing the textual method that should be called to access a particular element. (ie
      * "get")
-     * 
+     *
      * @param context The current execution context.
      * @param target The current object target on the expression tree being evaluated.
      * @param index The index object that will be placed inside the string to access the value.
@@ -76,7 +76,7 @@
     /**
      * Returns a java string representing the textual method that should be called to set a particular element. (ie
      * "set")
-     * 
+     *
      * @param context The current execution context.
      * @param target The current object target on the expression tree being evaluated.
      * @param index The index object that will be placed inside the string to set the value.
diff --git a/src/main/java/org/apache/commons/ognl/SimpleNode.java b/src/main/java/org/apache/commons/ognl/SimpleNode.java
index 8247731..97f4d19 100644
--- a/src/main/java/org/apache/commons/ognl/SimpleNode.java
+++ b/src/main/java/org/apache/commons/ognl/SimpleNode.java
@@ -243,17 +243,11 @@
             {
                 result = evaluateGetValueBody( context, source );
             }
-            catch ( OgnlException ex )
+            catch ( OgnlException | RuntimeException ex )
             {
                 evalException = ex;
                 throw ex;
-            }
-            catch ( RuntimeException ex )
-            {
-                evalException = ex;
-                throw ex;
-            }
-            finally
+            } finally
             {
                 Evaluation eval = context.popEvaluation();
 
diff --git a/src/main/java/org/apache/commons/ognl/enhance/ExpressionAccessor.java b/src/main/java/org/apache/commons/ognl/enhance/ExpressionAccessor.java
index 99092f7..7b51efc 100644
--- a/src/main/java/org/apache/commons/ognl/enhance/ExpressionAccessor.java
+++ b/src/main/java/org/apache/commons/ognl/enhance/ExpressionAccessor.java
@@ -32,7 +32,7 @@
 
     /**
      * Gets the value represented by this expression path, if any.
-     * 
+     *
      * @param context The standard ognl context used for variable substitution/etc.
      * @param target The root object this expression is meant for.
      * @return The evaluated value, if any.
@@ -41,7 +41,7 @@
 
     /**
      * Sets the value represented by this expression path, if possible.
-     * 
+     *
      * @param context The standard ognl context used for variable substitution/etc.
      * @param target The root object this expression is meant for.
      * @param value The new value to set if this expression references a settable property.
@@ -51,7 +51,7 @@
     /**
      * Used to set the original root expression node on instances where the compiled version has to fall back to
      * interpreted syntax because of compilation failures.
-     * 
+     *
      * @param expression The root expression node used to generate this accessor.
      */
     void setExpression( Node expression );
diff --git a/src/main/java/org/apache/commons/ognl/enhance/ExpressionCompiler.java b/src/main/java/org/apache/commons/ognl/enhance/ExpressionCompiler.java
index 1e1d7f2..628af40 100644
--- a/src/main/java/org/apache/commons/ognl/enhance/ExpressionCompiler.java
+++ b/src/main/java/org/apache/commons/ognl/enhance/ExpressionCompiler.java
@@ -88,7 +88,7 @@
      * store the cast java source string in to the current {@link org.apache.commons.ognl.OgnlContext}. This will either
      * add to the existing string present if it already exists or create a new instance and store it using the static
      * key of {@link #PRE_CAST}.
-     * 
+     *
      * @param context The current execution context.
      * @param cast The java source string to store in to the context.
      */
@@ -114,7 +114,7 @@
      * For instance, if given an {@link Integer} object the string <code>"java.lang.Integer"</code> would be returned.
      * For an array of primitive ints <code>"int[]"</code> and so on..
      * </p>
-     * 
+     *
      * @param type The class to cast a string expression for.
      * @return The converted raw string version of the class name.
      */
@@ -132,7 +132,7 @@
      * Convenience method called by many different property/method resolving AST types to get a root expression
      * resolving string for the given node. The callers are mostly ignorant and rely on this method to properly
      * determine if the expression should be cast at all and take the appropriate actions if it should.
-     * 
+     *
      * @param expression The node to check and generate a root expression to if necessary.
      * @param root The root object for this execution.
      * @param context The current execution context.
@@ -148,27 +148,26 @@
             return rootExpr;
         }
 
-        if ( ( !ASTList.class.isInstance( expression ) && !ASTVarRef.class.isInstance( expression )
-            && !ASTStaticMethod.class.isInstance( expression ) && !ASTStaticField.class.isInstance( expression )
-            && !ASTConst.class.isInstance( expression ) && !ExpressionNode.class.isInstance( expression )
-            && !ASTCtor.class.isInstance( expression ) && !ASTStaticMethod.class.isInstance( expression )
-            && root != null ) || ( root != null && ASTRootVarRef.class.isInstance( expression ) ) )
+        if ( ( !(expression instanceof ASTList) && !(expression instanceof ASTVarRef)
+            && !(expression instanceof ASTStaticMethod) && !(expression instanceof ASTStaticField)
+            && !(expression instanceof ASTConst) && !(expression instanceof ExpressionNode)
+            && !(expression instanceof ASTCtor) && !(expression instanceof ASTStaticMethod)
+            && root != null ) || ( root != null && expression instanceof ASTRootVarRef) )
         {
 
             Class<?> castClass = OgnlRuntime.getCompiler( context ).getRootExpressionClass( expression, context );
 
-            if ( castClass.isArray() || ASTRootVarRef.class.isInstance( expression ) || ASTThisVarRef.class.isInstance(
-                expression ) )
+            if ( castClass.isArray() || expression instanceof ASTRootVarRef || expression instanceof ASTThisVarRef)
             {
                 rootExpr = "((" + getCastString( castClass ) + ")$2)";
 
-                if ( ASTProperty.class.isInstance( expression ) && !( (ASTProperty) expression ).isIndexedAccess() )
+                if ( expression instanceof ASTProperty && !( (ASTProperty) expression ).isIndexedAccess() )
                 {
                     rootExpr += ".";
                 }
             }
-            else if ( ( ASTProperty.class.isInstance( expression ) && ( (ASTProperty) expression ).isIndexedAccess() )
-                || ASTChain.class.isInstance( expression ) )
+            else if ( ( expression instanceof ASTProperty && ( (ASTProperty) expression ).isIndexedAccess() )
+                || expression instanceof ASTChain)
             {
                 rootExpr = "((" + getCastString( castClass ) + ")$2)";
             }
@@ -190,18 +189,18 @@
      */
     public static boolean shouldCast( Node expression )
     {
-        if ( ASTChain.class.isInstance( expression ) )
+        if (expression instanceof ASTChain)
         {
             Node child = expression.jjtGetChild( 0 );
-            if ( ASTConst.class.isInstance( child ) || ASTStaticMethod.class.isInstance( child )
-                || ASTStaticField.class.isInstance( child ) || ( ASTVarRef.class.isInstance( child )
-                && !ASTRootVarRef.class.isInstance( child ) ) )
+            if ( child instanceof ASTConst || child instanceof ASTStaticMethod
+                || child instanceof ASTStaticField || ( child instanceof ASTVarRef
+                && !(child instanceof ASTRootVarRef)) )
             {
                 return false;
             }
         }
 
-        return !ASTConst.class.isInstance( expression );
+        return !(expression instanceof ASTConst);
     }
 
     /**
@@ -218,11 +217,11 @@
                 && context.getCurrentAccessor().isAssignableFrom( context.getPreviousType() ) ) || body == null
             || body.trim().length() < 1 || ( context.getCurrentType() != null && context.getCurrentType().isArray() && (
             context.getPreviousType() == null || context.getPreviousType() != Object.class ) )
-            || ASTOr.class.isInstance( expression ) || ASTAnd.class.isInstance( expression )
-            || ASTRootVarRef.class.isInstance( expression ) || context.getCurrentAccessor() == Class.class || (
+            || expression instanceof ASTOr || expression instanceof ASTAnd
+            || expression instanceof ASTRootVarRef || context.getCurrentAccessor() == Class.class || (
             context.get( ExpressionCompiler.PRE_CAST ) != null && ( (String) context.get(
-                ExpressionCompiler.PRE_CAST ) ).startsWith( "new" ) ) || ASTStaticField.class.isInstance( expression )
-            || ASTStaticMethod.class.isInstance( expression ) || ( OrderedReturn.class.isInstance( expression )
+                ExpressionCompiler.PRE_CAST ) ).startsWith( "new" ) ) || expression instanceof ASTStaticField
+            || expression instanceof ASTStaticMethod || ( expression instanceof OrderedReturn
             && ( (OrderedReturn) expression ).getLastExpression() != null ) )
         {
             return body;
@@ -265,7 +264,7 @@
             {
                 return intface.getName();
             }
-            else if ( intface.getName().indexOf( "Iterator" ) > 0 )
+            if ( intface.getName().indexOf( "Iterator" ) > 0 )
             {
                 return intface.getName();
             }
@@ -326,7 +325,7 @@
     /**
      * Helper utility method used by compiler to help resolve class->method mappings during method calls to
      * {@link OgnlExpressionCompiler#getSuperOrInterfaceClass(java.lang.reflect.Method, Class)}.
-     * 
+     *
      * @param m The method to check for existance of.
      * @param clazz The class to check for the existance of a matching method definition to the method passed in.
      * @return True if the class contains the specified method, false otherwise.
@@ -428,19 +427,19 @@
             {
                 return List.class;
             }
-            else if ( Iterator.class.isAssignableFrom( anIntf ) )
+            if ( Iterator.class.isAssignableFrom( anIntf ) )
             {
                 return Iterator.class;
             }
-            else if ( Map.class.isAssignableFrom( anIntf ) )
+            if ( Map.class.isAssignableFrom( anIntf ) )
             {
                 return Map.class;
             }
-            else if ( Set.class.isAssignableFrom( anIntf ) )
+            if ( Set.class.isAssignableFrom( anIntf ) )
             {
                 return Set.class;
             }
-            else if ( Collection.class.isAssignableFrom( anIntf ) )
+            if ( Collection.class.isAssignableFrom( anIntf ) )
             {
                 return Collection.class;
             }
@@ -619,10 +618,10 @@
 
         createLocalReferences( context, classPool, newClass, objClass, valueGetter.getParameterTypes() );
 
-        if ( OrderedReturn.class.isInstance( expression )
+        if ( expression instanceof OrderedReturn
             && ( (OrderedReturn) expression ).getLastExpression() != null )
         {
-            body = "{ " + ( ASTMethod.class.isInstance( expression ) || ASTChain.class.isInstance( expression )
+            body = "{ " + ( expression instanceof ASTMethod || expression instanceof ASTChain
                 ? rootExpr
                 : "" ) + ( castExpression != null ? castExpression : "" )
                 + ( (OrderedReturn) expression ).getCoreExpression() + " return " + pre
@@ -697,7 +696,7 @@
                                      CtMethod valueSetter, Node expression, Object root )
         throws Exception
     {
-        if ( ExpressionNode.class.isInstance( expression ) || ASTConst.class.isInstance( expression ) )
+        if ( expression instanceof ExpressionNode || expression instanceof ASTConst)
         {
             throw new UnsupportedCompilationException( "Can't compile expression/constant setters." );
         }
@@ -744,7 +743,7 @@
 
     /**
      * Fail safe getter creation when normal compilation fails.
-     * 
+     *
      * @param clazz The javassist class the new method should be attached to.
      * @param valueGetter The method definition the generated code will be contained within.
      * @param node The root expression node.
@@ -765,7 +764,7 @@
 
     /**
      * Fail safe setter creation when normal compilation fails.
-     * 
+     *
      * @param clazz The javassist class the new method should be attached to.
      * @param valueSetter The method definition the generated code will be contained within.
      * @param node The root expression node.
@@ -787,7 +786,7 @@
     /**
      * Creates a {@link ClassLoader} instance compatible with the javassist classloader and normal OGNL class resolving
      * semantics.
-     * 
+     *
      * @param context The current execution context.
      * @return The created {@link ClassLoader} instance.
      */
@@ -810,7 +809,7 @@
 
     /**
      * Loads a new class definition via javassist for the specified class.
-     * 
+     *
      * @param searchClass The class to load.
      * @return The javassist class equivalent.
      * @throws javassist.NotFoundException When the class definition can't be found.
@@ -825,7 +824,7 @@
      * Gets either a new or existing {@link ClassPool} for use in compiling javassist classes. A new class path object
      * is inserted in to the returned {@link ClassPool} using the passed in <code>loader</code> instance if a new pool
      * needs to be created.
-     * 
+     *
      * @param context The current execution context.
      * @param loader The {@link ClassLoader} instance to use - as returned by
      *            {@link #getClassLoader(org.apache.commons.ognl.OgnlContext)}.
diff --git a/src/main/java/org/apache/commons/ognl/enhance/LocalReference.java b/src/main/java/org/apache/commons/ognl/enhance/LocalReference.java
index 5b8173b..57a9be3 100644
--- a/src/main/java/org/apache/commons/ognl/enhance/LocalReference.java
+++ b/src/main/java/org/apache/commons/ognl/enhance/LocalReference.java
@@ -27,21 +27,21 @@
 
     /**
      * The name of the assigned variable reference.
-     * 
+     *
      * @return The name of the reference as it will be when compiled.
      */
     String getName();
 
     /**
      * The expression that sets the value, ie the part after <code><class type> refName = <expression></code>.
-     * 
+     *
      * @return The setting expression.
      */
     String getExpression();
 
     /**
      * The type of reference.
-     * 
+     *
      * @return The type.
      */
     Class<?> getType();
diff --git a/src/main/java/org/apache/commons/ognl/enhance/OgnlExpressionCompiler.java b/src/main/java/org/apache/commons/ognl/enhance/OgnlExpressionCompiler.java
index e9a713a..3ef9255 100644
--- a/src/main/java/org/apache/commons/ognl/enhance/OgnlExpressionCompiler.java
+++ b/src/main/java/org/apache/commons/ognl/enhance/OgnlExpressionCompiler.java
@@ -39,7 +39,7 @@
      * thrown by the method or the statement wasn't compilable in this instance because of missing/null objects in the
      * expression. These instances may in some cases continue to call this compilation method until the expression is
      * resolvable.
-     * 
+     *
      * @param context The context of execution.
      * @param expression The pre-parsed root expression node to compile.
      * @param root The root object for the expression - may be null in many instances so some implementations may exit
@@ -52,7 +52,7 @@
     /**
      * Gets a javassist safe class string for the given class instance. This is especially useful for handling array vs.
      * normal class casting strings.
-     * 
+     *
      * @param clazz The class to get a string equivalent javassist compatible string reference for.
      * @return The string equivalent of the class.
      */
@@ -63,7 +63,7 @@
      * possible because the method isn't known for a class. Attempts to upcast the given class to the next available
      * non-private accessible class so that compiled expressions can reference the interface class of an instance so as
      * not to be compiled in to overly specific statements.
-     * 
+     *
      * @param clazz The class to attempt to find a compatible interface for.
      * @return The same class if no higher level interface could be matched against or the interface equivalent class.
      */
@@ -71,7 +71,7 @@
 
     /**
      * For the given {@link Method} and class finds the highest level interface class this combination can be cast to.
-     * 
+     *
      * @param m The method the class must implement.
      * @param clazz The current class being worked with.
      * @return The highest level interface / class that the referenced {@link Method} is declared in.
@@ -82,7 +82,7 @@
      * For a given root object type returns the base class type to be used in root referenced expressions. This helps in
      * some instances where the root objects themselves are compiled javassist instances that need more generic class
      * equivalents to cast to.
-     * 
+     *
      * @param rootNode The root expression node.
      * @param context The current execution context.
      * @return The root expression class type to cast to for this node.
@@ -97,7 +97,7 @@
      * {@link org.apache.commons.ognl.OgnlContext#getCurrentAccessor()} methods to inspect the type stack and properly
      * cast to the right classes - but only when necessary.
      * </p>
-     * 
+     *
      * @param context The current execution context.
      * @param expression The node being checked for casting.
      * @param body The java source string generated by the given node.
@@ -114,7 +114,7 @@
      * sufficiently complicated sub expression blocks can be broken out in to distinct methods to be referenced by the
      * core accessor / setter methods in the base compiled root object.
      * </p>
-     * 
+     *
      * @param context The current execution context.
      * @param expression The java source expression to dump in to a seperate method reference.
      * @param type The return type that should be specified for the new method.
diff --git a/src/main/java/org/apache/commons/ognl/enhance/OrderedReturn.java b/src/main/java/org/apache/commons/ognl/enhance/OrderedReturn.java
index b03e8c0..70ee790 100644
--- a/src/main/java/org/apache/commons/ognl/enhance/OrderedReturn.java
+++ b/src/main/java/org/apache/commons/ognl/enhance/OrderedReturn.java
@@ -30,14 +30,14 @@
 
     /**
      * Get the core expression to execute first before any return foo logic is started.
-     * 
+     *
      * @return The core standalone expression that shouldn't be pre-pended with a return keyword.
      */
     String getCoreExpression();
 
     /**
      * Gets the last expression to be pre-pended with a return &lt;expression&gt; block.
-     * 
+     *
      * @return The expression representing the return portion of a statement;
      */
     String getLastExpression();
diff --git a/src/main/java/org/apache/commons/ognl/enhance/UnsupportedCompilationException.java b/src/main/java/org/apache/commons/ognl/enhance/UnsupportedCompilationException.java
index f780390..24f9a72 100644
--- a/src/main/java/org/apache/commons/ognl/enhance/UnsupportedCompilationException.java
+++ b/src/main/java/org/apache/commons/ognl/enhance/UnsupportedCompilationException.java
@@ -31,7 +31,7 @@
 {
 
     /**
-     * 
+     *
      */
     private static final long serialVersionUID = 4961625077128174947L;
 
diff --git a/src/main/java/org/apache/commons/ognl/internal/ClassCacheHandler.java b/src/main/java/org/apache/commons/ognl/internal/ClassCacheHandler.java
index f3a29c3..bde12ce 100644
--- a/src/main/java/org/apache/commons/ognl/internal/ClassCacheHandler.java
+++ b/src/main/java/org/apache/commons/ognl/internal/ClassCacheHandler.java
@@ -53,29 +53,25 @@
                     for ( Class<?> clazz = forClass; clazz != null; clazz = clazz.getSuperclass() )
                     {
                         answer = handlers.get( clazz );
-                        if ( answer == null )
-                        {
-                            Class<?>[] interfaces = clazz.getInterfaces();
-                            for ( Class<?> iface : interfaces )
-                            {
-                                answer = handlers.get( iface );
-                                if ( answer == null )
-                                {
-                                    /* Try super-interfaces */
-                                    answer = getHandler( iface, handlers );
-                                }
-                                if ( answer != null )
-                                {
-                                    keyFound = iface;
-                                    break outer;
-                                }
-                            }
-                        }
-                        else
-                        {
+                        if ( answer != null ) {
                             keyFound = clazz;
                             break;
                         }
+                        Class<?>[] interfaces = clazz.getInterfaces();
+                        for ( Class<?> iface : interfaces )
+                        {
+                            answer = handlers.get( iface );
+                            if ( answer == null )
+                            {
+                                /* Try super-interfaces */
+                                answer = getHandler( iface, handlers );
+                            }
+                            if ( answer != null )
+                            {
+                                keyFound = iface;
+                                break outer;
+                            }
+                        }
                     }
                 }
                 if ( answer != null  && keyFound != forClass )
diff --git a/src/main/java/org/apache/commons/ognl/internal/ClassCacheImpl.java b/src/main/java/org/apache/commons/ognl/internal/ClassCacheImpl.java
index 755ac13..dfff584 100644
--- a/src/main/java/org/apache/commons/ognl/internal/ClassCacheImpl.java
+++ b/src/main/java/org/apache/commons/ognl/internal/ClassCacheImpl.java
@@ -59,10 +59,7 @@
      */
     public void clear()
     {
-        for ( int i = 0; i < table.length; i++ )
-        {
-            table[i] = null;
-        }
+        Arrays.fill(table, null);
 
         size = 0;
     }
diff --git a/src/main/java/org/apache/commons/ognl/internal/ConcurrentHashMapCache.java b/src/main/java/org/apache/commons/ognl/internal/ConcurrentHashMapCache.java
index e4a5793..84a98a6 100644
--- a/src/main/java/org/apache/commons/ognl/internal/ConcurrentHashMapCache.java
+++ b/src/main/java/org/apache/commons/ognl/internal/ConcurrentHashMapCache.java
@@ -3,19 +3,19 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information       
- * regarding copyright ownership.  The ASF licenses this file  
- * to you under the Apache License, Version 2.0 (the           
- * "License"); you may not use this file except in compliance  
- * with the License.  You may obtain a copy of the License at  
- *                                                             
- *   http://www.apache.org/licenses/LICENSE-2.0                
- *                                                             
- * Unless required by applicable law or agreed to in writing,  
- * software distributed under the License is distributed on an 
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY      
- * KIND, either express or implied.  See the License for the   
- * specific language governing permissions and limitations     
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
  * under the License.
  */
 
diff --git a/src/main/java/org/apache/commons/ognl/internal/ConcurrentHashMapCacheFactory.java b/src/main/java/org/apache/commons/ognl/internal/ConcurrentHashMapCacheFactory.java
index 255fd84..a9d26ee 100644
--- a/src/main/java/org/apache/commons/ognl/internal/ConcurrentHashMapCacheFactory.java
+++ b/src/main/java/org/apache/commons/ognl/internal/ConcurrentHashMapCacheFactory.java
@@ -3,19 +3,19 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information       
- * regarding copyright ownership.  The ASF licenses this file  
- * to you under the Apache License, Version 2.0 (the           
- * "License"); you may not use this file except in compliance  
- * with the License.  You may obtain a copy of the License at  
- *                                                             
- *   http://www.apache.org/licenses/LICENSE-2.0                
- *                                                             
- * Unless required by applicable law or agreed to in writing,  
- * software distributed under the License is distributed on an 
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY      
- * KIND, either express or implied.  See the License for the   
- * specific language governing permissions and limitations     
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
  * under the License.
  */
 
diff --git a/src/main/java/org/apache/commons/ognl/internal/HashMapCache.java b/src/main/java/org/apache/commons/ognl/internal/HashMapCache.java
index 8fe631a..d69c7ab 100644
--- a/src/main/java/org/apache/commons/ognl/internal/HashMapCache.java
+++ b/src/main/java/org/apache/commons/ognl/internal/HashMapCache.java
@@ -3,19 +3,19 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information       
- * regarding copyright ownership.  The ASF licenses this file  
- * to you under the Apache License, Version 2.0 (the           
- * "License"); you may not use this file except in compliance  
- * with the License.  You may obtain a copy of the License at  
- *                                                             
- *   http://www.apache.org/licenses/LICENSE-2.0                
- *                                                             
- * Unless required by applicable law or agreed to in writing,  
- * software distributed under the License is distributed on an 
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY      
- * KIND, either express or implied.  See the License for the   
- * specific language governing permissions and limitations     
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
  * under the License.
  */
 
diff --git a/src/main/java/org/apache/commons/ognl/internal/HashMapClassCache.java b/src/main/java/org/apache/commons/ognl/internal/HashMapClassCache.java
index 30974c4..fe28b26 100644
--- a/src/main/java/org/apache/commons/ognl/internal/HashMapClassCache.java
+++ b/src/main/java/org/apache/commons/ognl/internal/HashMapClassCache.java
@@ -3,19 +3,19 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information       
- * regarding copyright ownership.  The ASF licenses this file  
- * to you under the Apache License, Version 2.0 (the           
- * "License"); you may not use this file except in compliance  
- * with the License.  You may obtain a copy of the License at  
- *                                                             
- *   http://www.apache.org/licenses/LICENSE-2.0                
- *                                                             
- * Unless required by applicable law or agreed to in writing,  
- * software distributed under the License is distributed on an 
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY      
- * KIND, either express or implied.  See the License for the   
- * specific language governing permissions and limitations     
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
  * under the License.
  */
 
diff --git a/src/main/java/org/apache/commons/ognl/internal/ReentrantReadWriteLockClassCache.java b/src/main/java/org/apache/commons/ognl/internal/ReentrantReadWriteLockClassCache.java
index c7640a6..81209d9 100644
--- a/src/main/java/org/apache/commons/ognl/internal/ReentrantReadWriteLockClassCache.java
+++ b/src/main/java/org/apache/commons/ognl/internal/ReentrantReadWriteLockClassCache.java
@@ -3,19 +3,19 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information       
- * regarding copyright ownership.  The ASF licenses this file  
- * to you under the Apache License, Version 2.0 (the           
- * "License"); you may not use this file except in compliance  
- * with the License.  You may obtain a copy of the License at  
- *                                                             
- *   http://www.apache.org/licenses/LICENSE-2.0                
- *                                                             
- * Unless required by applicable law or agreed to in writing,  
- * software distributed under the License is distributed on an 
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY      
- * KIND, either express or implied.  See the License for the   
- * specific language governing permissions and limitations     
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
  * under the License.
  */
 
diff --git a/src/main/java/org/apache/commons/ognl/internal/entry/DeclaredMethodCacheEntryFactory.java b/src/main/java/org/apache/commons/ognl/internal/entry/DeclaredMethodCacheEntryFactory.java
index 3fd4292..989e10b 100644
--- a/src/main/java/org/apache/commons/ognl/internal/entry/DeclaredMethodCacheEntryFactory.java
+++ b/src/main/java/org/apache/commons/ognl/internal/entry/DeclaredMethodCacheEntryFactory.java
@@ -3,19 +3,19 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information       
- * regarding copyright ownership.  The ASF licenses this file  
- * to you under the Apache License, Version 2.0 (the           
- * "License"); you may not use this file except in compliance  
- * with the License.  You may obtain a copy of the License at  
- *                                                             
- *   http://www.apache.org/licenses/LICENSE-2.0                
- *                                                             
- * Unless required by applicable law or agreed to in writing,  
- * software distributed under the License is distributed on an 
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY      
- * KIND, either express or implied.  See the License for the   
- * specific language governing permissions and limitations     
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
  * under the License.
  */
 
@@ -41,18 +41,12 @@
         {
             return true;
         }
-        else
+        boolean isStatic = Modifier.isStatic( method.getModifiers() );
+        if ( key.type == DeclaredMethodCacheEntry.MethodType.STATIC )
         {
-            boolean isStatic = Modifier.isStatic( method.getModifiers() );
-            if ( key.type == DeclaredMethodCacheEntry.MethodType.STATIC )
-            {
-                return isStatic;
-            }
-            else
-            {
-                return !isStatic;
-            }
+            return isStatic;
         }
+        return !isStatic;
 
     }
 }
diff --git a/src/main/java/org/apache/commons/ognl/internal/entry/GenericMethodParameterTypeCacheEntry.java b/src/main/java/org/apache/commons/ognl/internal/entry/GenericMethodParameterTypeCacheEntry.java
index b3c4ca7..7e7d424 100644
--- a/src/main/java/org/apache/commons/ognl/internal/entry/GenericMethodParameterTypeCacheEntry.java
+++ b/src/main/java/org/apache/commons/ognl/internal/entry/GenericMethodParameterTypeCacheEntry.java
@@ -28,9 +28,9 @@
 public class GenericMethodParameterTypeCacheEntry
     implements CacheEntry
 {
-    Method method;
+    final Method method;
 
-    Class<?> type;
+    final Class<?> type;
 
     public GenericMethodParameterTypeCacheEntry( Method method, Class<?> type )
     {
diff --git a/src/main/java/org/apache/commons/ognl/internal/entry/GenericMethodParameterTypeFactory.java b/src/main/java/org/apache/commons/ognl/internal/entry/GenericMethodParameterTypeFactory.java
index 2e6e5d8..55af62b 100644
--- a/src/main/java/org/apache/commons/ognl/internal/entry/GenericMethodParameterTypeFactory.java
+++ b/src/main/java/org/apache/commons/ognl/internal/entry/GenericMethodParameterTypeFactory.java
@@ -49,20 +49,20 @@
         {
             TypeVariable<?> paramType = null;
 
-            if ( TypeVariable.class.isInstance( genTypes[i] ) )
+            if (genTypes[i] instanceof TypeVariable)
             {
                 paramType = (TypeVariable<?>) genTypes[i];
             }
-            else if ( GenericArrayType.class.isInstance( genTypes[i] ) )
+            else if (genTypes[i] instanceof GenericArrayType)
             {
                 paramType = (TypeVariable<?>) ( (GenericArrayType) genTypes[i] ).getGenericComponentType();
             }
-            else if ( ParameterizedType.class.isInstance( genTypes[i] ) )
+            else if (genTypes[i] instanceof ParameterizedType)
             {
                 types[i] = (Class<?>) ( (ParameterizedType) genTypes[i] ).getRawType();
                 continue;
             }
-            else if ( Class.class.isInstance( genTypes[i] ) )
+            else if (genTypes[i] instanceof Class)
             {
                 types[i] = (Class<?>) genTypes[i];
                 continue;
@@ -72,7 +72,7 @@
 
             if ( resolved != null )
             {
-                if ( GenericArrayType.class.isInstance( genTypes[i] ) )
+                if (genTypes[i] instanceof GenericArrayType)
                 {
                     resolved = Array.newInstance( resolved, 0 ).getClass();
                 }
@@ -95,7 +95,7 @@
 
         for ( int i = 0; i < declaredTypes.length; i++ )
         {
-            if ( !TypeVariable.class.isInstance( param.getActualTypeArguments()[i] )
+            if ( !(param.getActualTypeArguments()[i] instanceof TypeVariable)
                 && declaredTypes[i].getName().equals( var.getName() ) )
             {
                 return (Class<?>) param.getActualTypeArguments()[i];
diff --git a/src/main/java/org/apache/commons/ognl/internal/entry/MethodAccessCacheEntryFactory.java b/src/main/java/org/apache/commons/ognl/internal/entry/MethodAccessCacheEntryFactory.java
index 5155458..181ae8b 100644
--- a/src/main/java/org/apache/commons/ognl/internal/entry/MethodAccessCacheEntryFactory.java
+++ b/src/main/java/org/apache/commons/ognl/internal/entry/MethodAccessCacheEntryFactory.java
@@ -44,20 +44,13 @@
     {
         final boolean notPublic = !Modifier.isPublic( method.getModifiers() ) || !Modifier.isPublic(
             method.getDeclaringClass().getModifiers() );
-        if ( notPublic )
-        {
-            if ( !method.isAccessible() )
-            {
-                return INACCESSIBLE_NON_PUBLIC_METHOD;
-            }
-            else
-            {
-                return ACCESSIBLE_NON_PUBLIC_METHOD;
-            }
-        }
-        else
-        {
+        if ( !notPublic ) {
             return PUBLIC_METHOD;
         }
+        if ( !method.isAccessible() )
+        {
+            return INACCESSIBLE_NON_PUBLIC_METHOD;
+        }
+        return ACCESSIBLE_NON_PUBLIC_METHOD;
     }
 }
diff --git a/src/main/java/org/apache/commons/ognl/internal/entry/MethodCacheEntry.java b/src/main/java/org/apache/commons/ognl/internal/entry/MethodCacheEntry.java
index cfb126a..cccaf78 100644
--- a/src/main/java/org/apache/commons/ognl/internal/entry/MethodCacheEntry.java
+++ b/src/main/java/org/apache/commons/ognl/internal/entry/MethodCacheEntry.java
@@ -26,7 +26,7 @@
 public class MethodCacheEntry
     implements CacheEntry
 {
-    public Class<?> targetClass;
+    public final Class<?> targetClass;
 
     public MethodCacheEntry( Class<?> targetClass )
     {
diff --git a/src/main/java/org/apache/commons/ognl/internal/entry/MethodCacheEntryFactory.java b/src/main/java/org/apache/commons/ognl/internal/entry/MethodCacheEntryFactory.java
index 58c82cb..95b0f72 100644
--- a/src/main/java/org/apache/commons/ognl/internal/entry/MethodCacheEntryFactory.java
+++ b/src/main/java/org/apache/commons/ognl/internal/entry/MethodCacheEntryFactory.java
@@ -55,13 +55,7 @@
 
                 if ( shouldCache( key, method ) )
                 {
-                    List<Method> ml = result.get( method.getName() );
-
-                    if ( ml == null )
-                    {
-                        ml = new ArrayList<Method>();
-                        result.put( method.getName(), ml );
-                    }
+                    List<Method> ml = result.computeIfAbsent(method.getName(), k -> new ArrayList<Method>());
 
                     ml.add( method );
                 }
diff --git a/src/main/java/org/apache/commons/ognl/internal/entry/PermissionCacheEntry.java b/src/main/java/org/apache/commons/ognl/internal/entry/PermissionCacheEntry.java
index 52405dd..68c0890 100644
--- a/src/main/java/org/apache/commons/ognl/internal/entry/PermissionCacheEntry.java
+++ b/src/main/java/org/apache/commons/ognl/internal/entry/PermissionCacheEntry.java
@@ -28,7 +28,7 @@
 public class PermissionCacheEntry
     implements CacheEntry
 {
-    public Method method;
+    public final Method method;
 
     public PermissionCacheEntry( Method method )
     {
diff --git a/src/main/java/org/apache/commons/ognl/internal/entry/PropertyDescriptorCacheEntryFactory.java b/src/main/java/org/apache/commons/ognl/internal/entry/PropertyDescriptorCacheEntryFactory.java
index 3c8616c..67e5a03 100644
--- a/src/main/java/org/apache/commons/ognl/internal/entry/PropertyDescriptorCacheEntryFactory.java
+++ b/src/main/java/org/apache/commons/ognl/internal/entry/PropertyDescriptorCacheEntryFactory.java
@@ -67,11 +67,7 @@
 
             findObjectIndexedPropertyDescriptors( targetClass, result );
         }
-        catch ( IntrospectionException e )
-        {
-            throw new CacheException( e );
-        }
-        catch ( OgnlException e )
+        catch ( IntrospectionException | OgnlException e )
         {
             throw new CacheException( e );
         }
@@ -127,22 +123,14 @@
 
                     if ( isGet && ( parameterCount == 1 ) && ( method.getReturnType() != Void.TYPE ) )
                     {
-                        List<Method> pair = pairs.get( propertyName );
+                        List<Method> pair = pairs.computeIfAbsent(propertyName, k -> new ArrayList<Method>());
 
-                        if ( pair == null )
-                        {
-                            pairs.put( propertyName, pair = new ArrayList<Method>() );
-                        }
                         pair.add( method );
                     }
                     if ( isSet && ( parameterCount == 2 ) && ( method.getReturnType() == Void.TYPE ) )
                     {
-                        List<Method> pair = pairs.get( propertyName );
+                        List<Method> pair = pairs.computeIfAbsent(propertyName, k -> new ArrayList<Method>());
 
-                        if ( pair == null )
-                        {
-                            pairs.put( propertyName, pair = new ArrayList<Method>() );
-                        }
                         pair.add( method );
                     }
                 }
diff --git a/src/test/java/org/apache/commons/ognl/TestOgnlRuntime.java b/src/test/java/org/apache/commons/ognl/TestOgnlRuntime.java
index 3ad0f6a..677ea2c 100644
--- a/src/test/java/org/apache/commons/ognl/TestOgnlRuntime.java
+++ b/src/test/java/org/apache/commons/ognl/TestOgnlRuntime.java
@@ -205,7 +205,7 @@
         SetterReturns root = new SetterReturns();
 
         Method m = OgnlRuntime.getWriteMethod( root.getClass(), "value" );
-        assertTrue( m != null );
+        assertNotNull(m);
 
         Ognl.setValue( "value", context, root, "12__" );
         assertEquals( Ognl.getValue( "value", context, root ), "12__" );
diff --git a/src/test/java/org/apache/commons/ognl/internal/ConcurrentHashMapCacheTest.java b/src/test/java/org/apache/commons/ognl/internal/ConcurrentHashMapCacheTest.java
index 9614c34..a7861d1 100644
--- a/src/test/java/org/apache/commons/ognl/internal/ConcurrentHashMapCacheTest.java
+++ b/src/test/java/org/apache/commons/ognl/internal/ConcurrentHashMapCacheTest.java
@@ -89,7 +89,7 @@
             for ( Method method : methods )
             {
                 String name = method.getName( );
-                boolean isGet = name.substring( 3, name.length( ) ).equalsIgnoreCase( key.getMethodName( ) );
+                boolean isGet = name.substring( 3 ).equalsIgnoreCase( key.getMethodName( ) );
                 if ( isGet )
                 {
                     list.add( method );
diff --git a/src/test/java/org/apache/commons/ognl/test/ASTPropertyTest.java b/src/test/java/org/apache/commons/ognl/test/ASTPropertyTest.java
index 76c8b63..bdc8feb 100644
--- a/src/test/java/org/apache/commons/ognl/test/ASTPropertyTest.java
+++ b/src/test/java/org/apache/commons/ognl/test/ASTPropertyTest.java
@@ -63,18 +63,18 @@
         context.setCurrentNode( pRef );
 
         assertEquals( root.getClass(), context.getCurrentType() );
-        assertEquals( null, context.getPreviousType() );
+        assertNull(context.getPreviousType());
         assertEquals( root, context.getCurrentObject() );
-        assertEquals( null, context.getCurrentAccessor() );
-        assertEquals( null, context.getPreviousAccessor() );
+        assertNull(context.getCurrentAccessor());
+        assertNull(context.getPreviousAccessor());
 
         int type = p.getIndexedPropertyType( context, root );
 
         assertEquals( OgnlRuntime.INDEXED_PROPERTY_NONE, type );
         assertEquals( root.getClass(), context.getCurrentType() );
-        assertEquals( null, context.getPreviousType() );
-        assertEquals( null, context.getCurrentAccessor() );
-        assertEquals( null, context.getPreviousAccessor() );
+        assertNull(context.getPreviousType());
+        assertNull(context.getCurrentAccessor());
+        assertNull(context.getPreviousAccessor());
     }
 
     public void test_Get_Value_Body()
@@ -95,18 +95,18 @@
         context.setCurrentNode( pRef );
 
         assertEquals( root.getClass(), context.getCurrentType() );
-        assertEquals( null, context.getPreviousType() );
+        assertNull(context.getPreviousType());
         assertEquals( root, context.getCurrentObject() );
-        assertEquals( null, context.getCurrentAccessor() );
-        assertEquals( null, context.getPreviousAccessor() );
+        assertNull(context.getCurrentAccessor());
+        assertNull(context.getPreviousAccessor());
 
         Object value = p.getValue( context, root );
 
         assertEquals( root.get( "nested" ), value );
         assertEquals( root.getClass(), context.getCurrentType() );
-        assertEquals( null, context.getPreviousType() );
-        assertEquals( null, context.getCurrentAccessor() );
-        assertEquals( null, context.getPreviousAccessor() );
+        assertNull(context.getPreviousType());
+        assertNull(context.getCurrentAccessor());
+        assertNull(context.getPreviousAccessor());
     }
 
     public void test_Get_Source()
@@ -130,14 +130,14 @@
         assertEquals( Object.class, context.getCurrentType() );
         assertEquals( Map.class, context.getCurrentAccessor() );
         assertEquals( root.getClass(), context.getPreviousType() );
-        assertEquals( null, context.getPreviousAccessor() );
+        assertNull(context.getPreviousAccessor());
 
         assertEquals( root.get( "nested" ), context.getCurrentObject() );
 
         assert Map.class.isAssignableFrom( context.getCurrentAccessor() );
 
         assertEquals( root.getClass(), context.getPreviousType() );
-        assertEquals( null, context.getPreviousAccessor() );
+        assertNull(context.getPreviousAccessor());
     }
 
     public void test_Set_Source()
@@ -164,7 +164,7 @@
         assert Map.class.isAssignableFrom( context.getCurrentAccessor() );
 
         assertEquals( root.getClass(), context.getPreviousType() );
-        assertEquals( null, context.getPreviousAccessor() );
+        assertNull(context.getPreviousAccessor());
     }
 
     public void test_Indexed_Object_Type()
@@ -206,7 +206,7 @@
         assertEquals( ".getList()", listp.toGetSourceString( context, root ) );
         assertEquals( List.class, context.getCurrentType() );
         assertEquals( Root.class, context.getCurrentAccessor() );
-        assertEquals( null, context.getPreviousAccessor() );
+        assertNull(context.getPreviousAccessor());
         assertEquals( root.getClass(), context.getPreviousType() );
         assertEquals( root.getList(), context.getCurrentObject() );
 
@@ -225,7 +225,7 @@
         assertEquals( ".getList()", chain.toGetSourceString( context, root ) );
         assertEquals( List.class, context.getCurrentType() );
         assertEquals( Root.class, context.getCurrentAccessor() );
-        assertEquals( null, context.getPreviousAccessor() );
+        assertNull(context.getPreviousAccessor());
         assertEquals( Root.class, context.getPreviousType() );
         assertEquals( root.getList(), context.getCurrentObject() );
 
diff --git a/src/test/java/org/apache/commons/ognl/test/CollectionDirectPropertyTest.java b/src/test/java/org/apache/commons/ognl/test/CollectionDirectPropertyTest.java
index 8647e31..290ad97 100644
--- a/src/test/java/org/apache/commons/ognl/test/CollectionDirectPropertyTest.java
+++ b/src/test/java/org/apache/commons/ognl/test/CollectionDirectPropertyTest.java
@@ -47,7 +47,7 @@
         { Arrays.asList( "hello", "world" ), "size", 2 },
         { ROOT, "map[\"test\"]", ROOT }, { ROOT, "map.size", ROOT.getMap().size() },
         { ROOT, "map.keySet", ROOT.getMap().keySet() }, { ROOT, "map.values", ROOT.getMap().values() },
-        { ROOT, "map.keys.size", ROOT.getMap().keySet().size() },
+        { ROOT, "map.keys.size", ROOT.getMap().size() },
         { ROOT, "map[\"size\"]", ROOT.getMap().get( "size" ) },
         { ROOT, "map.isEmpty", ROOT.getMap().isEmpty() ? Boolean.TRUE : Boolean.FALSE },
         { ROOT, "map[\"isEmpty\"]", null }, };
diff --git a/src/test/java/org/apache/commons/ognl/test/CompilingPropertyAccessor.java b/src/test/java/org/apache/commons/ognl/test/CompilingPropertyAccessor.java
index 4138d43..2b78a60 100644
--- a/src/test/java/org/apache/commons/ognl/test/CompilingPropertyAccessor.java
+++ b/src/test/java/org/apache/commons/ognl/test/CompilingPropertyAccessor.java
@@ -47,28 +47,16 @@
 
     private static final NameFactory NAME_FACTORY = new NameFactory( "ognl.PropertyAccessor", "v" );
 
-    private static final Getter NOT_FOUND_GETTER = new Getter()
-    {
+    private static final Getter NOT_FOUND_GETTER = (context, target, propertyName) -> null;
 
-        public Object get( OgnlContext context, Object target, String propertyName )
+    private static final Getter DEFAULT_GETTER = (context, target, propertyName) -> {
+        try
         {
-            return null;
+            return OgnlRuntime.getMethodValue( context, target, propertyName, true );
         }
-    };
-
-    private static final Getter DEFAULT_GETTER = new Getter()
-    {
-
-        public Object get( OgnlContext context, Object target, String propertyName )
+        catch ( Exception ex )
         {
-            try
-            {
-                return OgnlRuntime.getMethodValue( context, target, propertyName, true );
-            }
-            catch ( Exception ex )
-            {
-                throw new RuntimeException( ex );
-            }
+            throw new RuntimeException( ex );
         }
     };
 
@@ -107,7 +95,7 @@
 
     public interface Getter
     {
-        public Object get( OgnlContext context, Object target, String propertyName );
+        Object get( OgnlContext context, Object target, String propertyName );
     }
 
     public static Getter generateGetter( OgnlContext context, String code )
diff --git a/src/test/java/org/apache/commons/ognl/test/ConstantTest.java b/src/test/java/org/apache/commons/ognl/test/ConstantTest.java
index 34e627a..51ac9cc 100644
--- a/src/test/java/org/apache/commons/ognl/test/ConstantTest.java
+++ b/src/test/java/org/apache/commons/ognl/test/ConstantTest.java
@@ -61,7 +61,7 @@
         { "true", Boolean.TRUE },
         { "false", Boolean.FALSE },
         { "{ false, true, null, 0, 1. }",
-            Arrays.asList( new Object[] { Boolean.FALSE, Boolean.TRUE, null, new Integer( 0 ), new Double( 1 ) } ) },
+            Arrays.asList( Boolean.FALSE, Boolean.TRUE, null, new Integer( 0 ), new Double( 1 ) ) },
         { "'HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"'",
             "HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"" }, };
 
diff --git a/src/test/java/org/apache/commons/ognl/test/ConstantTreeTest.java b/src/test/java/org/apache/commons/ognl/test/ConstantTreeTest.java
index 0f4723d..349a00d 100644
--- a/src/test/java/org/apache/commons/ognl/test/ConstantTreeTest.java
+++ b/src/test/java/org/apache/commons/ognl/test/ConstantTreeTest.java
@@ -24,6 +24,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
 
+import junit.framework.Assert;
 import org.apache.commons.ognl.Ognl;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -77,7 +78,7 @@
     public void runTest()
         throws Exception
     {
-        assertTrue( Ognl.isConstant( getExpression(), _context ) == ( (Boolean) getExpectedResult() ).booleanValue() );
+        Assert.assertEquals(Ognl.isConstant(getExpression(), _context), ((Boolean) getExpectedResult()).booleanValue());
     }
 
     /*
diff --git a/src/test/java/org/apache/commons/ognl/test/CorrectedObjectNullHandler.java b/src/test/java/org/apache/commons/ognl/test/CorrectedObjectNullHandler.java
index 18257de..e6ad4dc 100644
--- a/src/test/java/org/apache/commons/ognl/test/CorrectedObjectNullHandler.java
+++ b/src/test/java/org/apache/commons/ognl/test/CorrectedObjectNullHandler.java
@@ -35,7 +35,6 @@
      */
     public CorrectedObjectNullHandler( String defaultValue )
     {
-        super();
         this.defaultValue = defaultValue;
     }
 
diff --git a/src/test/java/org/apache/commons/ognl/test/InheritedMethodsTest.java b/src/test/java/org/apache/commons/ognl/test/InheritedMethodsTest.java
index b1bff70..868e963 100644
--- a/src/test/java/org/apache/commons/ognl/test/InheritedMethodsTest.java
+++ b/src/test/java/org/apache/commons/ognl/test/InheritedMethodsTest.java
@@ -18,7 +18,7 @@
  * under the License.
  */
 /**
- * 
+ *
  */
 package org.apache.commons.ognl.test;
 
diff --git a/src/test/java/org/apache/commons/ognl/test/LambdaExpressionTest.java b/src/test/java/org/apache/commons/ognl/test/LambdaExpressionTest.java
index e7a1014..3fc983b 100644
--- a/src/test/java/org/apache/commons/ognl/test/LambdaExpressionTest.java
+++ b/src/test/java/org/apache/commons/ognl/test/LambdaExpressionTest.java
@@ -42,7 +42,7 @@
         { null, "#fact=:[#this<=1? 1 : #fact(#this-1) * #this], #fact(30h)",
             new BigInteger( "265252859812191058636308480000000" ) },
         { null, "#bump = :[ #this.{ #this + 1 } ], (#bump)({ 1, 2, 3 })",
-            new ArrayList( Arrays.asList( new Integer[] { new Integer( 2 ), new Integer( 3 ), new Integer( 4 ) } ) ) },
+            new ArrayList( Arrays.asList( new Integer( 2 ), new Integer( 3 ), new Integer( 4 ) ) ) },
         { null, "#call = :[ \"calling \" + [0] + \" on \" + [1] ], (#call)({ \"x\", \"y\" })", "calling x on y" },
 
     };
diff --git a/src/test/java/org/apache/commons/ognl/test/NullStringCatenationTest.java b/src/test/java/org/apache/commons/ognl/test/NullStringCatenationTest.java
index 6ff2094..8408c2d 100644
--- a/src/test/java/org/apache/commons/ognl/test/NullStringCatenationTest.java
+++ b/src/test/java/org/apache/commons/ognl/test/NullStringCatenationTest.java
@@ -48,14 +48,14 @@
         { ROOT, "'width:' + width + ';'", "width:238px;" },
         { ROOT, "theLong + '_' + index", "4_1" },
         { ROOT, "'javascript:' + @org.apache.commons.ognl.test.NullStringCatenationTest@MESSAGE", "javascript:blarney" },
-        { ROOT,  "printDelivery ? '' : 'javascript:deliverySelected(' + property.carrier + ',' + currentDeliveryId + ')'", "" }, 
-        { ROOT, "bean2.id + '_' + theInt", "1_6" } 
+        { ROOT,  "printDelivery ? '' : 'javascript:deliverySelected(' + property.carrier + ',' + currentDeliveryId + ')'", "" },
+        { ROOT, "bean2.id + '_' + theInt", "1_6" }
     };
 
-    
+
     /**
      * Setup parameters for this test which are used to call this class constructor
-     * @return the collection of paramaters 
+     * @return the collection of paramaters
      */
     @Parameters
     public static Collection<Object[]> data()
@@ -76,7 +76,7 @@
 
     /**
      * Constructor: size of the Object[] returned by the @Parameter annotated method must match
-     * the number of arguments in this constructor  
+     * the number of arguments in this constructor
      */
     public NullStringCatenationTest( String name, Object root, String expressionString, Object expectedResult)
     {
diff --git a/src/test/java/org/apache/commons/ognl/test/NumericConversionTest.java b/src/test/java/org/apache/commons/ognl/test/NumericConversionTest.java
index 04209e4..a78d8fb 100644
--- a/src/test/java/org/apache/commons/ognl/test/NumericConversionTest.java
+++ b/src/test/java/org/apache/commons/ognl/test/NumericConversionTest.java
@@ -27,6 +27,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
 
+import junit.framework.Assert;
 import org.apache.commons.ognl.OgnlException;
 import org.apache.commons.ognl.OgnlOps;
 import org.junit.Test;
@@ -213,7 +214,7 @@
                 double scalingFactor = Math.pow( 10, scale ), v1 = ( (Number) value ).doubleValue() * scalingFactor, v2 =
                     ( (Number) expectedValue ).doubleValue() * scalingFactor;
 
-                assertTrue( (int) v1 == (int) v2 );
+                Assert.assertEquals((int) v1, (int) v2);
             }
             else
             {
diff --git a/src/test/java/org/apache/commons/ognl/test/ObjectIndexedTest.java b/src/test/java/org/apache/commons/ognl/test/ObjectIndexedTest.java
index 0aa99a4..e4ec4f3 100644
--- a/src/test/java/org/apache/commons/ognl/test/ObjectIndexedTest.java
+++ b/src/test/java/org/apache/commons/ognl/test/ObjectIndexedTest.java
@@ -37,7 +37,7 @@
      * =================================================================== Public static classes
      * ===================================================================
      */
-    public static interface TestInterface
+    public interface TestInterface
     {
         String getSunk( String index );
 
@@ -150,7 +150,6 @@
      */
     public ObjectIndexedTest()
     {
-        super();
     }
 
     public ObjectIndexedTest( String name )
diff --git a/src/test/java/org/apache/commons/ognl/test/OgnlTestCase.java b/src/test/java/org/apache/commons/ognl/test/OgnlTestCase.java
index 39fc82d..8a39e4f 100644
--- a/src/test/java/org/apache/commons/ognl/test/OgnlTestCase.java
+++ b/src/test/java/org/apache/commons/ognl/test/OgnlTestCase.java
@@ -233,14 +233,10 @@
                 ex = (Exception) ex.getCause();
             }
 
-            if ( testedResult instanceof Class )
-            {
-                Assert.assertTrue( Exception.class.isAssignableFrom( (Class<?>) testedResult ) );
-            }
-            else
-            {
+            if ( !(testedResult instanceof Class) ) {
                 throw ex;
             }
+            Assert.assertTrue( Exception.class.isAssignableFrom( (Class<?>) testedResult ) );
         }
     }
 
diff --git a/src/test/java/org/apache/commons/ognl/test/Performance.java b/src/test/java/org/apache/commons/ognl/test/Performance.java
index c4914d1..697cf94 100644
--- a/src/test/java/org/apache/commons/ognl/test/Performance.java
+++ b/src/test/java/org/apache/commons/ognl/test/Performance.java
@@ -79,7 +79,6 @@
 
         public Results( int iterations, long time, boolean mvel )
         {
-            super();
             this.iterations = iterations;
             this.time = time;
             this.mvel = mvel;
@@ -276,7 +275,7 @@
 
         try
         {
-            _method = getClass().getMethod( javaMethodName, new Class[] {} );
+            _method = getClass().getMethod( javaMethodName );
         }
         catch ( Exception ex )
         {
@@ -320,17 +319,11 @@
         {
             return ( t1 - t0 ) >= MAX_TIME;
         }
-        else
+        if ( ITERATIONS_MODE )
         {
-            if ( ITERATIONS_MODE )
-            {
-                return _iterations >= MAX_ITERATIONS;
-            }
-            else
-            {
-                throw new RuntimeException( "no maximums specified" );
-            }
+            return _iterations >= MAX_ITERATIONS;
         }
+        throw new RuntimeException( "no maximums specified" );
     }
 
     /*
diff --git a/src/test/java/org/apache/commons/ognl/test/ProjectionSelectionTest.java b/src/test/java/org/apache/commons/ognl/test/ProjectionSelectionTest.java
index ae5a8b0..094e444 100644
--- a/src/test/java/org/apache/commons/ognl/test/ProjectionSelectionTest.java
+++ b/src/test/java/org/apache/commons/ognl/test/ProjectionSelectionTest.java
@@ -38,10 +38,10 @@
     private static final Object[][] TESTS = {
         // Projection, selection
         { ROOT, "array.{class}",
-            Arrays.asList( new Class[] { Integer.class, Integer.class, Integer.class, Integer.class } ) },
-        { ROOT, "map.array.{? #this > 2 }", Arrays.asList( new Integer[] { new Integer( 3 ), new Integer( 4 ) } ) },
-        { ROOT, "map.array.{^ #this > 2 }", Arrays.asList( new Integer[] { new Integer( 3 ) } ) },
-        { ROOT, "map.array.{$ #this > 2 }", Arrays.asList( new Integer[] { new Integer( 4 ) } ) },
+            Arrays.asList( Integer.class, Integer.class, Integer.class, Integer.class ) },
+        { ROOT, "map.array.{? #this > 2 }", Arrays.asList( new Integer( 3 ), new Integer( 4 ) ) },
+        { ROOT, "map.array.{^ #this > 2 }", Arrays.asList( new Integer( 3 ) ) },
+        { ROOT, "map.array.{$ #this > 2 }", Arrays.asList( new Integer( 4 ) ) },
         { ROOT, "map.array[*].{?true} instanceof java.util.Collection", Boolean.TRUE },
         { null, "#fact=1, 30H.{? #fact = #fact * (#this+1), false }, #fact",
             new BigInteger( "265252859812191058636308480000000" ) }, };
diff --git a/src/test/java/org/apache/commons/ognl/test/PropertySetterTest.java b/src/test/java/org/apache/commons/ognl/test/PropertySetterTest.java
index 8e1bdc0..83368d1 100644
--- a/src/test/java/org/apache/commons/ognl/test/PropertySetterTest.java
+++ b/src/test/java/org/apache/commons/ognl/test/PropertySetterTest.java
@@ -41,7 +41,7 @@
 
     public interface TestInterface
     {
-        public String getProperty();
+        String getProperty();
     }
 
     public class TestObject
diff --git a/src/test/java/org/apache/commons/ognl/test/PropertyTest.java b/src/test/java/org/apache/commons/ognl/test/PropertyTest.java
index bc66f48..b773874 100644
--- a/src/test/java/org/apache/commons/ognl/test/PropertyTest.java
+++ b/src/test/java/org/apache/commons/ognl/test/PropertyTest.java
@@ -81,9 +81,9 @@
             { ROOT, "map[$].(#root == null ? 'empty' : #root)", ROOT },
             { ROOT, "((selected != null) && (currLocale.toString() == selected.toString())) ? 'first' : 'second'",
                 "first" },
-            { ROOT, "{stringValue, getMap()}", Arrays.asList( new Object[] { ROOT.getStringValue(), ROOT.getMap() } ) },
+            { ROOT, "{stringValue, getMap()}", Arrays.asList( ROOT.getStringValue(), ROOT.getMap() ) },
             { ROOT, "{'stringValue', map[\"test\"].map[\"size\"]}",
-                Arrays.asList( new Object[] { "stringValue", ROOT.getMap().get( "size" ) } ) },
+                Arrays.asList( "stringValue", ROOT.getMap().get( "size" ) ) },
             { ROOT, "property.bean3.value + '(this.checked)'", "100(this.checked)" },
             { ROOT, "getIndexedProperty(property.bean3.map[\"bar\"])", ROOT.getArray() },
             { ROOT, "getProperty().getBean3()", ( (Bean2) ROOT.getProperty() ).getBean3() },
diff --git a/src/test/java/org/apache/commons/ognl/test/SimpleNavigationChainTreeTest.java b/src/test/java/org/apache/commons/ognl/test/SimpleNavigationChainTreeTest.java
index 23b0d93..a2171de 100644
--- a/src/test/java/org/apache/commons/ognl/test/SimpleNavigationChainTreeTest.java
+++ b/src/test/java/org/apache/commons/ognl/test/SimpleNavigationChainTreeTest.java
@@ -24,6 +24,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
 
+import junit.framework.Assert;
 import org.apache.commons.ognl.Ognl;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -78,6 +79,6 @@
     public void runTest()
         throws Exception
     {
-        assertTrue( Ognl.isSimpleNavigationChain( getExpression(), _context ) == ( (Boolean) getExpectedResult() ).booleanValue() );
+        Assert.assertEquals(Ognl.isSimpleNavigationChain(getExpression(), _context), ((Boolean) getExpectedResult()).booleanValue());
     }
 }
diff --git a/src/test/java/org/apache/commons/ognl/test/SimplePropertyTreeTest.java b/src/test/java/org/apache/commons/ognl/test/SimplePropertyTreeTest.java
index debe179..989c3b8 100644
--- a/src/test/java/org/apache/commons/ognl/test/SimplePropertyTreeTest.java
+++ b/src/test/java/org/apache/commons/ognl/test/SimplePropertyTreeTest.java
@@ -24,6 +24,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
 
+import junit.framework.Assert;
 import org.apache.commons.ognl.Ognl;
 import org.junit.Before;
 import org.junit.runner.RunWith;
@@ -78,6 +79,6 @@
     public void runTest()
         throws Exception
     {
-        assertTrue( Ognl.isSimpleProperty( getExpression(), _context ) == ( (Boolean) getExpectedResult() ).booleanValue() );
+        Assert.assertEquals(Ognl.isSimpleProperty(getExpression(), _context), ((Boolean) getExpectedResult()).booleanValue());
     }
 }
diff --git a/src/test/java/org/apache/commons/ognl/test/accessors/ListPropertyAccessorTest.java b/src/test/java/org/apache/commons/ognl/test/accessors/ListPropertyAccessorTest.java
index aeee9de..57738d7 100644
--- a/src/test/java/org/apache/commons/ognl/test/accessors/ListPropertyAccessorTest.java
+++ b/src/test/java/org/apache/commons/ognl/test/accessors/ListPropertyAccessorTest.java
@@ -56,7 +56,7 @@
         assertEquals( List.class, context.getCurrentAccessor() );
         assertEquals( Object.class, context.getCurrentType() );
         assertEquals( Integer.TYPE, context.getPreviousType() );
-        assertEquals( null, context.getPreviousAccessor() );
+        assertNull(context.getPreviousAccessor());
     }
 
     @Test
@@ -76,7 +76,7 @@
         assertEquals( List.class, context.getCurrentAccessor() );
         assertEquals( Object.class, context.getCurrentType() );
         assertEquals( Integer.class, context.getPreviousType() );
-        assertEquals( null, context.getPreviousAccessor() );
+        assertNull(context.getPreviousAccessor());
     }
 
     @Test
diff --git a/src/test/java/org/apache/commons/ognl/test/enhance/TestExpressionCompiler.java b/src/test/java/org/apache/commons/ognl/test/enhance/TestExpressionCompiler.java
index b3ddf7f..a28152c 100644
--- a/src/test/java/org/apache/commons/ognl/test/enhance/TestExpressionCompiler.java
+++ b/src/test/java/org/apache/commons/ognl/test/enhance/TestExpressionCompiler.java
@@ -242,7 +242,7 @@
         GenericRoot root = new GenericRoot();
 
         Node node = Ognl.compileExpression( _context, root, "cracker.param" );
-        assertEquals( null, node.getAccessor().get( _context, root ) );
+        assertNull(node.getAccessor().get(_context, root));
 
         node.getAccessor().set( _context, root, 0 );
         assertEquals( 0, node.getAccessor().get( _context, root ) );
diff --git a/src/test/java/org/apache/commons/ognl/test/objects/BaseObjectIndexed.java b/src/test/java/org/apache/commons/ognl/test/objects/BaseObjectIndexed.java
index 4d866fb..4ec1fa0 100644
--- a/src/test/java/org/apache/commons/ognl/test/objects/BaseObjectIndexed.java
+++ b/src/test/java/org/apache/commons/ognl/test/objects/BaseObjectIndexed.java
@@ -28,7 +28,6 @@
 
     public BaseObjectIndexed()
     {
-        super();
     }
 
     public Map getAttributes()
diff --git a/src/test/java/org/apache/commons/ognl/test/objects/BeanProviderAccessor.java b/src/test/java/org/apache/commons/ognl/test/objects/BeanProviderAccessor.java
index 0db0a0a..b07ee9b 100644
--- a/src/test/java/org/apache/commons/ognl/test/objects/BeanProviderAccessor.java
+++ b/src/test/java/org/apache/commons/ognl/test/objects/BeanProviderAccessor.java
@@ -18,7 +18,7 @@
  * under the License.
  */
 /**
- * 
+ *
  */
 package org.apache.commons.ognl.test.objects;
 
@@ -58,7 +58,7 @@
         throws OgnlException
     {
         BeanProvider provider = (BeanProvider) target;
-        String beanName = ( (String) oname ).replaceAll( "\"", "" );
+        String beanName = ( (String) oname ).replace( "\"", "" );
 
         return provider.getBean( beanName ) != null;
     }
@@ -67,7 +67,7 @@
     public String getSourceAccessor( OgnlContext context, Object target, Object name )
     {
         BeanProvider provider = (BeanProvider) target;
-        String beanName = ( (String) name ).replaceAll( "\"", "" );
+        String beanName = ( (String) name ).replace( "\"", "" );
 
         if ( provider.getBean( beanName ) != null )
         {
diff --git a/src/test/java/org/apache/commons/ognl/test/objects/BeanProviderImpl.java b/src/test/java/org/apache/commons/ognl/test/objects/BeanProviderImpl.java
index 2c5f9ac..85d31cc 100644
--- a/src/test/java/org/apache/commons/ognl/test/objects/BeanProviderImpl.java
+++ b/src/test/java/org/apache/commons/ognl/test/objects/BeanProviderImpl.java
@@ -18,7 +18,7 @@
  * under the License.
  */
 /**
- * 
+ *
  */
 package org.apache.commons.ognl.test.objects;
 
diff --git a/src/test/java/org/apache/commons/ognl/test/objects/Component.java b/src/test/java/org/apache/commons/ognl/test/objects/Component.java
index a06e695..077c6da 100644
--- a/src/test/java/org/apache/commons/ognl/test/objects/Component.java
+++ b/src/test/java/org/apache/commons/ognl/test/objects/Component.java
@@ -53,7 +53,6 @@
 
     public Component()
     {
-        super();
     }
 
     public Page getPage()
diff --git a/src/test/java/org/apache/commons/ognl/test/objects/FirstBean.java b/src/test/java/org/apache/commons/ognl/test/objects/FirstBean.java
index e139e4e..4c1918e 100644
--- a/src/test/java/org/apache/commons/ognl/test/objects/FirstBean.java
+++ b/src/test/java/org/apache/commons/ognl/test/objects/FirstBean.java
@@ -18,7 +18,7 @@
  * under the License.
  */
 /**
- * 
+ *
  */
 package org.apache.commons.ognl.test.objects;
 
diff --git a/src/test/java/org/apache/commons/ognl/test/objects/GameGenericObject.java b/src/test/java/org/apache/commons/ognl/test/objects/GameGenericObject.java
index 2c96aad..ef25d4e 100644
--- a/src/test/java/org/apache/commons/ognl/test/objects/GameGenericObject.java
+++ b/src/test/java/org/apache/commons/ognl/test/objects/GameGenericObject.java
@@ -28,7 +28,6 @@
 
     public GameGenericObject()
     {
-        super();
     }
 
     public int getId()
diff --git a/src/test/java/org/apache/commons/ognl/test/objects/IContentProvider.java b/src/test/java/org/apache/commons/ognl/test/objects/IContentProvider.java
index 6b7e93e..33a8339 100644
--- a/src/test/java/org/apache/commons/ognl/test/objects/IContentProvider.java
+++ b/src/test/java/org/apache/commons/ognl/test/objects/IContentProvider.java
@@ -27,5 +27,5 @@
 public interface IContentProvider
 {
 
-    public List getElements();
+    List getElements();
 }
diff --git a/src/test/java/org/apache/commons/ognl/test/objects/ITreeContentProvider.java b/src/test/java/org/apache/commons/ognl/test/objects/ITreeContentProvider.java
index 3a5bf3d..ea9deff 100644
--- a/src/test/java/org/apache/commons/ognl/test/objects/ITreeContentProvider.java
+++ b/src/test/java/org/apache/commons/ognl/test/objects/ITreeContentProvider.java
@@ -28,7 +28,7 @@
     extends IContentProvider
 {
 
-    public Collection getChildren( Object parentElement );
+    Collection getChildren( Object parentElement );
 
-    public boolean hasChildren( Object parentElement );
+    boolean hasChildren( Object parentElement );
 }
diff --git a/src/test/java/org/apache/commons/ognl/test/objects/ListSource.java b/src/test/java/org/apache/commons/ognl/test/objects/ListSource.java
index 154f321..3afea68 100644
--- a/src/test/java/org/apache/commons/ognl/test/objects/ListSource.java
+++ b/src/test/java/org/apache/commons/ognl/test/objects/ListSource.java
@@ -25,9 +25,9 @@
 public interface ListSource
 {
 
-    public int getTotal();
+    int getTotal();
 
-    public Object addValue( Object value );
+    Object addValue( Object value );
 
-    public Object getName();
+    Object getName();
 }
diff --git a/src/test/java/org/apache/commons/ognl/test/objects/MyMap.java b/src/test/java/org/apache/commons/ognl/test/objects/MyMap.java
index ddf8ab7..5b801f9 100644
--- a/src/test/java/org/apache/commons/ognl/test/objects/MyMap.java
+++ b/src/test/java/org/apache/commons/ognl/test/objects/MyMap.java
@@ -28,5 +28,5 @@
 public interface MyMap
     extends Map
 {
-    public String getDescription();
+    String getDescription();
 }
diff --git a/src/test/java/org/apache/commons/ognl/test/objects/ObjectIndexed.java b/src/test/java/org/apache/commons/ognl/test/objects/ObjectIndexed.java
index 72e90aa..f0bf123 100644
--- a/src/test/java/org/apache/commons/ognl/test/objects/ObjectIndexed.java
+++ b/src/test/java/org/apache/commons/ognl/test/objects/ObjectIndexed.java
@@ -24,7 +24,6 @@
 {
     public ObjectIndexed()
     {
-        super();
         setAttribute( "foo", "bar" );
         setAttribute( "bar", "baz" );
         setAttribute( "other", new OtherObjectIndexed() );
diff --git a/src/test/java/org/apache/commons/ognl/test/objects/OtherObjectIndexed.java b/src/test/java/org/apache/commons/ognl/test/objects/OtherObjectIndexed.java
index 57142e0..cff6341 100644
--- a/src/test/java/org/apache/commons/ognl/test/objects/OtherObjectIndexed.java
+++ b/src/test/java/org/apache/commons/ognl/test/objects/OtherObjectIndexed.java
@@ -24,7 +24,6 @@
 {
     public OtherObjectIndexed()
     {
-        super();
         setAttribute( "foo", "bar" );
         setAttribute( "bar", "baz" );
     }
diff --git a/src/test/java/org/apache/commons/ognl/test/objects/Root.java b/src/test/java/org/apache/commons/ognl/test/objects/Root.java
index ef930f1..0b80266 100644
--- a/src/test/java/org/apache/commons/ognl/test/objects/Root.java
+++ b/src/test/java/org/apache/commons/ognl/test/objects/Root.java
@@ -41,9 +41,9 @@
 
     private final MyMap myMap = new MyMapImpl();
 
-    private final List list = Arrays.asList( new Object[] { null, this, array } );
+    private final List list = Arrays.asList( null, this, array );
 
-    private final List settableList = new ArrayList( Arrays.asList( new Object[] { "foo", "bar", "baz" } ) );
+    private final List settableList = new ArrayList( Arrays.asList( "foo", "bar", "baz" ) );
 
     private final int index = 1;
 
@@ -114,7 +114,6 @@
      */
     public Root()
     {
-        super();
     }
 
     /*
diff --git a/src/test/java/org/apache/commons/ognl/test/objects/SecondBean.java b/src/test/java/org/apache/commons/ognl/test/objects/SecondBean.java
index dd5e001..93eec04 100644
--- a/src/test/java/org/apache/commons/ognl/test/objects/SecondBean.java
+++ b/src/test/java/org/apache/commons/ognl/test/objects/SecondBean.java
@@ -18,7 +18,7 @@
  * under the License.
  */
 /**
- * 
+ *
  */
 package org.apache.commons.ognl.test.objects;
 
diff --git a/src/test/java/org/apache/commons/ognl/test/objects/Simple.java b/src/test/java/org/apache/commons/ognl/test/objects/Simple.java
index 36e5775..d56a61f 100644
--- a/src/test/java/org/apache/commons/ognl/test/objects/Simple.java
+++ b/src/test/java/org/apache/commons/ognl/test/objects/Simple.java
@@ -71,12 +71,10 @@
 
     public Simple( Object[] values )
     {
-        super();
     }
 
     public Simple( String stringValue, float floatValue, int intValue )
     {
-        super();
         this.stringValue = stringValue;
         this.floatValue = floatValue;
         this.intValue = intValue;
diff --git a/src/test/java/org/apache/commons/ognl/test/objects/SimpleEnum.java b/src/test/java/org/apache/commons/ognl/test/objects/SimpleEnum.java
index 250dc46..b081070 100644
--- a/src/test/java/org/apache/commons/ognl/test/objects/SimpleEnum.java
+++ b/src/test/java/org/apache/commons/ognl/test/objects/SimpleEnum.java
@@ -29,7 +29,7 @@
 
     private final int _value;
 
-    private SimpleEnum( int value )
+    SimpleEnum( int value )
     {
         _value = value;
     }
diff --git a/src/test/java/org/apache/commons/ognl/test/util/NameFactory.java b/src/test/java/org/apache/commons/ognl/test/util/NameFactory.java
index 7ce7e8f..4f46b5b 100644
--- a/src/test/java/org/apache/commons/ognl/test/util/NameFactory.java
+++ b/src/test/java/org/apache/commons/ognl/test/util/NameFactory.java
@@ -36,7 +36,6 @@
      */
     public NameFactory( String classBaseName, String variableBaseName )
     {
-        super();
         this.classBaseName = classBaseName;
         this.variableBaseName = variableBaseName;
     }