Commits

Anonymous committed 9da4897

OgnlRuntime was incorrectly returning false for shouldConvertNumericTypes when the values were primitives - probably a result of the astconst changes.

Comments (0)

Files changed (4)

     <option name="USER" value="" />
   </component>
   <component name="ChangeListManager">
-    <list default="true" name="Default" comment="" />
+    <list default="true" name="Default" comment="">
+      <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$/OGNL.iws" afterPath="$PROJECT_DIR$/OGNL.iws" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/java/ognl/OgnlRuntime.java" afterPath="$PROJECT_DIR$/src/java/ognl/OgnlRuntime.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/test/java/org/ognl/test/PropertyTest.java" afterPath="$PROJECT_DIR$/src/test/java/org/ognl/test/PropertyTest.java" />
+    </list>
   </component>
   <component name="ChangesViewManager" flattened_view="true" />
   <component name="CheckinPanelState" />
       <showLibraryContents />
       <hideEmptyPackages />
       <abbreviatePackageNames />
-      <showStructure PackagesPane="false" ProjectPane="false" Scope="false" Favorites="false" />
+      <showStructure Favorites="false" PackagesPane="false" Scope="false" ProjectPane="false" />
       <autoscrollToSource />
       <autoscrollFromSource />
       <sortByType />
     <property name="cvs_file_history_treeWidth0" value="464" />
     <property name="cvs_file_history_treeWidth1" value="464" />
     <property name="cvs_file_history_treeWidth2" value="464" />
+    <property name="cvs_file_history_treeWidth3" value="464" />
     <property name="cvs_file_history_flatWidth2" value="464" />
-    <property name="cvs_file_history_treeWidth3" value="464" />
+    <property name="cvs_file_history_treeOrder0" value="0" />
     <property name="cvs_file_history_flatWidth3" value="464" />
-    <property name="cvs_file_history_treeOrder0" value="0" />
     <property name="MemberChooser.showClasses" value="true" />
     <property name="cvs_file_history_flatWidth0" value="464" />
     <property name="cvs_file_history_flatWidth1" value="464" />
   </component>
   <component name="RecentsManager" />
   <component name="RestoreUpdateTree" />
-  <component name="RunManager" selected="JUnit.ArithmeticAndLogicalOperatorsTest">
-    <tempConfiguration default="false" name="ArithmeticAndLogicalOperatorsTest" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
+  <component name="RunManager" selected="JUnit.PropertyTest">
+    <tempConfiguration default="false" name="PropertyTest" 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" />
       <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.PropertyTest" />
       <option name="METHOD_NAME" />
       <option name="TEST_OBJECT" value="class" />
       <option name="VM_PARAMETERS" />
         <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 default="true" type="TestNG" factoryName="TestNG" enabled="false" merge="false">
+      <module name="" />
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+      <option name="ALTERNATIVE_JRE_PATH" value="" />
+      <option name="SUITE_NAME" value="" />
+      <option name="PACKAGE_NAME" />
+      <option name="MAIN_CLASS_NAME" value="" />
+      <option name="METHOD_NAME" />
+      <option name="GROUP_NAME" value="" />
+      <option name="TEST_OBJECT" value="CLASS" />
+      <option name="VM_PARAMETERS" value="" />
+      <option name="PARAMETERS" value="" />
+      <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/build" />
+      <option name="OUTPUT_DIRECTORY" value="" />
+      <option name="ADDITIONAL_CLASS_PATH" />
+      <option name="TEST_SEARCH_SCOPE">
+        <value defaultName="singleModule" />
+      </option>
+      <option name="PROPERTIES_FILE" value="" />
+      <properties />
+      <method>
+        <option name="Make" value="true" />
+      </method>
     </configuration>
     <configuration default="true" type="Applet" factoryName="Applet">
       <module name="" />
       <option name="ENABLE_SWING_INSPECTOR" value="false" />
       <module name="" />
     </configuration>
