hasOne |= checkValidationAnnotation( method, VALIDATE_DATE_TAG_NAME, _baseValidationRuleGrammar );
hasOne |= checkValidationAnnotation( method, VALIDATE_TYPE_TAG_NAME, _validateTypeGrammar );
*/
}
CoreAnnotationProcessorEnv env = getEnv();
// Make sure ActionForm subclasses are public static, and that they have default constructors.
if ( isFormBeanClass || CompilerUtils.isAssignableFrom( STRUTS_FORM_CLASS_NAME, jclass, env ) )
{
if ( jclass.getDeclaringType() != null && ! jclass.hasModifier( Modifier.STATIC ) )
{
getDiagnostics().addError( jclass, "error.form-not-static" );
}
if ( ! jclass.hasModifier( Modifier.PUBLIC ) )
{
getDiagnostics().addError( jclass, "error.form-not-public" );
}
if ( ! CompilerUtils.hasDefaultConstructor( jclass ) )
{
getDiagnostics().addError( jclass, "error.form-no-default-constructor" );
}
}
// check that a class with declarative validation uses a FormBean annotation
if (isFormBeanClass && !hasFormBeanAnnotation) {
getDiagnostics().addWarning(jclass, "warning.validatable-formbean-use-formbean",
ANNOTATION_INTERFACE_PREFIX + FORM_BEAN_TAG_NAME);
}
// Check to see if this class extends the (deprecated) FormData class and overrides its validate() method.
// If so, then declarative validation annotations won't work unless the override calls super.validate().
// Print a warning describing this behavior and suggesting implementing Validatable instead.
methods = jclass.getMethods();
if (CompilerUtils.isAssignableFrom(PAGEFLOW_FORM_CLASS_NAME, jclass, env)) {
for (int i = 0; i < methods.length; i++) {
MethodDeclaration method = methods[i];
if (method.getSimpleName().equals("validate")) {
ParameterDeclaration[] params = method.getParameters();
if (params.length == 2) {
TypeInstance param1Type = params[0].getType();
TypeInstance param2Type = params[1].getType();
if (param1Type instanceof DeclaredType && param2Type instanceof DeclaredType) {
TypeDeclaration param1Decl = ((DeclaredType) param1Type).getDeclaration();
TypeDeclaration param2Decl = ((DeclaredType) param2Type).getDeclaration();
TypeDeclaration actionMappingDecl = env.getTypeDeclaration(STRUTS_ACTION_MAPPING_CLASS_NAME);
TypeDeclaration httpRequestDecl = env.getTypeDeclaration(HTTP_REQUEST_CLASS_NAME);
if (param1Decl != null && CompilerUtils.typesAreEqual(param1Decl, actionMappingDecl)
&& param2Decl != null && CompilerUtils.typesAreEqual(param2Decl, httpRequestDecl)) {
getDiagnostics().addWarning(method, "warning.formdata-override-validate",
jclass.getQualifiedName(), PAGEFLOW_FORM_CLASS_NAME,