Commits

Anonymous committed 25b7147

Fixes OGNL-47 and possibly all enum related bugs. We'll see.

Comments (0)

Files changed (8)

   </component>
   <component name="ChangeListManager">
     <list default="true" name="Default" comment="">
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/java/ognl/ASTStaticMethod.java" afterPath="$PROJECT_DIR$/src/java/ognl/ASTStaticMethod.java" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/test/java/org/ognl/test/objects/SimpleEnum.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/test/java/org/ognl/test/objects/Simple.java" afterPath="$PROJECT_DIR$/src/test/java/org/ognl/test/objects/Simple.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/test/java/org/ognl/test/MethodTest.java" afterPath="$PROJECT_DIR$/src/test/java/org/ognl/test/MethodTest.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/java/ognl/ASTStaticField.java" afterPath="$PROJECT_DIR$/src/java/ognl/ASTStaticField.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/ASTMethod.java" afterPath="$PROJECT_DIR$/src/java/ognl/ASTMethod.java" />
     </list>
   </component>
   <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
     <option name="showLabels" value="true" />
   </component>
   <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.StaticsAndConstructorsTest">
+    <tempConfiguration default="false" name="StaticsAndConstructorsTest" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
       <pattern value="org.ognl.test.*" />
       <module name="OGNL" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
       <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.StaticsAndConstructorsTest" />
       <option name="METHOD_NAME" value="" />
       <option name="TEST_OBJECT" value="class" />
       <option name="VM_PARAMETERS" value="" />
       <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32761437" order="1" />
       <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.2755187" order="3" />
       <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.2381716" order="8" />
-      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.2213312" order="8" />
+      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.26595744" 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.24975657" order="1" />
       <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" 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.3488372" order="6" />
       <window_info id="Duplicates" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
-      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.2651391" order="2" />
+      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.2749591" order="2" />
       <window_info id="Regex" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32924837" order="8" />
       <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="Maven" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
     <option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
     <option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
     <option name="FORCE_NON_EMPTY_COMMENT" value="false" />
-    <option name="LAST_COMMIT_MESSAGE" value="Resolves OGNL-70. Don't know why it doesn't like dividing by zero..sheesh." />
+    <option name="LAST_COMMIT_MESSAGE" value="Fixes OGNL-47 and possibly all enum related bugs. We'll see." />
     <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
     <option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
     <option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
     <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="Resolves OGNL-43. ASTAnd was incorrectly casting to a boolean expression when language grammar states &amp;&amp; expressions return value of second expression - not just boolean." />
     <MESSAGE value="Fixes OGNL-44. ASTAdd wasn't checking for property/var references before expanding value via native conversion methods." />
     <MESSAGE value="Code cleanup , new test for bug in javassist." />
     <MESSAGE value="Fixes regression of string concatenations in OGNL-48." />
     <MESSAGE value="Fixes weird condition where some kind of JBoss classloader monkeybusiness causes not found classes to not throw ClassNotFoundException. Fixes OGNL-13." />
     <MESSAGE value="Added new test for OGNL-66 which was un-reproducable." />
     <MESSAGE value="Resolves OGNL-70. Don't know why it doesn't like dividing by zero..sheesh." />
+    <MESSAGE value="Fixes OGNL-47 and possibly all enum related bugs. We'll see." />
   </component>
   <component name="XPathView.XPathProjectComponent">
     <history />
     <option name="myLastEditedConfigurable" />
   </component>
   <component name="editorHistoryManager">
-    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/objects/Root.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="359" column="0" selection-start="9252" selection-end="9252" vertical-scroll-proportion="0.23519737">
-          <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="173" column="0" selection-start="9489" selection-end="9489" vertical-scroll-proportion="0.9259868">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$USERPROFILE$/projects/testng/build.xml">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="10" column="0" selection-start="520" selection-end="520" vertical-scroll-proportion="0.12489592">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/osbuild.xml">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="34" column="33" selection-start="1127" selection-end="1127" vertical-scroll-proportion="0.42464614">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/java/ognl/ognl.jj">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="852" column="1" selection-start="35307" selection-end="35307" vertical-scroll-proportion="0.5674342">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/java/ognl/ognl.jjt">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="209" column="9" selection-start="5726" selection-end="5731" vertical-scroll-proportion="0.33305922">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/build.xml">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="71" column="0" selection-start="2319" selection-end="2319" vertical-scroll-proportion="0.72522897">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/Performance.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="172" column="12" selection-start="7089" selection-end="7089" vertical-scroll-proportion="-0.22203948">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/java/ognl/MemberAccess.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="58" column="23" selection-start="2619" selection-end="2619" vertical-scroll-proportion="0.4783599">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="jar:///usr/local/jdk1.5.0_11/src.zip!/java/beans/Introspector.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="243" column="25" selection-start="9716" selection-end="9716" vertical-scroll-proportion="0.33257404">
-          <folding />
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$PROJECT_DIR$/src/test/java/ognl/TestOgnlRuntime.java">
       <provider selected="true" editor-type-id="text-editor">
         <state line="73" column="15" selection-start="2283" selection-end="2283" vertical-scroll-proportion="0.8149671">
         </state>
       </provider>
     </entry>
