Enhance validator and add compile-time annotation checking