Reviewers: Nick Chalko,

Description:
Allows creation of validators annotated by interfaces with abstract
methods. All methods in an interface are abstract anyway, but this
explicit denotation was throwing off the invocation via reflection.

Fixes issues: 6284

[JSR 303 TCK Result] 167 of 205 (81.46%) Pass with 30 Failures and 7
Errors.


Please review this at http://gwt-code-reviews.appspot.com/1768803/

Affected files:
M user/src/com/google/gwt/validation/rebind/GwtSpecificValidatorCreator.java M user/test/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/ConstraintDefinitionsGwtTest.java


Index: user/src/com/google/gwt/validation/rebind/GwtSpecificValidatorCreator.java
===================================================================
--- user/src/com/google/gwt/validation/rebind/GwtSpecificValidatorCreator.java (revision 11153) +++ user/src/com/google/gwt/validation/rebind/GwtSpecificValidatorCreator.java (working copy)
@@ -56,6 +56,7 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
@@ -435,6 +436,10 @@
           Class<?> valueType = valueMethod.getReturnType();
           if (valueType.isArray()
&& Annotation.class.isAssignableFrom(valueType.getComponentType())) {
+            if (Modifier.isAbstract(valueMethod.getModifiers())) {
+              // handle edge case where interface is marked "abstract"
+              valueMethod.setAccessible(true);
+            }
Annotation[] valueAnnotions = (Annotation[]) valueMethod.invoke(annotation);
             for (Annotation annotation2 : valueAnnotions) {
               if (expectedAnnotation.equals(annotation2)) {
Index: user/test/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/ConstraintDefinitionsGwtTest.java
===================================================================
--- user/test/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/ConstraintDefinitionsGwtTest.java (revision 11153) +++ user/test/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/ConstraintDefinitionsGwtTest.java (working copy)
@@ -17,7 +17,6 @@

 import com.google.gwt.junit.client.GWTTestCase;

-import org.hibernate.jsr303.tck.util.client.Failing;
 import org.hibernate.jsr303.tck.util.client.NonTckTest;

 /**
@@ -25,26 +24,19 @@
  */
 public class ConstraintDefinitionsGwtTest extends GWTTestCase {

-  // TODO(nchalko) Generating Person validator fails.
-  // see http://code.google.com/p/google-web-toolkit/issues/detail?id=6284
-  // private ConstraintDefinitionsTest delegate = new
-  // ConstraintDefinitionsTest();
+ private ConstraintDefinitionsTest delegate = new ConstraintDefinitionsTest();

   @Override
   public String getModuleName() {
return "org.hibernate.jsr303.tck.tests.constraints.constraintdefinition.TckTest";
   }

-  @Failing(issue = 6284)
   public void testConstraintWithCustomAttributes() {
-    fail();
-    // delegate.testConstraintWithCustomAttributes();
+    delegate.testConstraintWithCustomAttributes();
   }

-  @Failing(issue = 6284)
   public void testDefaultGroupAssumedWhenNoGroupsSpecified() {
-    fail();
-    // delegate.testDefaultGroupAssumedWhenNoGroupsSpecified();
+    delegate.testDefaultGroupAssumedWhenNoGroupsSpecified();
   }

   @NonTckTest


--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to