+    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/objects/Simple.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="194" column="0" selection-start="4686" selection-end="4686" vertical-scroll-proportion="1.0696576">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/java/ognl/ASTMethod.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="206" column="0" selection-start="7045" selection-end="7045" vertical-scroll-proportion="0.19457547">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/java/ognl/ASTChain.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="268" column="22" selection-start="11131" selection-end="11131" vertical-scroll-proportion="0.37382075">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/java/ognl/ASTStaticMethod.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="151" column="37" selection-start="5428" selection-end="5428" vertical-scroll-proportion="0.5660377">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/objects/SimpleEnum.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="21" column="0" selection-start="238" selection-end="238" vertical-scroll-proportion="0.37146226">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/MethodTest.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="39" column="0" selection-start="1916" selection-end="1916" vertical-scroll-proportion="0.11335012">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/StaticsAndConstructorsTest.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="41" column="0" selection-start="2043" selection-end="2043" vertical-scroll-proportion="0.14357683">
+          <folding>
+            <element signature="imports" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/java/ognl/ASTStaticField.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="184" column="29" selection-start="6096" selection-end="6096" vertical-scroll-proportion="0.88664985">
+          <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="472" column="10" selection-start="16732" selection-end="16732" vertical-scroll-proportion="0.5071369">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/OgnlTestCase.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="210" column="0" selection-start="7845" selection-end="7845" vertical-scroll-proportion="0.71032745">
+          <folding />
+        </state>
+      </provider>
+    </entry>
   </component>
   <component name="testng.defaultConfiguration">
     <outputDirectory />

src/java/ognl/ASTChain.java

                     
                     String value = _children[i].toGetSourceString(context, context.getCurrentObject());
                     
-                    // System.out.println("astchain child returned >>  " + value + "  <<");
+                    //System.out.println("astchain child returned >>  " + value + "  <<");
                     
                     if (ASTCtor.class.isInstance(_children[i]))
                         constructor = true;

src/java/ognl/ASTMethod.java

                     
                     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])) {
                         

src/java/ognl/ASTStaticField.java

             Object obj = OgnlRuntime.getStaticField(context, className, fieldName);
             
             context.setCurrentObject(obj);
-            
+
             _getterClass = getFieldClass(context);
-            
+
+            context.setCurrentType(_getterClass);
+
         } catch (Throwable t) { throw new RuntimeException(t); }
         
         return className + "." + fieldName;
             context.setCurrentObject(obj);
             
             _getterClass = getFieldClass(context);
-            
+
+            context.setCurrentType(_getterClass);
+
         } catch (Throwable t) { throw new RuntimeException(t); }
         
         return className + "." + fieldName;

src/java/ognl/ASTStaticMethod.java

 
     public String toGetSourceString(OgnlContext context, Object target)
     {
-        String result = _className + "." + _methodName + "(";
+        String result = _className + "#" + _methodName + "(";
 
         try {
             Class clazz = OgnlRuntime.classForName(context, _className);

src/test/java/org/ognl/test/MethodTest.java

             { "hashCode()", new Integer(ROOT.hashCode()) } ,
             { "getBooleanValue() ? \"here\" : \"\"", ""},
             { "getValueIsTrue(!false) ? \"\" : \"here\" ", ""},
-            { "messages.format('ShowAllCount', one)", "foo"}
+            { "messages.format('ShowAllCount', one)", "foo"},
+            { "getTestValue(@org.ognl.test.objects.SimpleEnum@ONE.value)", new Integer(2)}
     };
 
     /*

src/test/java/org/ognl/test/objects/Simple.java

         return 3;
     }
 
+    public int getTestValue(int val)
+    {
+        return val + 1;
+    }
+
     public boolean equals(Object other)
     {
         boolean     result = false;

src/test/java/org/ognl/test/objects/SimpleEnum.java

+package org.ognl.test.objects;
+
+/**
+ *
+ */
+public enum SimpleEnum {
+
+    ONE (1);
+
+    private int _value;
+
+    private SimpleEnum(int value)
+    {
+        _value = value;
+    }
+
+    public int getValue()
+    {
+        return _value;
+    }
+}
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.