private boolean isCanonical ( final FileDescriptor file ) { final FileDescriptorProto proto = file . toProto ( ) ; if ( proto . hasOptions ( ) && proto . getOptions ( ) . getUninterpretedOptionCount ( ) > 0 ) { return false ; } for ( final FieldDescriptorProto field : proto . getExtensionList ( ) ) { if ( ! isFieldCanonical ( field ) ) { return false ; } } for ( final ServiceDescriptorProto serviceProto : proto . getServiceList ( ) ) { if ( ! isCanonical ( serviceProto ) ) { return false ; } } for ( final EnumDescriptorProto enumProto : proto . getEnumTypeList ( ) ) { if ( ! isCanonical ( enumProto ) ) { return false ; } } for ( final DescriptorProto message : proto . getMessageTypeList ( ) ) { if ( ! isMessageRefsCanonical ( message ) ) { return false ; } } return true ; }
very consuming and problematic!