-    <configuration default="true" type="TestNG" factoryName="TestNG" enabled="false" merge="false">
-      <module name="" />
-      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
-      <option name="ALTERNATIVE_JRE_PATH" value="" />
-      <option name="SUITE_NAME" value="" />
-      <option name="PACKAGE_NAME" />
-      <option name="MAIN_CLASS_NAME" value="" />
-      <option name="METHOD_NAME" />
-      <option name="GROUP_NAME" value="" />
-      <option name="TEST_OBJECT" value="CLASS" />
-      <option name="VM_PARAMETERS" value="" />
-      <option name="PARAMETERS" value="" />
-      <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/build" />
-      <option name="OUTPUT_DIRECTORY" value="" />
-      <option name="ADDITIONAL_CLASS_PATH" />
-      <option name="TEST_SEARCH_SCOPE">
-        <value defaultName="singleModule" />
-      </option>
-      <option name="PROPERTIES_FILE" value="" />
-      <properties />
-      <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>
     <configuration default="true" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
       <module name="" />
     </todo-panel>
   </component>
   <component name="ToolWindowManager">
-    <frame x="115" y="145" width="2112" height="1362" extended-state="0" />
+    <frame x="109" y="154" width="2112" height="1362" extended-state="0" />
     <editor active="false" />
     <layout>
       <window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" 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="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
       <window_info id="File View" 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.22103213" order="0" />
+      <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.22346641" order="0" />
       <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.4" order="6" />
       <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25975105" order="2" />
     <option name="PERFORM_COMMIT_IN_BACKGROUND" value="false" />
     <option name="PUT_FOCUS_INTO_COMMENT" value="false" />
     <option name="FORCE_NON_EMPTY_COMMENT" value="false" />
-    <option name="LAST_COMMIT_MESSAGE" value="Fixes OGNL-14 &amp;&amp; OGNL-16. &#10;&#10;OgnlRuntime.getChildSource was still using the old non &quot;($w)&quot; widening casting semantics provided by javassist." />
+    <option name="LAST_COMMIT_MESSAGE" value="OgnlRuntime was incorrectly returning false for shouldConvertNumericTypes when the values were primitives - probably a result of the astconst changes." />
     <option name="SAVE_LAST_COMMIT_MESSAGE" value="true" />
     <option name="CHECKIN_DIALOG_SPLITTER_PROPORTION" value="0.8" />
     <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
     <option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
     <option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
     <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
-    <MESSAGE value="Added another static reference test for OGNL-12. Wasn't able to re-produce but will keep the test anyways &quot;just in case&quot;." />
-    <MESSAGE value="FIxes OGNL-12 as I was able to find a failure when static methods / fields are involved." />
     <MESSAGE value="Ahemm......Let's try this one last time..." />
     <MESSAGE value="F#@$#$1! ...........Static references had bug in ASTChain with setting the special &quot;noRoot&quot; flag (hack) on static fields when the astchain was contained by another expression." />
     <MESSAGE value="ASTMethods weren't handling the case where a parameter value might be a literal &quot;null&quot; when handing objects off for conversion to OgnlOps.covnertValue." />
     <MESSAGE value="Fixes OGNL-17. ...Too much to list, the summary is that ASTCtor / ASTList hadn't had the same kind of context/ refactoring love &#10;that ASTMethod/ property/ etc had ...." />
     <MESSAGE value="Fixes OGNL-18.&#10;&#10;Array/List/etc accessors weren't properly detecting object vs primitive types when accessing their respective properties because ASTConst was still sticking the old object class type as the current context type. This involved refactoring ASTConst to correctly place the native type for numerics as well as fixing all the problems resulting from this new behavior." />
     <MESSAGE value="Fixes OGNL-14 &amp;&amp; OGNL-16. &#10;&#10;OgnlRuntime.getChildSource was still using the old non &quot;($w)&quot; widening casting semantics provided by javassist." />
+    <MESSAGE value="Minor update?" />
+    <MESSAGE value="OgnlRuntime was incorrectly returning false for shouldConvertNumericTypes when the values were primitives - probably a result of the astconst changes." />
   </component>
   <component name="antWorkspaceConfiguration">
     <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
     <option name="myLastEditedConfigurable" />
   </component>
   <component name="editorHistoryManager">
-    <entry file="file://$PROJECT_DIR$/src/java/ognl/ASTRemainder.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="70" column="12" selection-start="2705" selection-end="2705" vertical-scroll-proportion="0.54332554">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/ArrayCreationTest.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="29" column="77" selection-start="1724" selection-end="1724" vertical-scroll-proportion="0.0">
-          <folding />
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$PROJECT_DIR$/src/java/ognl/ASTCtor.java">
       <provider selected="true" editor-type-id="text-editor">
         <state line="230" column="0" selection-start="8503" selection-end="8503" vertical-scroll-proportion="0.3483816">
         </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="46" column="0" selection-start="2165" selection-end="2165" vertical-scroll-proportion="0.13969335">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/objects/Root.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="236" column="39" selection-start="7087" selection-end="7108" vertical-scroll-proportion="0.4918033">
