public override ExprNode Validate(ExprValidationContext validationContext) { if (OptionalType != null) { Type clazz = null; try { clazz = TypeHelper.GetClassForName( OptionalType.ClassIdentifier, validationContext.ImportService.ClassForNameProvider); } catch (TypeLoadException) { } if (clazz == null) { clazz = TypeHelper.GetTypeForSimpleName( OptionalType.ClassIdentifier, validationContext.ImportService.ClassForNameProvider); } if (clazz != null) { ResolvedType = clazz; } else { try { ResolvedType = validationContext.ImportService.ResolveClass( OptionalType.ClassIdentifier, false, validationContext.ClassProvidedExtension); } catch (ImportException e) { throw new ExprValidationException( "Failed to resolve type '" + OptionalType.ClassIdentifier + "': " + e.Message, e); } } if (ResolvedType != null && OptionalType.IsArrayOfPrimitive && ResolvedType.CanBeNull()) { throw new ExprValidationException( "Invalid use of the '" + ClassIdentifierWArray.PRIMITIVE_KEYWORD + "' keyword for non-primitive type '" + ResolvedType.Name + "'"); } if (!OptionalType.IsArrayOfPrimitive) { ResolvedType = ResolvedType.GetBoxedType(); } ResolvedType = TypeHelper.GetArrayType(ResolvedType, OptionalType.ArrayDimensions); } return null; }