You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by jk...@apache.org on 2007/02/22 14:48:02 UTC

svn commit: r510514 [2/2] - in /tapestry/tapestry4/trunk: tapestry-annotations/src/java/org/apache/tapestry/annotations/ tapestry-annotations/src/test/org/apache/tapestry/annotations/ tapestry-framework/src/descriptor/META-INF/ tapestry-framework/src/j...

Added: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/MethodSignatureImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/MethodSignatureImpl.java?view=auto&rev=510514
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/MethodSignatureImpl.java (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/MethodSignatureImpl.java Thu Feb 22 05:48:00 2007
@@ -0,0 +1,256 @@
+// Copyright 2004, 2005 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.apache.tapestry.enhance;
+
+import java.lang.reflect.Method;
+
+import org.apache.hivemind.service.ClassFabUtils;
+
+
+/**
+ * JDK 1.4 based version of {@link MethodSignature}. 
+ */
+public class MethodSignatureImpl implements MethodSignature
+{
+    protected int _hashCode = -1;
+
+    protected Class _returnType;
+
+    protected String _name;
+
+    protected Class[] _parameterTypes;
+
+    protected Class[] _exceptionTypes;
+
+    public MethodSignatureImpl(Class returnType, String name, 
+            Class[] parameterTypes, Class[] exceptionTypes)
+    {
+        _returnType = returnType;
+        _name = name;
+        _parameterTypes = parameterTypes;
+        _exceptionTypes = exceptionTypes;
+    }
+    
+    public MethodSignatureImpl(Method m)
+    {
+        this(m.getReturnType(), m.getName(), m.getParameterTypes(), m.getExceptionTypes());
+    }
+    
+    public Class[] getExceptionTypes()
+    {
+        return _exceptionTypes;
+    }
+
+    public String getName()
+    {
+        return _name;
+    }
+    
+    public Class[] getParameterTypes()
+    {
+        return _parameterTypes;
+    }
+
+    public Class getReturnType()
+    {
+        return _returnType;
+    }
+
+    public int hashCode()
+    {
+        if (_hashCode == -1)
+        {
+
+            _hashCode = _returnType.hashCode();
+
+            _hashCode = 31 * _hashCode + _name.hashCode();
+
+            int count = count(_parameterTypes);
+
+            for (int i = 0; i < count; i++)
+                _hashCode = 31 * _hashCode + _parameterTypes[i].hashCode();
+
+            count = count(_exceptionTypes);
+
+            for (int i = 0; i < count; i++)
+                _hashCode = 31 * _hashCode + _exceptionTypes[i].hashCode();
+        }
+
+        return _hashCode;
+    }
+
+    protected static int count(Object[] array)
+    {
+        return array == null ? 0 : array.length;
+    }
+
+    /**
+     * Returns true if the other object is an instance of MethodSignature with identical values for
+     * return type, name, parameter types and exception types.
+     */
+    public boolean equals(Object o)
+    {
+        if (o == null || !(o instanceof MethodSignatureImpl))
+            return false;
+
+        MethodSignatureImpl ms = (MethodSignatureImpl) o;
+
+        if (_returnType != ms._returnType)
+            return false;
+
+        if (!_name.equals(ms._name))
+            return false;
+
+        if (mismatch(_parameterTypes, ms._parameterTypes))
+            return false;
+
+        return !mismatch(_exceptionTypes, ms._exceptionTypes);
+    }
+
+    protected boolean mismatch(Class[] a1, Class[] a2)
+    {
+        int a1Count = count(a1);
+        int a2Count = count(a2);
+
+        if (a1Count != a2Count)
+            return true;
+
+        // Hm. What if order is important (for exceptions)? We're really saying here that they
+        // were derived from the name Method.
+
+        for (int i = 0; i < a1Count; i++)
+        {
+            if (!a1[i].isAssignableFrom(a2[i]))
+                return true;
+        }
+
+        return false;
+    }
+
+    public String toString()
+    {
+        StringBuffer buffer = new StringBuffer();
+
+        buffer.append(ClassFabUtils.getJavaClassName(_returnType));
+        buffer.append(" ");
+        buffer.append(_name);
+        buffer.append("(");
+
+        for (int i = 0; i < count(_parameterTypes); i++)
+        {
+            if (i > 0)
+                buffer.append(", ");
+
+            buffer.append(ClassFabUtils.getJavaClassName(_parameterTypes[i]));
+        }
+
+        buffer.append(")");
+
+        for (int i = 0; i < count(_exceptionTypes); i++)
+        {
+            if (i == 0)
+                buffer.append(" throws ");
+            else
+                buffer.append(", ");
+
+            buffer.append(_exceptionTypes[i].getName());
+        }
+
+        return buffer.toString();
+    }
+
+    public String getUniqueId()
+    {
+        StringBuffer buffer = new StringBuffer(_name);
+        buffer.append("(");
+
+        for (int i = 0; i < count(_parameterTypes); i++)
+        {
+            if (i > 0)
+                buffer.append(",");
+
+            buffer.append(ClassFabUtils.getJavaClassName(_parameterTypes[i]));
+        }
+
+        buffer.append(")");
+
+        return buffer.toString();
+    }
+    
+    public boolean isGeneric()
+    {
+        return false;
+    }
+    
+    public boolean isOverridingSignatureOf(MethodSignature ms)
+    {
+        if (!(ms instanceof MethodSignatureImpl))
+            return false;
+        
+        MethodSignatureImpl sig = (MethodSignatureImpl)ms;
+        
+        if (_returnType != sig._returnType)
+            return false;
+
+        if (!_name.equals(sig._name))
+            return false;
+
+        if (mismatch(_parameterTypes, sig._parameterTypes))
+            return false;
+
+        return exceptionsEncompass(sig._exceptionTypes);
+    }
+
+    /**
+     * The nuts and bolts of checking that another method signature's exceptions are a subset of
+     * this signature's.
+     */
+
+    protected boolean exceptionsEncompass(Class[] otherExceptions)
+    {
+        int ourCount = count(_exceptionTypes);
+        int otherCount = count(otherExceptions);
+
+        // If we have no exceptions, then ours encompass theirs only if they
+        // have no exceptions, either.
+
+        if (ourCount == 0)
+            return otherCount == 0;
+
+        boolean[] matched = new boolean[otherCount];
+        int unmatched = otherCount;
+
+        for (int i = 0; i < ourCount && unmatched > 0; i++)
+        {
+            for (int j = 0; j < otherCount; j++)
+            {
+                // Ignore exceptions that have already been matched
+                
+                if (matched[j])
+                    continue;
+
+                // When one of our exceptions is a super-class of one of their exceptions,
+                // then their exceptions is matched.
+                
+                if (_exceptionTypes[i].isAssignableFrom(otherExceptions[j]))
+                {
+                    matched[j] = true;
+                    unmatched--;
+                }
+            }
+        }
+
+        return unmatched == 0;
+    }
+}

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/SpecifiedPropertyWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/SpecifiedPropertyWorker.java?view=diff&rev=510514&r1=510513&r2=510514
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/SpecifiedPropertyWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/SpecifiedPropertyWorker.java Thu Feb 22 05:48:00 2007
@@ -92,8 +92,8 @@
     public void addProperty(EnhancementOperation op, String propertyName, String specifiedType, 
             boolean persistent, String initialValue, Location location, IPropertySpecification ps)
     {
-        Class propertyType = EnhanceUtils.extractPropertyType(op, propertyName, specifiedType);
-        
+        Class propertyType = EnhanceUtils.extractPropertyType(op, propertyName, specifiedType, ps.isGeneric());
+
         op.claimProperty(propertyName);
 
         String field = "_$" + propertyName;
@@ -194,6 +194,14 @@
         
         if (persistent) {
             
+            if (!propertyType.isArray() && !propertyType.isPrimitive()) {
+                
+                body.addln("if ($1 != null && org.apache.tapestry.record.ObservedProperty.class.isAssignableFrom($1.getClass())) {");
+                body.add(" $1 = (" + ClassFabUtils.getJavaClassName(propertyType) + ")((org.apache.tapestry.record.ObservedProperty)$1)");
+                body.addln(".getCGProperty();");
+                body.addln("}");
+            }
+            
             body.add("org.apache.tapestry.Tapestry#fireObservedChange(this, ");
             body.addQuoted(propertyName);
             body.addln(", ($w) $1);");
@@ -213,7 +221,7 @@
         }
         
         body.end();
-
+        
         MethodSignature sig = new MethodSignature(void.class, methodName, new Class[] { propertyType }, null);
 
         op.addMethod(Modifier.PUBLIC, sig, body.toString(), location);

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/CglibPropertyChangeInterceptor.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/CglibPropertyChangeInterceptor.java?view=diff&rev=510514&r1=510513&r2=510514
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/CglibPropertyChangeInterceptor.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/CglibPropertyChangeInterceptor.java Thu Feb 22 05:48:00 2007
@@ -27,7 +27,7 @@
  * 
  * Used by the default {@link PropertyChangeObserver} service.
  */
-public class CglibPropertyChangeInterceptor implements MethodInterceptor
+public class CglibPropertyChangeInterceptor implements MethodInterceptor, ObservedProperty
 {
     private Object _property;
     
@@ -51,12 +51,20 @@
         _propertyName = propertyName;
     }
     
+    public Object getCGProperty()
+    {
+        return _property;
+    }
+    
     /**
      * {@inheritDoc}
      */
     public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy)
         throws Throwable
     {
+        if (method.getDeclaringClass() == ObservedProperty.class)
+            return getCGProperty();
+        
         if (_component.getPage().getChangeObserver() != null
                 && !_component.getPage().getChangeObserver().isLocked()) {
             

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/CglibProxiedPropertyChangeObserverImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/CglibProxiedPropertyChangeObserverImpl.java?view=diff&rev=510514&r1=510513&r2=510514
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/CglibProxiedPropertyChangeObserverImpl.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/CglibProxiedPropertyChangeObserverImpl.java Thu Feb 22 05:48:00 2007
@@ -81,8 +81,13 @@
                 _badMap.put(property.getClass().getName(), Boolean.TRUE);
                 return property;
             }
-
-            Object ret = Enhancer.create(property.getClass(), property.getClass().getInterfaces(), 
+            
+            Class[] interfaces = new Class[property.getClass().getInterfaces().length + 1];
+            System.arraycopy(property.getClass().getInterfaces(), 0, interfaces, 0, interfaces.length - 1);
+            
+            interfaces[interfaces.length - 1] = ObservedProperty.class;
+            
+            Object ret = Enhancer.create(property.getClass(), interfaces, 
                     new ObservableMethodFilter(), 
                     new Callback[] { new LazyProxyDelegate(property), new CglibPropertyChangeInterceptor(component, property, propertyName)});
             

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/LazyProxyDelegate.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/LazyProxyDelegate.java?view=diff&rev=510514&r1=510513&r2=510514
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/LazyProxyDelegate.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/LazyProxyDelegate.java Thu Feb 22 05:48:00 2007
@@ -20,8 +20,7 @@
  * Implementation of {@link LazyLoader} interface for {@link CglibProxiedPropertyChangeObserverImpl}.
  */
 public class LazyProxyDelegate implements LazyLoader
-{
-
+{   
     Object _target;
     
     /**

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/ObservableMethodFilter.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/ObservableMethodFilter.java?view=diff&rev=510514&r1=510513&r2=510514
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/ObservableMethodFilter.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/ObservableMethodFilter.java Thu Feb 22 05:48:00 2007
@@ -32,8 +32,9 @@
     {
         boolean hasParams = method.getParameterTypes() != null && method.getParameterTypes().length > 0;
         
-        if (method.getReturnType() == void.class && hasParams
-                || method.getReturnType() != boolean.class && hasParams) {
+        if (method.getDeclaringClass() == ObservedProperty.class
+                || (method.getReturnType() == void.class && hasParams
+                || method.getReturnType() != boolean.class && hasParams)) {
             
             return 1;
         }

Added: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/ObservedProperty.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/ObservedProperty.java?view=auto&rev=510514
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/ObservedProperty.java (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/ObservedProperty.java Thu Feb 22 05:48:00 2007
@@ -0,0 +1,23 @@
+// Copyright 2004, 2005 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.apache.tapestry.record;
+
+
+/**
+ * 
+ */
+public interface ObservedProperty
+{
+    Object getCGProperty();
+}

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/PersistentPropertyDataEncoderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/PersistentPropertyDataEncoderImpl.java?view=diff&rev=510514&r1=510513&r2=510514
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/PersistentPropertyDataEncoderImpl.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/PersistentPropertyDataEncoderImpl.java Thu Feb 22 05:48:00 2007
@@ -163,6 +163,7 @@
                 oos.writeUTF(componentPath);
 
             oos.writeUTF(propertyName);
+            
             oos.writeObject(value);
         }
     }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/spec/IPropertySpecification.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/spec/IPropertySpecification.java?view=diff&rev=510514&r1=510513&r2=510514
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/spec/IPropertySpecification.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/spec/IPropertySpecification.java Thu Feb 22 05:48:00 2007
@@ -53,6 +53,20 @@
     void setType(String type);
     
     /**
+     * Sets whether or not this property represents a concrete generic type.
+     * 
+     * @param isGeneric
+     */
+    void setGeneric(boolean isGeneric);
+    
+    /**
+     * Checks if the type represented by this property is in a generic declaration.
+     * 
+     * @return True if it is generic, false otherwise.
+     */
+    boolean isGeneric();
+    
+    /**
      * Checks if this property has previously had it's type information examined to
      * determine if it is elligable for proxying. Meaning {@link #canProxy()} should
      * be a real value.

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/spec/PropertySpecification.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/spec/PropertySpecification.java?view=diff&rev=510514&r1=510513&r2=510514
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/spec/PropertySpecification.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/spec/PropertySpecification.java Thu Feb 22 05:48:00 2007
@@ -34,6 +34,8 @@
 
     private String _type;
 
+    private boolean _isGeneric;
+    
     private String _initialValue;
 
     private String _persistence;
@@ -90,6 +92,16 @@
         _type = type;
     }
 
+    public void setGeneric(boolean isGeneric)
+    {
+        _isGeneric = isGeneric;
+    }
+    
+    public boolean isGeneric()
+    {
+        return _isGeneric;
+    }
+    
     /** @since 4.0 */
     public String getPersistence()
     {

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/AbstractBase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/AbstractBase.java?view=diff&rev=510514&r1=510513&r2=510514
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/AbstractBase.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/AbstractBase.java Thu Feb 22 05:48:00 2007
@@ -26,4 +26,4 @@
 public abstract class AbstractBase
 {
     public abstract void foo();
-}
\ No newline at end of file
+}

Added: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/AbstractGenericBase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/AbstractGenericBase.java?view=auto&rev=510514
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/AbstractGenericBase.java (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/AbstractGenericBase.java Thu Feb 22 05:48:00 2007
@@ -0,0 +1,29 @@
+// Copyright 2004, 2005 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.apache.tapestry.enhance;
+
+
+
+/**
+ * Tests generic interfaces functionality.
+ */
+public abstract class AbstractGenericBase<E extends SimpleGeneric>
+{
+    
+    public abstract E getValue();
+    
+    public abstract void setSomethingCrazy(E val);
+    
+    public abstract E getOperationValue();
+}

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/EnhancedClassValidatorTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/EnhancedClassValidatorTest.java?view=diff&rev=510514&r1=510513&r2=510514
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/EnhancedClassValidatorTest.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/EnhancedClassValidatorTest.java Thu Feb 22 05:48:00 2007
@@ -35,13 +35,14 @@
      * methods.
      */
 
-    public void testComplete()
+    public void test_Complete()
     {
-        EnhancedClassValidator v = new EnhancedClassValidatorImpl();
-
+        EnhancedClassValidatorImpl v = new EnhancedClassValidatorImpl();
+        v.setClassInspector(new ClassInspectorImpl());
+        
         v.validate(AbstractBase.class, Complete.class, new ComponentSpecification());
     }
-
+    
     /**
      * Pass in an abstract class (with enhancement, its possible that a supposedly concrete class
      * may omit implementing an inherited abstract method, which is the whole point of the
@@ -68,6 +69,7 @@
         replay();
 
         EnhancedClassValidatorImpl v = new EnhancedClassValidatorImpl();
+        v.setClassInspector(new ClassInspectorImpl());
         v.setErrorLog(log);
 
         v.validate(AbstractBase.class, Incomplete.class, spec);
@@ -75,7 +77,7 @@
         verify();
     }
 
-    public void testInheritsMissingMethod()
+    public void test_Inherits_Missing_Method()
     {
         ErrorLog log = newErrorLog();
         Location l = newLocation();
@@ -96,6 +98,7 @@
 
         EnhancedClassValidatorImpl v = new EnhancedClassValidatorImpl();
         v.setErrorLog(log);
+        v.setClassInspector(new ClassInspectorImpl());
 
         v.validate(AbstractRunnable.class, AbstractRunnableSubclass.class, spec);
 
@@ -114,7 +117,8 @@
 
     public void testObject()
     {
-        EnhancedClassValidator v = new EnhancedClassValidatorImpl();
+        EnhancedClassValidatorImpl v = new EnhancedClassValidatorImpl();
+        v.setClassInspector(new ClassInspectorImpl());
 
         v.validate(Object.class, Object.class, new ComponentSpecification());
     }

Added: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/FooGeneric.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/FooGeneric.java?view=auto&rev=510514
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/FooGeneric.java (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/FooGeneric.java Thu Feb 22 05:48:00 2007
@@ -0,0 +1,27 @@
+// Copyright 2004, 2005 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.apache.tapestry.enhance;
+
+
+/**
+ * 
+ */
+public class FooGeneric implements SimpleGeneric
+{
+
+    public boolean isGeneric()
+    {
+        return true;
+    }
+}

Added: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/FooGenericComponent.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/FooGenericComponent.java?view=auto&rev=510514
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/FooGenericComponent.java (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/FooGenericComponent.java Thu Feb 22 05:48:00 2007
@@ -0,0 +1,34 @@
+// Copyright 2004, 2005 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.apache.tapestry.enhance;
+
+import java.util.Map;
+
+
+/**
+ * 
+ */
+public abstract class FooGenericComponent extends AbstractGenericBase<FooGeneric>
+{
+    
+    public Map getMap()
+    {
+        return null;
+    }
+    
+    public FooGeneric getOperationValue()
+    {
+        return null;
+    }
+}

Added: 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=auto&rev=510514
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/MethodSignatureTest.java (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/MethodSignatureTest.java Thu Feb 22 05:48:00 2007
@@ -0,0 +1,113 @@
+// Copyright 2004, 2005 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.apache.tapestry.enhance;
+
+import java.util.Map;
+
+import org.testng.annotations.Test;
+
+import com.javaforge.tapestry.testng.TestBase;
+
+
+/**
+ * Tests functionality of {@link MethodSignature} implementations.
+ */
+@Test
+public class MethodSignatureTest extends TestBase
+{
+    // used for non generic tests
+    class Simple {
+        
+        public String getValue()
+        {
+            return "foo";
+        }
+        
+        public void setMax(Integer val)
+        {
+        }
+    }
+    
+    public void test_Simple_Properties()
+    {
+        ClassInspector ins = new ClassInspectorImpl();
+        
+        MethodSignature sig = ins.getPropertyAccessor(Simple.class, "value");
+        
+        assert sig != null;
+        assertEquals(sig.getReturnType(), String.class);
+        
+        sig = ins.getPropertyAccessor(Simple.class, "max");
+        
+        assert sig != null;
+        assertEquals(sig.getReturnType(), void.class);
+        assertEquals(sig.getParameterTypes().length, 1);
+        assertEquals(sig.getParameterTypes()[0], Integer.class);
+    }
+    
+    public void test_Generic_Properties()
+    {
+        ClassInspector ins = new GenericsClassInspectorImpl();
+        
+        MethodSignature sig = ins.getPropertyAccessor(FooGenericComponent.class, "value");
+        
+        assert sig != null;
+        assertEquals(sig.getReturnType(), FooGeneric.class);
+    }
+    
+    public void test_Generic_Parameters()
+    {
+        ClassInspector ins = new GenericsClassInspectorImpl();
+        
+        MethodSignature sig = ins.getPropertyAccessor(FooGenericComponent.class, "somethingCrazy");
+        
+        assert sig != null;
+        assertEquals(sig.getReturnType(), void.class);
+        assert sig.getParameterTypes() != null && sig.getParameterTypes().length > 0;
+        assertEquals(sig.getParameterTypes()[0], FooGeneric.class);
+        
+        sig = ins.getPropertyAccessor(AbstractGenericBase.class, "somethingCrazy");
+        
+        assert sig != null;
+        assertEquals(sig.getReturnType(), void.class);
+        assert sig.getParameterTypes() != null && sig.getParameterTypes().length > 0;
+        assertEquals(sig.getParameterTypes()[0], SimpleGeneric.class);
+    }
+    
+    public void test_Generic_Simple_Property()
+    {
+        ClassInspector ins = new GenericsClassInspectorImpl();
+        
+        MethodSignature sig = ins.getPropertyAccessor(FooGenericComponent.class, "map");
+        
+        assert sig != null;
+        assertEquals(sig.getReturnType(), Map.class);
+    }
+    
+    public void test_Generic_Inheritance()
+    {
+        ClassInspector ins = new GenericsClassInspectorImpl();
+        
+        MethodSignature child = ins.getPropertyAccessor(FooGenericComponent.class, "operationValue");
+        MethodSignature base = ins.getPropertyAccessor(AbstractGenericBase.class, "operationValue");
+        
+        assert child != null;
+        assert base != null;
+        
+        assert child.isOverridingSignatureOf(base);
+        
+        assert child.equals(base);
+        assert base.equals(child);
+    }
+}

Added: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/SimpleGeneric.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/SimpleGeneric.java?view=auto&rev=510514
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/SimpleGeneric.java (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/SimpleGeneric.java Thu Feb 22 05:48:00 2007
@@ -0,0 +1,24 @@
+// Copyright 2004, 2005 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.apache.tapestry.enhance;
+
+
+/**
+ * 
+ */
+public interface SimpleGeneric
+{
+    
+    boolean isGeneric();
+}

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestAutowireWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestAutowireWorker.java?view=diff&rev=510514&r1=510513&r2=510514
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestAutowireWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestAutowireWorker.java Thu Feb 22 05:48:00 2007
@@ -31,24 +31,22 @@
  * @author James Carman
  *
  */
+@Test(sequential = true)
 public class TestAutowireWorker extends BaseEnhancementTestCase
 {
 
     private static final String HELLO_SERVICE_PROPERTY = "helloService";
-
-    @Test(alwaysRun = true)
+    
     public void test_No_Service() throws Exception
     {
         assertNotAutowired( RegistryBuilder.constructDefaultRegistry() );
     }
     
-    @Test
     public void test_Many_Services() throws Exception
     {        
         assertNotAutowired( buildFrameworkRegistry("autowire-multiple.xml" ) );   
     }
     
-    @Test
     public void test_One_Service() throws Exception
     {
         final Registry registry = buildFrameworkRegistry("autowire-single.xml" );

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestEnhancementOperation.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestEnhancementOperation.java?view=diff&rev=510514&r1=510513&r2=510514
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestEnhancementOperation.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestEnhancementOperation.java Thu Feb 22 05:48:00 2007
@@ -885,9 +885,8 @@
         ClassFactory cf = newClassFactory(ServiceLink.class);
 
         replay();
-
-        EnhancementOperation eo = new EnhancementOperationImpl(new DefaultClassResolver(), spec,
-                ServiceLink.class, cf, null);
+        
+        EnhancementOperation eo = new EnhancementOperationImpl(new DefaultClassResolver(), spec, ServiceLink.class, cf, null);
 
         assertEquals(String.class, eo.getPropertyType("target"));
 
@@ -927,4 +926,5 @@
 
         verify();
     }
+    
 }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestSpecifiedPropertyWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestSpecifiedPropertyWorker.java?view=diff&rev=510514&r1=510513&r2=510514
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestSpecifiedPropertyWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestSpecifiedPropertyWorker.java Thu Feb 22 05:48:00 2007
@@ -27,6 +27,7 @@
 import org.apache.hivemind.ErrorLog;
 import org.apache.hivemind.Location;
 import org.apache.hivemind.service.BodyBuilder;
+import org.apache.hivemind.service.ClassFabUtils;
 import org.apache.hivemind.service.MethodSignature;
 import org.apache.tapestry.BaseComponent;
 import org.apache.tapestry.BaseComponentTestCase;
@@ -258,6 +259,12 @@
 
         BodyBuilder b = new BodyBuilder();
         b.begin();
+        
+        b.addln("if ($1 != null && org.apache.tapestry.record.ObservedProperty.class.isAssignableFrom($1.getClass())) {");
+        b.add(" $1 = (" + ClassFabUtils.getJavaClassName(String.class) + ")((org.apache.tapestry.record.ObservedProperty)$1)");
+        b.addln(".getCGProperty();");
+        b.addln("}");
+        
         b.addln("org.apache.tapestry.Tapestry#fireObservedChange(this, \"barney\", ($w) $1);");
         b.addln("_$barney = $1;");
         b.end();

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/record/TestPropertyChangeObserver.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/record/TestPropertyChangeObserver.java?view=diff&rev=510514&r1=510513&r2=510514
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/record/TestPropertyChangeObserver.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/record/TestPropertyChangeObserver.java Thu Feb 22 05:48:00 2007
@@ -229,6 +229,13 @@
         assert state.getClass() != newState.getClass();
         assert enewState.getClass() == state2.getClass();
         
+        assert ObservedProperty.class.isAssignableFrom(state.getClass());
+        
+        SimpleState preEnhanced = (SimpleState)((ObservedProperty)state).getCGProperty();
+        
+        assert preEnhanced != null;
+        assert !ObservedProperty.class.isAssignableFrom(preEnhanced.getClass());
+        
         verify();
     }
     

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/EngineServiceOuterProxyTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/EngineServiceOuterProxyTest.java?view=diff&rev=510514&r1=510513&r2=510514
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/EngineServiceOuterProxyTest.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/EngineServiceOuterProxyTest.java Thu Feb 22 05:48:00 2007
@@ -25,7 +25,7 @@
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
-@Test
+@Test(sequential = true)
 public class EngineServiceOuterProxyTest extends AbstractEngineServiceProxyTestCase
 {
     public void testToString()