Commits

Anonymous committed 3fdd153

Fixes for OGNL-115. ASTConst needed to cause unsupported compilation exceptions to be thrown when the first stack member is a constant during setter generations as constants aren't obviously CONSTANT and not changeable.

Comments (0)

Files changed (13)

       <excludeFolder url="file://$MODULE_DIR$/extlib" />
       <excludeFolder url="file://$MODULE_DIR$/target/apidocs" />
       <excludeFolder url="file://$MODULE_DIR$/target/classes" />
+      <excludeFolder url="file://$MODULE_DIR$/target/maven-archiver" />
       <excludeFolder url="file://$MODULE_DIR$/target/surefire-reports" />
       <excludeFolder url="file://$MODULE_DIR$/target/test-classes" />
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
     <orderEntry type="module-library">
-      <library name="jboss:javassist:3.6.ga">
-        <CLASSES>
-          <root url="jar://$USERPROFILE$/.m2/repository/jboss/javassist/3.6.ga/javassist-3.6.ga.jar!/" />
-        </CLASSES>
-        <JAVADOC>
-          <root url="jar://$USERPROFILE$/.m2/repository/jboss/javassist/3.6.ga/javassist-3.6.ga-javadoc.jar!/" />
-        </JAVADOC>
-        <SOURCES>
-          <root url="jar://$USERPROFILE$/.m2/repository/jboss/javassist/3.6.ga/javassist-3.6.ga-sources.jar!/" />
-        </SOURCES>
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
       <library name="junit:junit:3.8.1">
         <CLASSES>
           <root url="jar://$USERPROFILE$/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar!/" />
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="org.easymock:easymock:2.2">
+      <library name="org.easymock:easymock:2.3">
         <CLASSES>
-          <root url="jar://$USERPROFILE$/.m2/repository/org/easymock/easymock/2.2/easymock-2.2.jar!/" />
+          <root url="jar://$USERPROFILE$/.m2/repository/org/easymock/easymock/2.3/easymock-2.3.jar!/" />
         </CLASSES>
         <JAVADOC>
-          <root url="jar://$USERPROFILE$/.m2/repository/org/easymock/easymock/2.2/easymock-2.2-javadoc.jar!/" />
+          <root url="jar://$USERPROFILE$/.m2/repository/org/easymock/easymock/2.3/easymock-2.3-javadoc.jar!/" />
         </JAVADOC>
         <SOURCES>
-          <root url="jar://$USERPROFILE$/.m2/repository/org/easymock/easymock/2.2/easymock-2.2-sources.jar!/" />
+          <root url="jar://$USERPROFILE$/.m2/repository/org/easymock/easymock/2.3/easymock-2.3-sources.jar!/" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library" exported="">
+      <library name="jboss:javassist:3.6.ga">
+        <CLASSES>
+          <root url="jar://$USERPROFILE$/.m2/repository/jboss/javassist/3.6.ga/javassist-3.6.ga.jar!/" />
+        </CLASSES>
+        <JAVADOC>
+          <root url="jar://$USERPROFILE$/.m2/repository/jboss/javassist/3.6.ga/javassist-3.6.ga-javadoc.jar!/" />
+        </JAVADOC>
+        <SOURCES>
+          <root url="jar://$USERPROFILE$/.m2/repository/jboss/javassist/3.6.ga/javassist-3.6.ga-sources.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
   </component>
   <component name="ChangeListManager">
     <list default="true" name="Default" comment="">
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/OGNL.iml" afterPath="$PROJECT_DIR$/OGNL.iml" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/java/ognl/ASTConst.java" afterPath="$PROJECT_DIR$/src/java/ognl/ASTConst.java" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/OGNL.iws" afterPath="$PROJECT_DIR$/OGNL.iws" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/java/ognl/ASTProperty.java" afterPath="$PROJECT_DIR$/src/java/ognl/ASTProperty.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/java/ognl/ASTMethod.java" afterPath="$PROJECT_DIR$/src/java/ognl/ASTMethod.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/build/javassist.jar" afterPath="$PROJECT_DIR$/lib/build/javassist.jar" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/java/ognl/OgnlContext.java" afterPath="$PROJECT_DIR$/src/java/ognl/OgnlContext.java" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/test/java/org/ognl/test/PropertySetterTest.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/java/ognl/ASTChain.java" afterPath="$PROJECT_DIR$/src/java/ognl/ASTChain.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/java/ognl/enhance/ExpressionCompiler.java" afterPath="$PROJECT_DIR$/src/java/ognl/enhance/ExpressionCompiler.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/test/java/org/ognl/test/ASTPropertyTest.java" afterPath="$PROJECT_DIR$/src/test/java/org/ognl/test/ASTPropertyTest.java" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pom.xml" afterPath="$PROJECT_DIR$/pom.xml" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/java/ognl/ArrayPropertyAccessor.java" afterPath="$PROJECT_DIR$/src/java/ognl/ArrayPropertyAccessor.java" />
     </list>
   </component>
   <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
       <file leaf-file-name="pom.xml" pinned="false" current="true" current-in-tab="true">
         <entry file="file://$PROJECT_DIR$/pom.xml">
           <provider selected="true" editor-type-id="text-editor">
-            <state line="3" column="0" selection-start="250" selection-end="250" vertical-scroll-proportion="0.037562605">
+            <state line="23" column="0" selection-start="768" selection-end="768" vertical-scroll-proportion="0.28797996">
               <folding />
             </state>
           </provider>
       <showLibraryContents />
       <hideEmptyPackages />
       <abbreviatePackageNames />
-      <showStructure Favorites="false" Scope="false" PackagesPane="false" ProjectPane="false" />
+      <showStructure PackagesPane="false" Scope="false" Favorites="false" ProjectPane="false" />
       <autoscrollToSource />
       <autoscrollFromSource />
       <sortByType />
     <option name="referencePos" value="0" />
     <option name="showLabels" value="true" />
   </component>
