A type system for checking specialization of packages in object-oriented programming