Author: jkuhnert
Date: Sat Mar 24 20:32:18 2007
New Revision: 522152

URL: http://svn.apache.org/viewvc?view=rev&rev=522152
Log:
Fixes TAPESTRY-1374. 

Casting to class type on a generic type that wasn't an instanceof Class .

Modified:
    
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/GenericsMethodSignatureImpl.java
    
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/MethodSignatureTest.java
    tapestry/tapestry4/trunk/tapestry.iws

Modified: 
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/GenericsMethodSignatureImpl.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/GenericsMethodSignatureImpl.java?view=diff&rev=522152&r1=522151&r2=522152
==============================================================================
--- 
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/GenericsMethodSignatureImpl.java
 (original)
+++ 
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/GenericsMethodSignatureImpl.java
 Sat Mar 24 20:32:18 2007
@@ -70,7 +70,7 @@
     {
         for (int i = 0; i < types.length; i++) {
 
-            if (type.isAssignableFrom((Class)types[i]))
+            if (Class.class.isInstance(types[i]) && 
type.isAssignableFrom((Class)types[i]))
                 return (Class)types[i];
         }
 

Modified: 
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/MethodSignatureTest.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/MethodSignatureTest.java?view=diff&rev=522152&r1=522151&r2=522152
==============================================================================
--- 
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/MethodSignatureTest.java
 (original)
+++ 
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/MethodSignatureTest.java
 Sat Mar 24 20:32:18 2007
@@ -13,11 +13,12 @@
 // limitations under the License.
 package org.apache.tapestry.enhance;
 
-import java.util.Map;
-
+import com.javaforge.tapestry.testng.TestBase;
+import org.apache.tapestry.IPage;
 import org.testng.annotations.Test;
 
-import com.javaforge.tapestry.testng.TestBase;
+import java.lang.reflect.Method;
+import java.util.Map;
 
 
 /**
@@ -110,4 +111,31 @@
         assert child.equals(base);
         assert base.equals(child);
     }
+
+    public void test_Find_Type()
+    {
+        Class clazz=TestGeneric.class;
+        Method[] ms = clazz.getMethods();
+        
+        for (Method m : ms) {
+
+            MethodSignature sig = new GenericsMethodSignatureImpl(clazz, m);
+
+            assertEquals(sig.getName(), m.getName());
+            assertEquals(sig.getReturnType(), m.getReturnType());
+            assertEquals(sig.getParameterTypes(), m.getParameterTypes());
+            assertEquals(sig.getExceptionTypes(), m.getExceptionTypes());
+            assertEquals(sig.getReturnType(), m.getReturnType());
+        }
+    }
+
+    public class TestGeneric<T> extends BaseGeneric<T>{
+
+    }
+    public class BaseGeneric<T> {
+        public IPage doDeleteEntityAction(T entity) {
+            return null;
+        }
+    }
+
 }

Modified: tapestry/tapestry4/trunk/tapestry.iws
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry.iws?view=diff&rev=522152&r1=522151&r2=522152
==============================================================================
--- tapestry/tapestry4/trunk/tapestry.iws (original)
+++ tapestry/tapestry4/trunk/tapestry.iws Sat Mar 24 20:32:18 2007
@@ -18,15 +18,8 @@
   <component name="ChangeListManager">
     <list default="true" name="Default" comment="">
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/tapestry.iws" 
afterPath="$PROJECT_DIR$/tapestry.iws" />
-      <change type="MODIFICATION" 
beforePath="$PROJECT_DIR$/tapestry-annotations/tapestry-annotations.iml" 
afterPath="$PROJECT_DIR$/tapestry-annotations/tapestry-annotations.iml" />
-      <change type="MODIFICATION" 
beforePath="$PROJECT_DIR$/tapestry-contrib/tapestry-contrib.iml" 
afterPath="$PROJECT_DIR$/tapestry-contrib/tapestry-contrib.iml" />
-      <change type="MODIFICATION" 
beforePath="$PROJECT_DIR$/tapestry-framework/tapestry-framework.iml" 
afterPath="$PROJECT_DIR$/tapestry-framework/tapestry-framework.iml" />
-      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/tapestry.ipr" 
afterPath="$PROJECT_DIR$/tapestry.ipr" />
-      <change type="MODIFICATION" 
beforePath="$PROJECT_DIR$/tapestry-framework/src/js/tapestry/form/validation.js"
 
afterPath="$PROJECT_DIR$/tapestry-framework/src/js/tapestry/form/validation.js" 
/>
-      <change type="MODIFICATION" 
beforePath="$PROJECT_DIR$/tapestry-examples/TimeTracker/TimeTracker.iml" 
afterPath="$PROJECT_DIR$/tapestry-examples/TimeTracker/TimeTracker.iml" />
-      <change type="MODIFICATION" 
beforePath="$PROJECT_DIR$/tapestry-examples/Workbench/Workbench.iml" 
afterPath="$PROJECT_DIR$/tapestry-examples/Workbench/Workbench.iml" />
-      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/tapestry.iml" 
afterPath="$PROJECT_DIR$/tapestry.iml" />
-      <change type="MODIFICATION" 
beforePath="$PROJECT_DIR$/tapestry-portlet/tapestry-portlet.iml" 
afterPath="$PROJECT_DIR$/tapestry-portlet/tapestry-portlet.iml" />
+      <change type="MODIFICATION" 
beforePath="$PROJECT_DIR$/tapestry-framework/src/test/org/apache/tapestry/enhance/MethodSignatureTest.java"
 
afterPath="$PROJECT_DIR$/tapestry-framework/src/test/org/apache/tapestry/enhance/MethodSignatureTest.java"
 />
+      <change type="MODIFICATION" 
beforePath="$PROJECT_DIR$/tapestry-framework/src/java/org/apache/tapestry/enhance/GenericsMethodSignatureImpl.java"
 
afterPath="$PROJECT_DIR$/tapestry-framework/src/java/org/apache/tapestry/enhance/GenericsMethodSignatureImpl.java"
 />
     </list>
   </component>
   <component name="ChangesViewManager" flattened_view="true" />
@@ -149,17 +142,7 @@
     </subPane>
   </component>
   <component name="FileEditorManager">
-    <leaf>
-      <file leaf-file-name="validation.js" pinned="false" current="true" 
current-in-tab="true">
-        <entry 
file="file://$PROJECT_DIR$/tapestry-framework/src/js/tapestry/form/validation.js">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="170" column="0" selection-start="5737" 
selection-end="5737" vertical-scroll-proportion="0.16950597">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-    </leaf>
+    <leaf />
   </component>
   <component name="FindManager">
     <FindUsagesManager>
@@ -349,14 +332,14 @@
       </UpdatedFiles>
     </UpdateInfo>
   </component>
-  <component name="RunManager" selected="TestNG.TestDropdownTimePicker">
-    <tempConfiguration default="false" name="TestDropdownTimePicker" 
type="TestNG" factoryName="TestNG" enabled="false" merge="false">
+  <component name="RunManager" selected="TestNG.MethodSignatureTest">
+    <tempConfiguration default="false" name="MethodSignatureTest" 
type="TestNG" factoryName="TestNG" enabled="false" merge="false">
       <module name="tapestry-framework" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
       <option name="ALTERNATIVE_JRE_PATH" />
       <option name="SUITE_NAME" />
-      <option name="PACKAGE_NAME" value="org.apache.tapestry.dojo.form" />
-      <option name="MAIN_CLASS_NAME" 
value="org.apache.tapestry.dojo.form.TestDropdownTimePicker" />
+      <option name="PACKAGE_NAME" value="org.apache.tapestry.enhance" />
+      <option name="MAIN_CLASS_NAME" 
value="org.apache.tapestry.enhance.MethodSignatureTest" />
       <option name="METHOD_NAME" />
       <option name="GROUP_NAME" />
       <option name="TEST_OBJECT" value="CLASS" />
@@ -434,6 +417,9 @@
       <option name="TEST_SEARCH_SCOPE">
         <value defaultName="wholeProject" />
       </option>
+      <method>
+        <option name="Make" value="true" />
+      </method>
     </configuration>
     <configuration default="true" type="Application" factoryName="Application" 
enabled="false" merge="false">
       <option name="MAIN_CLASS_NAME" />
@@ -599,107 +585,107 @@
     <option name="myLastEditedConfigurable" value="Project Default" />
   </component>
   <component name="editorHistoryManager">
-    <entry file="jar:///usr/local/jdk1.6.0/src.zip!/java/text/Format.java">
+    <entry 
file="file://$PROJECT_DIR$/tapestry-framework/src/test/org/apache/tapestry/form/translator/TestDateTranslator.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="160" column="33" selection-start="6506" 
selection-end="6506" vertical-scroll-proportion="0.33304942">
+        <state line="108" column="0" selection-start="3147" 
selection-end="3147" vertical-scroll-proportion="0.2810903">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry 
file="jar:///usr/local/jdk1.6.0/src.zip!/java/text/SimpleDateFormat.java">
+    <entry 
file="file://$PROJECT_DIR$/tapestry-framework/src/java/org/apache/tapestry/form/translator/FormatTranslator.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="850" column="42" selection-start="30898" 
selection-end="30898" vertical-scroll-proportion="0.46763203">
+        <state line="104" column="0" selection-start="3153" 
selection-end="3153" vertical-scroll-proportion="0.7572402">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry 
file="file://$PROJECT_DIR$/tapestry-framework/src/java/org/apache/tapestry/form/translator/Translator.java">
+    <entry 
file="file://$PROJECT_DIR$/tapestry-framework/src/java/org/apache/tapestry/dojo/form/DropdownDatePicker.script">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="39" column="0" selection-start="1487" 
selection-end="1487" vertical-scroll-proportion="0.26831347">
+        <state line="17" column="0" selection-start="625" selection-end="625" 
vertical-scroll-proportion="0.21720614">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/tapestry-framework/pom.xml">
+    <entry 
file="file://$PROJECT_DIR$/tapestry-framework/src/java/org/apache/tapestry/dojo/form/DropdownTimePicker.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="139" column="0" selection-start="5013" 
selection-end="5013" vertical-scroll-proportion="0.4088586">
+        <state line="137" column="0" selection-start="4714" 
selection-end="4714" vertical-scroll-proportion="0.923339">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry 
file="file://$PROJECT_DIR$/tapestry-framework/src/java/org/apache/tapestry/form/translator/DateTranslator.java">
+    <entry 
file="file://$PROJECT_DIR$/tapestry-framework/src/java/org/apache/tapestry/dojo/form/DropdownDatePicker.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="43" column="4" selection-start="1591" 
selection-end="1591" vertical-scroll-proportion="0.21720614">
+        <state line="83" column="8" selection-start="3113" 
selection-end="3113" vertical-scroll-proportion="0.3100511">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry 
file="file://$PROJECT_DIR$/tapestry-framework/src/test/org/apache/tapestry/form/translator/TestDateTranslator.java">
+    <entry 
file="file://$PROJECT_DIR$/tapestry-framework/src/java/org/apache/tapestry/AbstractComponent.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="108" column="0" selection-start="3147" 
selection-end="3147" vertical-scroll-proportion="0.2810903">
+        <state line="520" column="0" selection-start="13715" 
selection-end="13715" vertical-scroll-proportion="0.051959112">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry 
file="file://$PROJECT_DIR$/tapestry-framework/src/java/org/apache/tapestry/form/translator/FormatTranslator.java">
+    <entry 
file="file://$PROJECT_DIR$/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestDropdownTimePicker.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="104" column="0" selection-start="3153" 
selection-end="3153" vertical-scroll-proportion="0.7572402">
+        <state line="93" column="0" selection-start="3221" 
selection-end="3221" vertical-scroll-proportion="0.5528109">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry 
file="file://$PROJECT_DIR$/tapestry-framework/src/java/org/apache/tapestry/dojo/form/DropdownDatePicker.script">
+    <entry 
file="file://$PROJECT_DIR$/tapestry-annotations/src/java/org/apache/tapestry/annotations/EventListenerAnnotationWorker.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="17" column="0" selection-start="625" selection-end="625" 
vertical-scroll-proportion="0.21720614">
+        <state line="59" column="8" selection-start="2091" 
selection-end="2091" vertical-scroll-proportion="0.5238501">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry 
file="file://$PROJECT_DIR$/tapestry-framework/src/java/org/apache/tapestry/dojo/form/DropdownTimePicker.java">
+    <entry 
file="file://$PROJECT_DIR$/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/servlet/ConfigurationServlet.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="137" column="0" selection-start="4714" 
selection-end="4714" vertical-scroll-proportion="0.923339">
+        <state line="27" column="4" selection-start="1010" 
selection-end="1010" vertical-scroll-proportion="0.14054514">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry 
file="file://$PROJECT_DIR$/tapestry-framework/src/java/org/apache/tapestry/dojo/form/DropdownDatePicker.java">
+    <entry 
file="file://$PROJECT_DIR$/tapestry-framework/src/js/tapestry/form/validation.js">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="83" column="8" selection-start="3113" 
selection-end="3113" vertical-scroll-proportion="0.3100511">
+        <state line="185" column="9" selection-start="6260" 
selection-end="6260" vertical-scroll-proportion="1.0127769">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry 
file="file://$PROJECT_DIR$/tapestry-framework/src/java/org/apache/tapestry/AbstractComponent.java">
+    <entry 
file="file://$PROJECT_DIR$/tapestry-framework/src/test/org/apache/tapestry/enhance/autowire-multiple.xml">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="520" column="0" selection-start="13715" 
selection-end="13715" vertical-scroll-proportion="0.051959112">
+        <state line="30" column="0" selection-start="1120" 
selection-end="1120" vertical-scroll-proportion="0.38330495">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry 
file="file://$PROJECT_DIR$/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestDropdownTimePicker.java">
+    <entry 
file="file://$PROJECT_DIR$/tapestry-framework/src/test/org/apache/tapestry/enhance/TestEnhancementOperation.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="93" column="0" selection-start="3221" 
selection-end="3221" vertical-scroll-proportion="0.5528109">
+        <state line="74" column="0" selection-start="2620" 
selection-end="2620" vertical-scroll-proportion="-0.88160133">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry 
file="file://$PROJECT_DIR$/tapestry-annotations/src/java/org/apache/tapestry/annotations/EventListenerAnnotationWorker.java">
+    <entry 
file="file://$PROJECT_DIR$/tapestry-framework/src/test/org/apache/tapestry/enhance/FooGenericComponent.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="59" column="8" selection-start="2091" 
selection-end="2091" vertical-scroll-proportion="0.5238501">
+        <state line="34" column="0" selection-start="915" selection-end="915" 
vertical-scroll-proportion="0.2810903">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry 
file="file://$PROJECT_DIR$/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/servlet/ConfigurationServlet.java">
+    <entry 
file="file://$PROJECT_DIR$/tapestry-framework/src/test/org/apache/tapestry/enhance/MethodSignatureTest.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="27" column="4" selection-start="1010" 
selection-end="1010" vertical-scroll-proportion="0.14054514">
+        <state line="93" column="8" selection-start="3118" 
selection-end="3118" vertical-scroll-proportion="0.3100511">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry 
file="file://$PROJECT_DIR$/tapestry-framework/src/js/tapestry/form/validation.js">
+    <entry 
file="file://$PROJECT_DIR$/tapestry-framework/src/java/org/apache/tapestry/enhance/GenericsMethodSignatureImpl.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="170" column="0" selection-start="5737" 
selection-end="5737" vertical-scroll-proportion="0.16950597">
+        <state line="72" column="43" selection-start="2430" 
selection-end="2430" vertical-scroll-proportion="0.39608178">
           <folding />
         </state>
       </provider>


Reply via email to