-  <component name="RunManager" selected="JUnit.ArithmeticAndLogicalOperatorsTest">
-    <tempConfiguration default="false" name="ArithmeticAndLogicalOperatorsTest" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
+  <component name="RunManager" selected="JUnit.ConstantTest">
+    <tempConfiguration default="false" name="ConstantTest" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
       <pattern value="org.ognl.test.*" />
       <module name="OGNL" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
       <option name="ALTERNATIVE_JRE_PATH" value="/usr/local/jdk1.6.0_02" />
       <option name="PACKAGE_NAME" value="org.ognl.test" />
-      <option name="MAIN_CLASS_NAME" value="org.ognl.test.ArithmeticAndLogicalOperatorsTest" />
+      <option name="MAIN_CLASS_NAME" value="org.ognl.test.ConstantTest" />
       <option name="METHOD_NAME" value="" />
       <option name="TEST_OBJECT" value="class" />
       <option name="VM_PARAMETERS" value="" />
         <option name="Make" value="true" />
       </method>
     </tempConfiguration>
-    <configuration default="true" type="Remote" factoryName="Remote">
-      <option name="USE_SOCKET_TRANSPORT" value="true" />
-      <option name="SERVER_MODE" value="false" />
-      <option name="SHMEM_ADDRESS" value="javadebug" />
-      <option name="HOST" value="localhost" />
-      <option name="PORT" value="5005" />
-    </configuration>
-    <configuration default="true" type="Applet" factoryName="Applet">
-      <module name="" />
-      <option name="MAIN_CLASS_NAME" />
-      <option name="HTML_FILE_NAME" />
-      <option name="HTML_USED" value="false" />
-      <option name="WIDTH" value="400" />
-      <option name="HEIGHT" value="300" />
-      <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
-      <option name="VM_PARAMETERS" />
-      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
-      <option name="ALTERNATIVE_JRE_PATH" />
-    </configuration>
     <configuration default="true" type="TestNG" factoryName="TestNG" enabled="false" merge="false">
       <module name="" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
         <option name="Make" value="true" />
       </method>
     </configuration>
+    <configuration default="true" type="Applet" factoryName="Applet">
+      <module name="" />
+      <option name="MAIN_CLASS_NAME" />
+      <option name="HTML_FILE_NAME" />
+      <option name="HTML_USED" value="false" />
+      <option name="WIDTH" value="400" />
+      <option name="HEIGHT" value="300" />
+      <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
+      <option name="VM_PARAMETERS" />
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+      <option name="ALTERNATIVE_JRE_PATH" />
+    </configuration>
+    <configuration default="true" type="Application" factoryName="Application" enabled="false" merge="false">
+      <option name="MAIN_CLASS_NAME" />
+      <option name="VM_PARAMETERS" />
+      <option name="PROGRAM_PARAMETERS" />
+      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+      <option name="ALTERNATIVE_JRE_PATH" />
+      <option name="ENABLE_SWING_INSPECTOR" value="false" />
+      <option name="ENV_VARIABLES" />
+      <option name="PASS_PARENT_ENVS" value="true" />
+      <module name="" />
+      <envs />
+      <method>
+        <option name="Make" value="true" />
+      </method>
+    </configuration>
     <configuration default="true" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
       <module name="" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
         <option name="Make" value="true" />
       </method>
     </configuration>
-    <configuration default="true" type="Application" factoryName="Application" enabled="false" merge="false">
-      <option name="MAIN_CLASS_NAME" />
-      <option name="VM_PARAMETERS" />
-      <option name="PROGRAM_PARAMETERS" />
-      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
-      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
-      <option name="ALTERNATIVE_JRE_PATH" />
-      <option name="ENABLE_SWING_INSPECTOR" value="false" />
-      <option name="ENV_VARIABLES" />
-      <option name="PASS_PARENT_ENVS" value="true" />
-      <module name="" />
-      <envs />
-      <method>
-        <option name="Make" value="true" />
-      </method>
+    <configuration default="true" type="Remote" factoryName="Remote">
+      <option name="USE_SOCKET_TRANSPORT" value="true" />
+      <option name="SERVER_MODE" value="false" />
+      <option name="SHMEM_ADDRESS" value="javadebug" />
+      <option name="HOST" value="localhost" />
+      <option name="PORT" value="5005" />
     </configuration>
     <list size="1">
-      <item index="0" class="java.lang.String" itemvalue="JUnit.ArithmeticAndLogicalOperatorsTest" />
+      <item index="0" class="java.lang.String" itemvalue="JUnit.ConstantTest" />
     </list>
     <configuration default="true" type="#com.intellij.j2ee.web.tomcat.TomcatRunConfigurationFactory" factoryName="Local">
       <option name="WORKING_DIRECTORY" />
     </todo-panel>
   </component>
   <component name="ToolWindowManager">
-    <frame x="165" y="146" width="2276" height="1397" extended-state="0" />
+    <frame x="187" y="145" width="2276" height="1397" extended-state="0" />
     <editor active="false" />
     <layout>
       <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.30128205" order="8" />
       <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.14343707" order="1" />
       <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32371795" order="1" />
       <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.5040064" order="3" />
-      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.23557693" order="8" />
+      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32932693" order="8" />
       <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.28445512" order="8" />
       <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="7" />
       <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.24943617" order="1" />
       <window_info id="Maven projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.18132612" order="3" />
       <window_info id="Module Dependencies" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
-      <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.26026163" order="0" />
+      <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.27695084" order="0" />
       <window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
       <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="2" />
       <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3488372" order="6" />
     <option name="myLastEditedConfigurable" />
   </component>
   <component name="editorHistoryManager">