-          <folding />
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$PROJECT_DIR$/src/java/ognl/ASTEq.java">
       <provider selected="true" editor-type-id="text-editor">
         <state line="37" column="29" selection-start="1891" selection-end="1891" vertical-scroll-proportion="0.14051522">
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/java/ognl/ComparisonExpression.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="43" column="12" selection-start="1198" selection-end="1198" vertical-scroll-proportion="0.5093677">
-          <folding />
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$PROJECT_DIR$/src/java/ognl/ASTTest.java">
       <provider selected="true" editor-type-id="text-editor">
         <state line="87" column="24" selection-start="3576" selection-end="3576" vertical-scroll-proportion="0.795082">
         </state>
       </provider>
     </entry>
+    <entry file="file://$PROJECT_DIR$/src/java/ognl/ASTOr.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="109" column="12" selection-start="3945" selection-end="3945" vertical-scroll-proportion="0.35775128">
+          <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="42" column="4" selection-start="2004" selection-end="2004" vertical-scroll-proportion="0.11499148">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/java/ognl/ASTGreater.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="37" column="34" selection-start="1896" selection-end="1896" vertical-scroll-proportion="0.10221465">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/java/ognl/ComparisonExpression.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="48" column="54" selection-start="1498" selection-end="1498" vertical-scroll-proportion="0.5877342">
+          <folding />
+        </state>
+      </provider>
+    </entry>
     <entry file="file://$PROJECT_DIR$/src/java/ognl/OgnlRuntime.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="2204" column="0" selection-start="84050" selection-end="84050" vertical-scroll-proportion="0.73168653">
+        <state line="2151" column="92" selection-start="81560" selection-end="81560" vertical-scroll-proportion="0.2802385">
           <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="416" column="8" selection-start="15927" selection-end="15927" vertical-scroll-proportion="0.51107323">
+        <state line="381" column="10" selection-start="14574" selection-end="14574" vertical-scroll-proportion="0.3705281">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/objects/Root.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="208" column="21" selection-start="6674" selection-end="6674" vertical-scroll-proportion="0.34412265">
           <folding />
         </state>
       </provider>

src/java/ognl/OgnlRuntime.java

     {
         return context.getCurrentType() != null && !context.getCurrentType().isArray()
                 && context.getPreviousType() != null && !context.getPreviousType().isArray()
-                && !(context.getCurrentType().isPrimitive() && context.getPreviousType().isPrimitive())
                 && (!Number.class.isAssignableFrom(context.getCurrentType())
                 || !Number.class.isAssignableFrom(context.getPreviousType()));
 
 
             source = cast + source;
         }
-
+        
         if (source == null || source.trim().length() < 1)
             source = "null";
-        
+
         return source;
     }
 }

src/java/ognl/enhance/ExpressionCompiler.java

         
         body = body.replaceAll("\\.\\.", ".");
         
-        // System.out.println("Getter Body: ===================================\n"+body);
+        //System.out.println("Getter Body: ===================================\n"+body);
         valueGetter.setBody(body);
 
         newClass.addMethod(valueGetter);

src/test/java/org/ognl/test/PropertyTest.java

     /* { ROOT, "map.(array[2] + size()).doubleValue()", new Double(ROOT.getArray()[2] + ROOT.getMap().size()) }, */
 
     private static Object[][]       TESTS = {
+            { ROOT, "objectIndex > 0", Boolean.TRUE},
             { ROOT, "false", Boolean.FALSE},
             { ROOT, "map", ROOT.getMap() },
             { ROOT, "map.test", ROOT },
             { ROOT.getMap(), "\"Tapestry\".toCharArray()[2]", new Character('p')},
             { ROOT.getMap(), "nested.deep.last", Boolean.TRUE},
             { ROOT, "'last ' + getCurrentClass(@org.ognl.test.PropertyTest@VALUE)", "last foo stop"},
-            { ROOT, "@org.ognl.test.PropertyTest@formatValue(property.millis, true, true)", formatValue((int)((Bean2)ROOT.getProperty()).getMillis(), true, true) } 
+            { ROOT, "@org.ognl.test.PropertyTest@formatValue(property.millis, true, true)", formatValue((int)((Bean2)ROOT.getProperty()).getMillis(), true, true) }
     };
     
     public static String formatValue(int millis, boolean b1, boolean b2)