Thank you Matthew for the quick response. Sorry that my question was not very clear. The document you shared is helpful.
Let me rephrase my question
The enum classes generated out of protoc version (very old), that we are using currently, do not throw any exception. So we have lot of usages of set<FieldNameXX> throughout the project for multiple classes. Now after changing to latest protoc generator, all these usages can throw exception runtime and crash the application. Finding direct usages of these classes are very difficult and given it is runtime exception, we can't be 100% sure we removed all those usages.
1) So I am looking for idea to tackle this situation.
2) How to make sure, in future, no one accidentally uses this set<FieldNameXX> or Enum.getNumber()methods [I am talking about huge team with lot of engineers]