Karthi~

I am not entirely sure I understand your question, but I suspect the note
on Java's enum behavior at
https://protobuf.dev/programming-guides/enum/#java might help.  If you use
the `get<FieldName>Value` and `set<FieldName>Value` methods they will not
throw exceptions.

Cheers,
Matt

On Mon, May 8, 2023 at 11:17 PM Karthi Ayappan <[email protected]>
wrote:

> Hi,
>
> Context: I am trying to migrate very old protoc generated models library
> (protobuf-lite which is no longer available) to protobuf-javalite. Once I
> switched to latest protoc version, the generated enum throws
> IllegalStateException on getNumber via setEnum methods. We have huge number
> of such usage in our very big project.
>
> Question:
> 1. How to gracefully avoid it without making sweeping changes in the code.
> I am talking about hundreds of such new enum classes and even more number
> of usages of those enums in multiple modules in our code. Specially I want
> to avoid this exception with minimal change.
> 2. Could someone point me to doc or give me context on why we have this
> unChecked exception (escpecially while referring from kotlin code).
>
> Any idea to fix this is very welcome. Thanks in advance.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/protobuf/54542179-cb17-43c7-b2cb-67268819c05en%40googlegroups.com
> <https://groups.google.com/d/msgid/protobuf/54542179-cb17-43c7-b2cb-67268819c05en%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/CAMiELU3aiEggVorDUTb0CYfPTkyq98%2Btty0W%2BbdA8H-Km0x_%3DA%40mail.gmail.com.

Reply via email to