Search code examples
thrift

How to get (properly) rid of Thrift Compiler Warnings?


I am using Thrift for the first time and when I generate my classes, I get a bunch of warnings such as:

At least one of the problems in category 'cast' is not analysed due to a compiler option being ignored
At least one of the problems in category 'serial' is not analysed due to a compiler option being ignored

If I go into one of the generated classes and take out the corresponding string in the @SupressWarnings block, then the warning goes away. However, I am intimidated by the message at the top of each file:

 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING

So I am just wondering if this is okay for me to do, or if I should approach this a different way?

For context, I am also using Cursor/VSCode, Java, and Maven.


Solution

  • DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING

    This tells you that you edit the file at your own risk, which in particular is that the will get overridden and all your manual changes are then gone. Yet it still is your file and technically you can do what you want with. The message is just there to make you aware of the above risk. How you manage that risk is up to you.

    To make it even better, you might consider contributing to that open source project by either sending a patch or pull request that fixes the problem in the Thrift compiler, or at least file a ticket with a test case attached, so you don't have to do those changes manually every time the file is re-generated.