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: rchandia@google.com
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@9560 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/validation/rebind/ValidatorCreator.java b/user/src/com/google/gwt/validation/rebind/ValidatorCreator.java
index 7d4772f..a2a92cf 100644
--- a/user/src/com/google/gwt/validation/rebind/ValidatorCreator.java
+++ b/user/src/com/google/gwt/validation/rebind/ValidatorCreator.java
@@ -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);
}
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionGwtTest.java b/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionGwtTest.java
index 9721c6e..c8d29de 100644
--- a/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionGwtTest.java
+++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionGwtTest.java
@@ -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();
}
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/TckTestValidatorFactory.java b/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/TckTestValidatorFactory.java
index 38aaa79..a1db13b 100644
--- a/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/TckTestValidatorFactory.java
+++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/TckTestValidatorFactory.java
@@ -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
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/customconstraint/CustomConstraintValidatorGwtTest.java b/user/test/org/hibernate/jsr303/tck/tests/constraints/customconstraint/CustomConstraintValidatorGwtTest.java
index 69ad2d0..11aa059 100644
--- a/user/test/org/hibernate/jsr303/tck/tests/constraints/customconstraint/CustomConstraintValidatorGwtTest.java
+++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/customconstraint/CustomConstraintValidatorGwtTest.java
@@ -30,7 +30,6 @@
return "org.hibernate.jsr303.tck.tests.constraints.customconstraint.TckTest";
}
- @Failing(issue = 5800)
public void testDefaultPropertyPath() {
delegate.testDefaultPropertyPath();
}
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/ValidatorResolutionGwtTest.java b/user/test/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/ValidatorResolutionGwtTest.java
index 0472ca9..ce061b2 100644
--- a/user/test/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/ValidatorResolutionGwtTest.java
+++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/ValidatorResolutionGwtTest.java
@@ -34,7 +34,6 @@
delegate.testAmbiguousValidatorResolution();
}
- @Failing(issue = 5806)
public void testResolutionOfMinMaxForDifferentTypes() {
delegate.testResolutionOfMinMaxForDifferentTypes();
}
diff --git a/user/test/org/hibernate/jsr303/tck/tests/validation/PropertyPathGwtTest.java b/user/test/org/hibernate/jsr303/tck/tests/validation/PropertyPathGwtTest.java
index c4361d4..25bfde8 100644
--- a/user/test/org/hibernate/jsr303/tck/tests/validation/PropertyPathGwtTest.java
+++ b/user/test/org/hibernate/jsr303/tck/tests/validation/PropertyPathGwtTest.java
@@ -24,7 +24,6 @@
private final PropertyPathTest delegate = new PropertyPathTest();
- @Failing(issue = 5803)
public void testPropertyPathSet() {
delegate.testPropertyPathSet();
}
diff --git a/user/test/org/hibernate/jsr303/tck/tests/validation/ValidatePropertyGwtTest.java b/user/test/org/hibernate/jsr303/tck/tests/validation/ValidatePropertyGwtTest.java
index 39fa78d..5f38d04 100644
--- a/user/test/org/hibernate/jsr303/tck/tests/validation/ValidatePropertyGwtTest.java
+++ b/user/test/org/hibernate/jsr303/tck/tests/validation/ValidatePropertyGwtTest.java
@@ -45,7 +45,6 @@
}
}
- @Failing(issue = 5804)
public void testValidateProperty() {
delegate.testValidateProperty();
}