-    <entry file="file://$PROJECT_DIR$/src/java/ognl/ASTChain.java">
+    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/PropertySetterTest.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="83" column="12" selection-start="2816" selection-end="2816" vertical-scroll-proportion="0.17255546">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/ArithmeticAndLogicalOperatorsTest.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="116" column="40" selection-start="5024" selection-end="5024" vertical-scroll-proportion="0.23418242">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/java/ognl/OgnlRuntime.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="343" column="35" selection-start="14720" selection-end="14720" vertical-scroll-proportion="0.112571895">
+        <state line="64" column="5" selection-start="1401" selection-end="1401" vertical-scroll-proportion="0.58801496">
           <folding>
             <element signature="imports" expanded="true" />
           </folding>
     </entry>
     <entry file="file://$PROJECT_DIR$/src/java/ognl/SimpleNode.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="201" column="51" selection-start="5626" selection-end="5626" vertical-scroll-proportion="0.3820871">
+        <state line="132" column="0" selection-start="3989" selection-end="3989" vertical-scroll-proportion="0.33083645">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/java/ognl/ASTMethod.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="464" column="13" selection-start="19815" selection-end="19815" vertical-scroll-proportion="0.5131086">
+          <folding>
+            <element signature="imports" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/ArrayElementsTest.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="58" column="0" selection-start="3073" selection-end="3073" vertical-scroll-proportion="0.30813476">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/java/ognl/OgnlContext.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="211" column="21" selection-start="7685" selection-end="7685" vertical-scroll-proportion="0.5830212">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="jar:///usr/local/java15/src.zip!/java/lang/Character.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="241" column="6" selection-start="8429" selection-end="8429" vertical-scroll-proportion="-1.764045">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/java/ognl/ASTConst.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="198" column="0" selection-start="6322" selection-end="6322" vertical-scroll-proportion="0.66292137">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/java/ognl/ArrayPropertyAccessor.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="205" column="0" selection-start="8266" selection-end="8266" vertical-scroll-proportion="0.6441948">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/java/ognl/ASTProperty.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="437" column="21" selection-start="17888" selection-end="17888" vertical-scroll-proportion="0.4868914">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/java/ognl/ASTChain.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="389" column="16" selection-start="16155" selection-end="16155" vertical-scroll-proportion="0.31835207">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/java/ognl/OgnlRuntime.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="166" column="61" selection-start="6894" selection-end="6894" vertical-scroll-proportion="0.4456929">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/PropertyTest.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="91" column="58" selection-start="5648" selection-end="5648" vertical-scroll-proportion="0.3500411">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/ASTPropertyTest.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="176" column="65" selection-start="6138" selection-end="6138" vertical-scroll-proportion="0.23171733">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/ConstantTest.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="71" column="6" selection-start="3475" selection-end="3475" vertical-scroll-proportion="0.39325842">
           <folding />
         </state>
       </provider>
     </entry>
     <entry file="file://$PROJECT_DIR$/src/java/ognl/enhance/ExpressionCompiler.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="29" column="7" selection-start="744" selection-end="744" vertical-scroll-proportion="0.14790468">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/java/ognl/ArrayElementsAccessor.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="56" column="13" selection-start="2497" selection-end="2497" vertical-scroll-proportion="0.32046014">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/objects/BeanProviderAccessor.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="47" column="9" selection-start="1341" selection-end="1341" vertical-scroll-proportion="0.505341">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/java/ognl/PropertyAccessor.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="92" column="4" selection-start="4250" selection-end="4250" vertical-scroll-proportion="0.5686113">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/java/ognl/ArrayPropertyAccessor.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="152" column="0" selection-start="5812" selection-end="5812" vertical-scroll-proportion="0.2571898">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/java/ognl/ASTAdd.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="247" column="25" selection-start="10454" selection-end="10454" vertical-scroll-proportion="0.2481512">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/java/ognl/Token.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="8" column="13" selection-start="201" selection-end="201" vertical-scroll-proportion="-0.50369763">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/java/ognl/TokenMgrError.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="99" column="57" selection-start="2963" selection-end="2963" vertical-scroll-proportion="0.42070666">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/java/ognl/ParseException.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="167" column="23" selection-start="5776" selection-end="5776" vertical-scroll-proportion="0.5439606">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/build.xml">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="38" column="41" selection-start="1234" selection-end="1234" vertical-scroll-proportion="0.31135225">
+        <state line="652" column="0" selection-start="23701" selection-end="23701" vertical-scroll-proportion="0.23970038">
           <folding />
         </state>
       </provider>
     </entry>
     <entry file="file://$PROJECT_DIR$/pom.xml">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="3" column="0" selection-start="250" selection-end="250" vertical-scroll-proportion="0.037562605">
+        <state line="23" column="0" selection-start="768" selection-end="768" vertical-scroll-proportion="0.28797996">
           <folding />
         </state>
       </provider>
Add a comment to this file

lib/build/javassist.jar

Binary file modified.

         <dependency>
             <groupId>org.easymock</groupId>
             <artifactId>easymock</artifactId>
-            <version>2.2</version>
+            <version>2.3</version>
             <scope>test</scope>
         </dependency>
         <dependency>

