Revision: 9560
Author: [email protected]
Date: Mon Jan 17 11:36:20 2011
Log: Match Classes to validate in the order specified in the GwtValidaiton
Annotation.
[JSR 303 TCK Result] 62 of 258 (24.03%) Pass with 27 Failures and 5 Errors.
Review at http://gwt-code-reviews.appspot.com/1294802
Review by: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=9560
Modified:
/trunk/user/src/com/google/gwt/validation/rebind/ValidatorCreator.java
/trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionGwtTest.java
/trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/TckTestValidatorFactory.java
/trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/customconstraint/CustomConstraintValidatorGwtTest.java
/trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/ValidatorResolutionGwtTest.java
/trunk/user/test/org/hibernate/jsr303/tck/tests/validation/PropertyPathGwtTest.java
/trunk/user/test/org/hibernate/jsr303/tck/tests/validation/ValidatePropertyGwtTest.java
=======================================
--- /trunk/user/src/com/google/gwt/validation/rebind/ValidatorCreator.java
Fri Dec 24 18:46:16 2010
+++ /trunk/user/src/com/google/gwt/validation/rebind/ValidatorCreator.java
Mon Jan 17 11:36:20 2011
@@ -19,6 +19,7 @@
import com.google.gwt.core.ext.GeneratorContext;
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.typeinfo.JClassType;
+import com.google.gwt.thirdparty.guava.common.collect.Lists;
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory;
import com.google.gwt.user.rebind.SourceWriter;
import com.google.gwt.validation.client.GwtValidation;
@@ -27,8 +28,7 @@
import com.google.gwt.validation.client.impl.GwtSpecificValidator;
import com.google.gwt.validation.client.impl.GwtValidationContext;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.List;
import java.util.Set;
import javax.validation.ConstraintViolation;
@@ -39,7 +39,10 @@
*/
public class ValidatorCreator extends AbstractCreator {
- private final Map<JClassType, BeanHelper> beansToValidate = new
HashMap<JClassType, BeanHelper>();
+ /**
+ * The beans to validate in source declaratoin order.
+ */
+ private final List<BeanHelper> beansToValidate = Lists.newArrayList();
private final GwtValidation gwtValidation;
@@ -50,9 +53,10 @@
super(context, logger, validatorType);
this.gwtValidation = gwtValidation;
+
for (Class<?> clazz : gwtValidation.value()) {
BeanHelper helper = createBeanHelper(clazz);
- beansToValidate.put(helper.getJClass(), helper);
+ beansToValidate.add(helper);
}
}
@@ -134,7 +138,7 @@
// checkNotNull(clazz, "clazz");
sw.println("checkNotNull(clazz, \"clazz\");");
- for (BeanHelper bean : beansToValidate.values()) {
+ for (BeanHelper bean : beansToValidate) {
writeGetConstraintsForClass(sw, bean);
}
@@ -182,14 +186,14 @@
// + "Valid values are {Foo.clas, Bar.class}
sourceWriter.print("+ \"Valid types are ");
- sourceWriter.print(beansToValidate.values().toString());
+ sourceWriter.print(beansToValidate.toString());
sourceWriter.println("\");");
sourceWriter.outdent();
sourceWriter.outdent();
}
private void writeTypeSupport(SourceWriter sw) {
- for (BeanHelper bean : beansToValidate.values()) {
+ for (BeanHelper bean : beansToValidate) {
writeValidatorInstance(sw, bean);
}
}
@@ -204,7 +208,7 @@
sw.println("checkNotNull(groups, \"groups\");");
sw.println("checkGroups(groups);");
- for (BeanHelper bean : beansToValidate.values()) {
+ for (BeanHelper bean : beansToValidate) {
writeValidate(sw, bean);
}
@@ -240,7 +244,7 @@
sw.println("checkNotNull(groups, \"groups\");");
sw.println("checkGroups(groups);");
- for (BeanHelper bean : beansToValidate.values()) {
+ for (BeanHelper bean : beansToValidate) {
writeValidateProperty(sw, bean);
}
@@ -271,7 +275,7 @@
sw.println("checkNotNull(groups, \"groups\");");
sw.println("checkGroups(groups);");
- for (BeanHelper bean : beansToValidate.values()) {
+ for (BeanHelper bean : beansToValidate) {
writeValidateValue(sw, bean);
}
=======================================
---
/trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionGwtTest.java
Tue Jan 11 14:19:47 2011
+++
/trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionGwtTest.java
Mon Jan 17 11:36:20 2011
@@ -40,12 +40,10 @@
delegate.testAttributesDefinedOnComposingConstraints();
}
- @Failing(issue = 5799)
public void testComposedConstraints() {
delegate.testComposedConstraints();
}
- @Failing(issue = 5799)
public void testComposedConstraintsAreRecursive() {
delegate.testComposedConstraintsAreRecursive();
}
@@ -55,7 +53,6 @@
delegate.testEachFailingConstraintCreatesConstraintViolation();
}
- @Failing(issue = 5799)
public void testGroupsDefinedOnMainAnnotationAreInherited() {
delegate.testGroupsDefinedOnMainAnnotationAreInherited();
}
=======================================
---
/trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/TckTestValidatorFactory.java
Tue Jan 11 14:19:47 2011
+++
/trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/TckTestValidatorFactory.java
Mon Jan 17 11:36:20 2011
@@ -31,7 +31,8 @@
* Marker Interface for {@link GWT#create(Class)}.
*/
@GwtValidation(value = {
- Address.class, FrenchAddress.class, Friend.class,
GermanAddress.class,
+ // German and French must be listed before the Address Super class
+ GermanAddress.class, FrenchAddress.class, Address.class,
Friend.class,
Shoe.class
// TODO(nchalko) handle ConstraintDefinitionException
// ConstraintCompositionGwtTest.DummyEntityWithZipCode.class
=======================================
---
/trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/customconstraint/CustomConstraintValidatorGwtTest.java
Tue Jan 11 14:19:47 2011
+++
/trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/customconstraint/CustomConstraintValidatorGwtTest.java
Mon Jan 17 11:36:20 2011
@@ -30,7 +30,6 @@
return "org.hibernate.jsr303.tck.tests.constraints.customconstraint.TckTest";
}
- @Failing(issue = 5800)
public void testDefaultPropertyPath() {
delegate.testDefaultPropertyPath();
}
=======================================
---
/trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/ValidatorResolutionGwtTest.java
Tue Jan 11 14:19:47 2011
+++
/trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/ValidatorResolutionGwtTest.java
Mon Jan 17 11:36:20 2011
@@ -34,7 +34,6 @@
delegate.testAmbiguousValidatorResolution();
}
- @Failing(issue = 5806)
public void testResolutionOfMinMaxForDifferentTypes() {
delegate.testResolutionOfMinMaxForDifferentTypes();
}
=======================================
---
/trunk/user/test/org/hibernate/jsr303/tck/tests/validation/PropertyPathGwtTest.java
Tue Jan 11 14:19:47 2011
+++
/trunk/user/test/org/hibernate/jsr303/tck/tests/validation/PropertyPathGwtTest.java
Mon Jan 17 11:36:20 2011
@@ -24,7 +24,6 @@
private final PropertyPathTest delegate = new PropertyPathTest();
- @Failing(issue = 5803)
public void testPropertyPathSet() {
delegate.testPropertyPathSet();
}
=======================================
---
/trunk/user/test/org/hibernate/jsr303/tck/tests/validation/ValidatePropertyGwtTest.java
Wed Jan 12 17:43:21 2011
+++
/trunk/user/test/org/hibernate/jsr303/tck/tests/validation/ValidatePropertyGwtTest.java
Mon Jan 17 11:36:20 2011
@@ -45,7 +45,6 @@
}
}
- @Failing(issue = 5804)
public void testValidateProperty() {
delegate.testValidateProperty();
}
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors