Reviewers: rchandia,

Description:
Only validate a constraint annotation once.

[JSR 303 TCK Result] 106 of 257 (41.25%) Pass with 24 Failures and 9
Errors.


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

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


Index: user/src/com/google/gwt/validation/rebind/GwtSpecificValidatorCreator.java
===================================================================
--- user/src/com/google/gwt/validation/rebind/GwtSpecificValidatorCreator.java (revision 9783) +++ user/src/com/google/gwt/validation/rebind/GwtSpecificValidatorCreator.java (working copy)
@@ -1374,9 +1374,18 @@
       sw.println("}");
     }

+ // It is possible for an annotation with the exact same values to be set on
+    // both the field and the getter.
+    // Keep track of the ones we have used to make sure we don't duplicate.
+ // It doesn't matter which one we use because they have exactly the same
+    // values.
+    Set<Object> includedAnnotations = Sets.newHashSet();
     int count = 0;
for (ConstraintDescriptor<?> constraint : p.getConstraintDescriptors()) {
-      if (hasMatchingAnnotation(p, useField, constraint)) {
+      Object annotation = constraint.getAnnotation();
+      if (!includedAnnotations.contains(annotation)
+          && hasMatchingAnnotation(p, useField, constraint)) {
+        includedAnnotations.add(annotation);
         String constraintDescriptorVar = constraintDescriptorVar(
             p.getPropertyName(), count);

Index: user/test/org/hibernate/jsr303/tck/tests/constraints/application/ValidationRequirementGwtTest.java
===================================================================
--- user/test/org/hibernate/jsr303/tck/tests/constraints/application/ValidationRequirementGwtTest.java (revision 9783) +++ user/test/org/hibernate/jsr303/tck/tests/constraints/application/ValidationRequirementGwtTest.java (working copy)
@@ -42,7 +42,6 @@
     delegate.testClassLevelConstraints();
   }

-  @Failing(issue = 5798)
   public void testConstraintAppliedOnFieldAndProperty() {
     delegate.testConstraintAppliedOnFieldAndProperty();
   }


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

Reply via email to