src/java/ognl/ASTChain.java

             {
                 for(int i = 0; i < _children.length; i++)
                 {
-                    /* System.out.println("astchain child: " + _children[i].getClass().getName()
+                   /* System.out.println("astchain child: " + _children[i].getClass().getName()
                                        + " with current object target " + context.getCurrentObject()
-                                       + " current type: " + context.getCurrentType()); */
+                                       + " current type: " + context.getCurrentType());*/
 
                     String value = _children[i].toGetSourceString(context, context.getCurrentObject());
 
         if (prevChain != null)
             throw new UnsupportedCompilationException("Can't compile nested chain expressions.");
 
-        if (target != null) {
+        if (target != null)
+        {
             context.setCurrentObject(target);
             context.setCurrentType(target.getClass());
         }
         NodeType _lastType = null;
         boolean constructor = false;
         try {
-            if ((_children != null) && (_children.length > 0)) {
-                for(int i = 0; i < _children.length; i++) {
-                    // System.out.println("astchain setsource child : " + _children[i].getClass().getName());
+            if ((_children != null) && (_children.length > 0))
+            {
+                if (ASTConst.class.isInstance(_children[0]))
+                {
+                    throw new UnsupportedCompilationException("Can't modify constant values.");
+                }
+                
+                for(int i = 0; i < _children.length; i++)
+                {
+                    //System.out.println("astchain setsource child[" + i + "] : " + _children[i].getClass().getName());
 
-                    if (i == (_children.length -1)) {
-
+                    if (i == (_children.length -1))
+                    {
                         context.put("_lastChild", "true");
                     }
 

src/java/ognl/ASTConst.java

 {
 
     private Object value;
-    
+
     private Class _getterClass;
-    
+
     public ASTConst(int id)
     {
         super(id);
     {
         this.value = value;
     }
-    
+
     public Object getValue()
     {
         return value;
     }
 
     protected Object getValueBody(OgnlContext context, Object source)
-        throws OgnlException
+            throws OgnlException
     {
         return this.value;
     }
 
     public boolean isNodeConstant(OgnlContext context)
-        throws OgnlException
+            throws OgnlException
     {
         return true;
     }
-    
+
     public Class getGetterClass()
     {
         if (_getterClass == null)
             return null;
-        
+
         return _getterClass;
     }
-    
+
     public Class getSetterClass()
     {
         return null;
     }
-    
+
     public String toString()
     {
         String result;
 
-        if (value == null) {
+        if (value == null)
+        {
             result = "null";
-        } else {
-            if (value instanceof String) {
+        } else
+        {
+            if (value instanceof String)
+            {
                 result = '\"' + OgnlOps.getEscapeString(value.toString()) + '\"';
             } else {
-                if (value instanceof Character) {
+                if (value instanceof Character)
+                {
                     result = '\'' + OgnlOps.getEscapedChar(((Character) value).charValue()) + '\'';
-                } else {
+                } else
+                {
                     result = value.toString();
-                    if (value instanceof Long) {
+
+                    if (value instanceof Long)
+                    {
                         result = result + "L";
-                    } else {
-                        if (value instanceof BigDecimal) {
+                    } else
+                    {
+                        if (value instanceof BigDecimal)
+                        {
                             result = result + "B";
-                        } else {
-                            if (value instanceof BigInteger) {
+                        } else
+                        {
+                            if (value instanceof BigInteger)
+                            {
                                 result = result + "H";
-                            } else {
-                                if (value instanceof Node) {
+                            } else
+                            {
+                                if (value instanceof Node)
+                                {
                                     result = ":[ " + result + " ]";
                                 }
                             }
         }
         return result;
     }
-    
+
     public String toGetSourceString(OgnlContext context, Object target)
     {
         if (value == null && _parent != null && ExpressionNode.class.isInstance(_parent))
             context.setCurrentType(null);
             return "";
         }
-        
+
         _getterClass = value.getClass();
 
         Object retval = value;
-        if (_parent != null && ASTProperty.class.isInstance(_parent)) {
-            
+        if (_parent != null && ASTProperty.class.isInstance(_parent))
+        {
             context.setCurrentObject(value);
 
             return value.toString();
-        } else if (value != null && Number.class.isAssignableFrom(value.getClass())) {
-
+        } else 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
-                && NumericExpression.class.isAssignableFrom(_parent.getClass()))
-                && String.class.isAssignableFrom(value.getClass())) {
-
+                     && NumericExpression.class.isAssignableFrom(_parent.getClass()))
+                   && String.class.isAssignableFrom(value.getClass()))
+        {
             context.setCurrentType(String.class);
 
             retval = '\"' + OgnlOps.getEscapeString(value.toString()) + '\"';
-           
+
             context.setCurrentObject(retval.toString());
 
             return retval.toString();
-        } else if (Character.class.isInstance(value)) {
-
+        } else if (Character.class.isInstance(value))
+        {
             Character val = (Character)value;
 
             context.setCurrentType(Character.class);
 
             if (Character.isLetterOrDigit(val.charValue()))
-               retval = "'" + ((Character) value).charValue() + "'";
+                retval = "'" + ((Character) value).charValue() + "'";
             else
                 retval = "'" + OgnlOps.getEscapedChar(((Character) value).charValue()) + "'";
 
             return retval.toString();
         }
 
-        if (Boolean.class.isAssignableFrom(value.getClass())) {
+        if (Boolean.class.isAssignableFrom(value.getClass()))
+        {
             _getterClass = Boolean.TYPE;
 
             context.setCurrentType(Boolean.TYPE);
 
         return value.toString();
     }
+
+    public String toSetSourceString(OgnlContext context, Object target)
+    {
+        return toGetSourceString(context, target);
+    }
 }

src/java/ognl/ASTMethod.java

     }
 
     protected Object getValueBody(OgnlContext context, Object source)
-    throws OgnlException
+            throws OgnlException
     {
         Object[] args = OgnlRuntime.getObjectArrayPool().create(jjtGetNumChildren());
 
             for(int i = 0, icount = args.length; i < icount; ++i) {
                 args[i] = _children[i].getValue(context, root);
             }
-            
+
             result = OgnlRuntime.callMethod(context, source, _methodName, args);
-            
+
             if (result == null)
             {
                 NullHandler nh = OgnlRuntime.getNullHandler(OgnlRuntime.getTargetClass(source));
             }
 
             return result;
-            
+
         } finally {
             OgnlRuntime.getObjectArrayPool().recycle(args);
         }
 
     public String toGetSourceString(OgnlContext context, Object target)
     {
-      /*  System.out.println("methodName is " + _methodName + " for target " + target + " target class: " + (target != null ? target.getClass() : null)
-                           + " current type: " + context.getCurrentType());*/
+        /*  System.out.println("methodName is " + _methodName + " for target " + target + " target class: " + (target != null ? target.getClass() : null)
+  + " current type: " + context.getCurrentType());*/
         if (target == null)
             throw new UnsupportedCompilationException("Target object is null.");
 
         String post = "";
         String result = null;
         Method m = null;
-        
+
         try {
 
             m = OgnlRuntime.getMethod(context, context.getCurrentType() != null ? context.getCurrentType() : target.getClass(), _methodName, _children, false);
             if (m == null)
                 m = OgnlRuntime.getReadMethod(target.getClass(), _methodName, _children != null ? _children.length : -1);
-            
+
             if (m == null) {
                 m = OgnlRuntime.getWriteMethod(target.getClass(), _methodName, _children != null ? _children.length : -1);
 
                 if (m != null) {
-                    
+
                     context.setCurrentType(m.getReturnType());
                     context.setCurrentAccessor(OgnlRuntime.getCompiler().getSuperOrInterfaceClass(m, m.getDeclaringClass()));
-                    
+
                     _coreExpression = toSetSourceString(context, target);
                     if (_coreExpression == null || _coreExpression.length() < 1)
                         throw new UnsupportedCompilationException("can't find suitable getter method");
-                    
+
                     _coreExpression +=  ";";
                     _lastExpression = "null";
-                    
+
                     return _coreExpression;
                 }
-                
+
                 return "";
             } else {
-                
+
                 _getterClass = m.getReturnType();
             }
 
             // TODO:  This is a hacky workaround until javassist supports varargs method invocations
-            
+
             boolean varArgs = OgnlRuntime.isJdk15() && m.isVarArgs();
 
             if (varArgs)
             }
 
             result = "." + m.getName() + "(";
-            
+
             if ((_children != null) && (_children.length > 0))
-            {    
+            {
                 Class[] parms = m.getParameterTypes();
                 String prevCast = (String)context.remove(ExpressionCompiler.PRE_CAST);
 /*
 
                     Object value = _children[i].getValue(context, context.getRoot());
                     String parmString = _children[i].toGetSourceString(context, context.getRoot());
-                    
+
                     if (parmString == null || parmString.trim().length() < 1)
                         parmString = "null";
 
                     // to undo type setting of constants when used as method parameters
                     if (ASTConst.class.isInstance(_children[i]))
-                    {    
+                    {
                         context.setCurrentType(prevType);
                     }
 
                     }
                     if (cast == null)
                         cast = "";
-                    
+
                     if (!ASTConst.class.isInstance(_children[i]))
                         parmString = cast + parmString;
-                    
+
                     Class valueClass = value != null ? value.getClass() : null;
                     if (NodeType.class.isAssignableFrom(_children[i].getClass()))
                         valueClass = ((NodeType)_children[i]).getGetterClass();
                         if (parms[i].isArray()) {
 
                             parmString = OgnlRuntime.getCompiler().createLocalReference(context,
-                                    "(" + ExpressionCompiler.getCastString(parms[i])
-                                    + ")ognl.OgnlOps#toArray(" + parmString + ", " + parms[i].getComponentType().getName()
-                                    + ".class, true)",
-                                    parms[i]
+                                                                                        "(" + ExpressionCompiler.getCastString(parms[i])
+                                                                                        + ")ognl.OgnlOps#toArray(" + parmString + ", " + parms[i].getComponentType().getName()
+                                                                                        + ".class, true)",
+                                                                                        parms[i]
                             );
-                            
+
                         } else  if (parms[i].isPrimitive()) {
-                            
+
                             Class wrapClass = OgnlRuntime.getPrimitiveWrapperClass(parms[i]);
-                            
+
                             parmString = OgnlRuntime.getCompiler().createLocalReference(context,
-                                    "((" + wrapClass.getName()
-                                    + ")ognl.OgnlOps#convertValue(" + parmString + ","
-                                    + wrapClass.getName() + ".class, true))."
-                                    + OgnlRuntime.getNumericValueGetter(wrapClass),
-                                    parms[i]
+                                                                                        "((" + wrapClass.getName()
+                                                                                        + ")ognl.OgnlOps#convertValue(" + parmString + ","
+                                                                                        + wrapClass.getName() + ".class, true))."
+                                                                                        + OgnlRuntime.getNumericValueGetter(wrapClass),
+                                                                                        parms[i]
                             );
 
                         } else if (parms[i] != Object.class) {
                             parmString = OgnlRuntime.getCompiler().createLocalReference(context,
-                                    "(" + parms[i].getName() + ")ognl.OgnlOps#convertValue(" + parmString + "," + parms[i].getName() + ".class)",
-                                    parms[i]
+                                                                                        "(" + parms[i].getName() + ")ognl.OgnlOps#convertValue(" + parmString + "," + parms[i].getName() + ".class)",
+                                                                                        parms[i]
                             );
                         } else if ((NodeType.class.isInstance(_children[i])
-                                && ((NodeType)_children[i]).getGetterClass() != null 
-                                && Number.class.isAssignableFrom(((NodeType)_children[i]).getGetterClass()))
-                                || (valueClass != null && valueClass.isPrimitive()))
+                                    && ((NodeType)_children[i]).getGetterClass() != null
+                                    && Number.class.isAssignableFrom(((NodeType)_children[i]).getGetterClass()))
+                                   || (valueClass != null && valueClass.isPrimitive()))
                         {
                             parmString = " ($w) " + parmString;
                         } else if (valueClass != null && valueClass.isPrimitive())
                             parmString = "($w) " + parmString;
                         }
                     }
-                    
+
                     result += parmString;
                 }
 
                 if (prevCast != null)
-                {    
+                {
                     context.put(ExpressionCompiler.PRE_CAST, prevCast);
                 }
             }
-            
+
         } catch (Throwable t)
         {
             throw OgnlOps.castToRuntime(t);
         try
         {
             Object contextObj = getValueBody(context, target);
-            context.setCurrentObject(contextObj);    
+            context.setCurrentObject(contextObj);
         } catch (Throwable t)
         {
             throw OgnlOps.castToRuntime(t);
 
     public String toSetSourceString(OgnlContext context, Object target)
     {
-        Method m = OgnlRuntime.getWriteMethod(context.getCurrentType() != null ? context.getCurrentType() : target.getClass(), _methodName, _children != null ? _children.length : -1);
-        if (m == null) {
+        //System.out.println("current type: " + context.getCurrentType() + " target:" + target + " " + context.getCurrentObject());
+        Method m = OgnlRuntime.getWriteMethod(context.getCurrentType() != null ?
+                context.getCurrentType() : target.getClass(),
+                                              _methodName, _children != null ? _children.length : -1);
+        if (m == null)
+        {
             return "";
         }
 
         String post = "";
         String result = "." + m.getName() + "(";
-        
+
         if (m.getReturnType() != void.class && m.getReturnType().isPrimitive()
-                && (_parent == null || !ASTTest.class.isInstance(_parent)))
-        {    
+            && (_parent == null || !ASTTest.class.isInstance(_parent)))
+        {
             Class wrapper = OgnlRuntime.getPrimitiveWrapperClass(m.getReturnType());
-            
+
             ExpressionCompiler.addCastString(context, "new " + wrapper.getName() + "(");
             post = ")";
             _getterClass = wrapper;
 
         try {
 
-            if ((_children != null) && (_children.length > 0)) {
-
+            if ((_children != null) && (_children.length > 0))
+            {
                 Class[] parms = m.getParameterTypes();
                 String prevCast = (String)context.remove(ExpressionCompiler.PRE_CAST);
-                
-                for(int i = 0; i < _children.length; i++) {
 
+                for(int i = 0; i < _children.length; i++)
+                {
                     if (i > 0)
                     {
                         result += ", ";
                     if (context.getCurrentType() == Void.TYPE || context.getCurrentType() == void.class)
                         throw new UnsupportedCompilationException("Method argument can't be a void type.");
 
-                    if (parmString == null || parmString.trim().length() < 1) {
+                    if (parmString == null || parmString.trim().length() < 1)
+                    {
+                        if (ASTProperty.class.isInstance(_children[i]) || ASTMethod.class.isInstance(_children[i])
+                            || ASTStaticMethod.class.isInstance(_children[i]) || ASTChain.class.isInstance(_children[i]))
+                            throw new UnsupportedCompilationException("ASTMethod setter child returned null from a sub property expression.");
 
-                        if (ASTProperty.class.isInstance(_children[i]) || ASTMethod.class.isInstance(_children[i])
-                                || ASTStaticMethod.class.isInstance(_children[i]) || ASTChain.class.isInstance(_children[i]))
-                            throw new UnsupportedCompilationException("ASTMethod setter child returned null from a sub property expression.");
-                        
                         parmString = "null";
                     }
 
                     // to undo type setting of constants when used as method parameters
-                    if (ASTConst.class.isInstance(_children[i])) {
-
+                    if (ASTConst.class.isInstance(_children[i]))
+                    {
                         context.setCurrentType(prevType);
                     }
 
                     parmString = ExpressionCompiler.getRootExpression(_children[i], context.getRoot(), context) + parmString;
 
                     String cast = "";
-                    if (ExpressionCompiler.shouldCast(_children[i])) {
-
+                    if (ExpressionCompiler.shouldCast(_children[i]))
+                    {
                         cast = (String)context.remove(ExpressionCompiler.PRE_CAST);
                     }
+
                     if (cast == null)
                         cast = "";
-                    
+
                     parmString = cast + parmString;
 
                     Class valueClass = value != null ? value.getClass() : null;
                     if (NodeType.class.isAssignableFrom(_children[i].getClass()))
                         valueClass = ((NodeType)_children[i]).getGetterClass();
-                    
-                    if (valueClass != parms[i]) {
-                        
-                        if (parms[i].isArray()) {
+
+                    if (valueClass != parms[i])
+                    {
+                        if (parms[i].isArray())
+                        {
+                            parmString = OgnlRuntime.getCompiler().createLocalReference(context,
+                                                                                        "(" + ExpressionCompiler.getCastString(parms[i])
+                                                                                        + ")ognl.OgnlOps#toArray(" + parmString + ", "
+                                                                                        + parms[i].getComponentType().getName()
+                                                                                        + ".class)",
+                                                                                        parms[i]
+                            );
+
+                        } else  if (parms[i].isPrimitive())
+                        {
+                            Class wrapClass = OgnlRuntime.getPrimitiveWrapperClass(parms[i]);
 
                             parmString = OgnlRuntime.getCompiler().createLocalReference(context,
-                                    "(" + ExpressionCompiler.getCastString(parms[i])
-                                    + ")ognl.OgnlOps#toArray(" + parmString + ", " + parms[i].getComponentType().getName()
-                                    + ".class)",
-                                    parms[i]
+                                                                                        "((" + wrapClass.getName()
+                                                                                        + ")ognl.OgnlOps#convertValue(" + parmString + ","
+                                                                                        + wrapClass.getName() + ".class, true))."
+                                                                                        + OgnlRuntime.getNumericValueGetter(wrapClass),
+                                                                                        parms[i]
                             );
 
-                        } else  if (parms[i].isPrimitive()) {
-                            
-                            Class wrapClass = OgnlRuntime.getPrimitiveWrapperClass(parms[i]);
-                            
+                        } else if (parms[i] != Object.class)
+                        {
                             parmString = OgnlRuntime.getCompiler().createLocalReference(context,
-                                    "((" + wrapClass.getName()
-                                    + ")ognl.OgnlOps#convertValue(" + parmString + ","
-                                    + wrapClass.getName() + ".class, true))."
-                                    + OgnlRuntime.getNumericValueGetter(wrapClass),
-                                    parms[i]
+                                                                                        "(" + parms[i].getName() + ")ognl.OgnlOps#convertValue("
+                                                                                        + parmString + "," + parms[i].getName() + ".class)",
+                                                                                        parms[i]
                             );
-                            
-                        } else if (parms[i] != Object.class) {
 
-                            parmString = OgnlRuntime.getCompiler().createLocalReference(context,
-                                    "(" + parms[i].getName() + ")ognl.OgnlOps#convertValue(" + parmString + "," + parms[i].getName() + ".class)",
-                                    parms[i]
-                            );
-                            
                         } else if ((NodeType.class.isInstance(_children[i])
-                                && ((NodeType)_children[i]).getGetterClass() != null
-                                && Number.class.isAssignableFrom(((NodeType)_children[i]).getGetterClass()))
-                                || (valueClass != null && valueClass.isPrimitive()))
+                                    && ((NodeType)_children[i]).getGetterClass() != null
+                                    && Number.class.isAssignableFrom(((NodeType)_children[i]).getGetterClass()))
+                                   || (valueClass != null && valueClass.isPrimitive()))
                         {
                             parmString = " ($w) " + parmString;
-                        } else if (valueClass != null && valueClass.isPrimitive()) 
+                        } else if (valueClass != null && valueClass.isPrimitive())
                         {
                             parmString = "($w) " + parmString;
                         }
                     }
-                    
+
                     result += parmString;
                 }
 
                     context.put(ExpressionCompiler.PRE_CAST, prevCast);
                 }
             }
-            
+
         } catch (Throwable t)
         {
             throw OgnlOps.castToRuntime(t);
         }
 
-        try {
-
+        try
+        {
             Object contextObj = getValueBody(context, target);
             context.setCurrentObject(contextObj);
-
-        } catch (Throwable t) {
+        } catch (Throwable t)
+        {
             // ignore
         }
 
         context.setCurrentType(m.getReturnType());
         context.setCurrentAccessor(OgnlRuntime.getCompiler().getSuperOrInterfaceClass(m, m.getDeclaringClass()));
-        
+
         return result + ")" + post;
     }
 }

src/java/ognl/ASTProperty.java

         if (context.getCurrentObject() == null)
             throw new UnsupportedCompilationException("Current target is null.");
 
-        //System.out.println("astproperty(setter) is indexed? : " + isIndexedAccess() + " child: " + _children[0].getClass().getName()
-        //      + " target: " + target.getClass().getName());
+//        System.out.println("astproperty(setter) is indexed? : " + isIndexedAccess() + " child: " + _children[0].getClass().getName()
+//              + " target: " + target.getClass().getName());
 
         try {
 
-            if (isIndexedAccess()) {
-
+            if (isIndexedAccess())
+            {
                 //System.out.println("ast set source property is indexed");
 
                 Object value = _children[0].getValue(context, context.getRoot());
 
                 srcString = ExpressionCompiler.getRootExpression(_children[0], context.getRoot(), context) + srcString;
 
-                if (!ASTConst.class.isInstance(_children[0])) {
+                if (!ASTConst.class.isInstance(_children[0]))
+                {
                     String cast = (String)context.remove(ExpressionCompiler.PRE_CAST);
                     if (cast != null)
                         srcString = cast + srcString;
                 }
 
-                if (ASTConst.class.isInstance(_children[0]) && String.class.isInstance(context.getCurrentObject())) {
+                if (ASTConst.class.isInstance(_children[0]) && String.class.isInstance(context.getCurrentObject()))
+                {
                     srcString = "\"" + srcString + "\"";
                 }
 
                 //System.out.println("astproperty setter using indexed value " + value + " and srcString: " + srcString);
 
-                if (context.get("_indexedMethod") != null) {
-
+                if (context.get("_indexedMethod") != null)
+                {
                     m = (Method)context.remove("_indexedMethod");
 
                     _setterClass = m.getParameterTypes()[0];
                     context.setCurrentObject(target);
 
                     return m.getName() + "(" + srcString + ")";
-                } else {
+                } else
+                {
                     PropertyAccessor p = OgnlRuntime.getPropertyAccessor(target.getClass());
 
                     if (ASTConst.class.isInstance(_children[0]) && Number.class.isInstance(context.getCurrentObject()))
+                    {
                         context.setCurrentType(OgnlRuntime.getPrimitiveWrapperClass(context.getCurrentObject().getClass()));
+                    }
 
                     result = p.getSourceSetter(context, target, srcString);
 

src/java/ognl/ArrayPropertyAccessor.java

         {
             Class wrapClass = OgnlRuntime.getPrimitiveWrapperClass(type);
             
-            return "[" + indexStr + "]=((" + wrapClass.getName() + ")ognl.OgnlOps.convertValue($3," + wrapClass.getName()
+            return  "[" + indexStr + "]=((" + wrapClass.getName() + ")ognl.OgnlOps.convertValue($3," + wrapClass.getName()
                    + ".class, true))." + OgnlRuntime.getNumericValueGetter(wrapClass);
         } else
         {

src/java/ognl/OgnlContext.java

     public void setRoot(Object value)
     {
         _root = value;
+        _accessorStack.clear();
+        _typeStack.clear();
+        _currentObject = value;
+
+        if (_currentObject != null)
+        {
+            setCurrentType(_currentObject.getClass());
+        }
     }
 
     public Object getRoot()

src/java/ognl/enhance/ExpressionCompiler.java

     {
         if (type == null)
             return null;
-
+        
         return type.isArray() ? type.getComponentType().getName() + "[]" : type.getName();
     }
 
              && root != null) || (root != null && ASTRootVarRef.class.isInstance(expression))) {
 
             Class castClass = OgnlRuntime.getCompiler().getRootExpressionClass(expression, context);
-
+            
             if (castClass.isArray() || ASTRootVarRef.class.isInstance(expression)
                 || ASTThisVarRef.class.isInstance(expression))
             {
         Class ret = context.getRoot().getClass();
 
         if (context.getFirstAccessor() != null && context.getFirstAccessor().isInstance(context.getRoot()))
+        {
             ret = context.getFirstAccessor();
+        }
 
         return ret;
     }
                 newClass.addMethod(setExpression);
             }
         }
-
+        
         try {
 
             setBody = generateSetter(context, newClass, objClass, pool,  valueSetter, expression, root);
         String body;
 
         context.setRoot(root);
-        context.setCurrentObject(root);
 
         // the ExpressionAccessor API has to reference the generic Object class for get/set operations, so this sets up that known
         // type beforehand
             throw new UnsupportedCompilationException("Can't compile expression/constant setters.");
 
         context.setRoot(root);
-        context.setCurrentObject(root);
         context.remove(PRE_CAST);
 
         String body;

src/test/java/org/ognl/test/ASTPropertyTest.java

         context.setCurrentObject(root);
         context.setCurrentNode(pRef);
 
-        assertEquals(null, context.getCurrentType());
+        assertEquals(root.getClass(), context.getCurrentType());
         assertEquals(null, context.getPreviousType());
         assertEquals(root, context.getCurrentObject());
         assertEquals(null, context.getCurrentAccessor());
         int type = p.getIndexedPropertyType(context, root);
 
         assertEquals(OgnlRuntime.INDEXED_PROPERTY_NONE, type);
-        assertEquals(null, context.getCurrentType());
+        assertEquals(root.getClass(), context.getCurrentType());
         assertEquals(null, context.getPreviousType());
         assertEquals(null, context.getCurrentAccessor());
         assertEquals(null, context.getPreviousAccessor());
         context.setCurrentObject(root);
         context.setCurrentNode(pRef);
 
-        assertEquals(null, context.getCurrentType());
+        assertEquals(root.getClass(), context.getCurrentType());
         assertEquals(null, context.getPreviousType());
         assertEquals(root, context.getCurrentObject());
         assertEquals(null, context.getCurrentAccessor());
         Object value = p.getValue(context, root);
 
         assertEquals(root.get("nested"), value);
-        assertEquals(null, context.getCurrentType());
+        assertEquals(root.getClass(), context.getCurrentType());
         assertEquals(null, context.getPreviousType());
         assertEquals(null, context.getCurrentAccessor());
         assertEquals(null, context.getPreviousAccessor());
         assertEquals(".get(\"nested\")", p.toGetSourceString(context, root));
         assertEquals(Object.class, context.getCurrentType());
         assertEquals(Map.class, context.getCurrentAccessor());
-        assertEquals(null, context.getPreviousType());
+        assertEquals(root.getClass(), context.getPreviousType());
         assertEquals(null, context.getPreviousAccessor());
 
         assertEquals(root.get("nested"), context.getCurrentObject());
 
         assert Map.class.isAssignableFrom(context.getCurrentAccessor());
 
-        assertEquals(null, context.getPreviousType());
+        assertEquals(root.getClass(), context.getPreviousType());
         assertEquals(null, context.getPreviousAccessor());
     }
 
 
         assert Map.class.isAssignableFrom(context.getCurrentAccessor());
 
-        assertEquals(null, context.getPreviousType());
+        assertEquals(root.getClass(), context.getPreviousType());
         assertEquals(null, context.getPreviousAccessor());
     }
 
         assertEquals(List.class, context.getCurrentType());
         assertEquals(Root.class, context.getCurrentAccessor());
         assertEquals(null, context.getPreviousAccessor());
-        assertEquals(null, context.getPreviousType());
+        assertEquals(root.getClass(), context.getPreviousType());
         assertEquals(root.getList(), context.getCurrentObject());
 
-
         // re test with chain
         
         context = (OgnlContext) Ognl.createDefaultContext(null);

src/test/java/org/ognl/test/PropertySetterTest.java

+package org.ognl.test;
+
+import junit.framework.TestCase;
+import ognl.Node;
+import ognl.Ognl;
+import ognl.OgnlContext;
+
+import java.util.Map;
+
+/**
+ * Tests being able to set property on object with interface that doesn't define
+ * setter.   See OGNL-115.
+ */
+public class PropertySetterTest extends TestCase {
+
+    private Map map;
+    private TestObject testObject = new TestObject("propertyValue");
+    private String propertyKey = "property";
+
+    public interface TestInterface {
+        public String getProperty();
+    }
+
+    public class TestObject implements TestInterface {
+        
+        private String property;
+        private Integer integerProperty = 1;
+
+        public TestObject(String property) {
+            this.property = property;
+        }
+
+        public String getProperty() {
+            return property;
+        }
+
+        public void setProperty(String property) {
+            this.property = property;
+        }
+
+        public Integer getIntegerProperty() {
+            return integerProperty;
+        }
+    }
+
+
+    public Map getMap() {
+        return map;
+    }
+    public String getKey() {
+        return "key";
+    }
+
+    public TestObject getObject() {
+        return testObject;
+    }
+
+    public TestInterface getInterfaceObject() {
+        return testObject;
+    }
+
+    public String getPropertyKey() {
+        return propertyKey;
+    }
+
+    public void testEnhancedOgnl() throws Exception {
+        OgnlContext context = (OgnlContext)Ognl.createDefaultContext(null);
+        Node expression = Ognl.compileExpression(context, this, "interfaceObject.property");
+        Ognl.setValue(expression, context, this, "hello");
+        assertEquals("hello", getObject().getProperty() );
+
+        // Fails if an interface is defined, but succeeds if not
+        context.clear();
+
+        expression = Ognl.compileExpression(context, this.getObject(), "property");
+        Ognl.setValue(expression, context, this.getObject(), "hello");
+        assertEquals("hello", getObject().getProperty() );
+    }
+}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.