A type safe state abstraction for coordination in Java -like languages