Need to resort to reflection to invoke private methods in generated java code.
Passing user identity from metastore client to server in non-secure mode
I work on the Hive project and this problem came up there in context of HIVE-2616. I need to extend the Processor which was generated by thrift compiler on this idl http://svn.apache.org/repos/asf/hive/trunk/metastore/if/hive_metastore.thrift . In my extended Processor https://reviews.apache.org/r/2975/diff/#12 I want to access some of the methods (namely getProcessMap() and getEmptyArgs()) of the super class but can't because they are private. As a workaround I resorted to Reflection. Is it possible to change visibility of these methods ?
I'd commit a patch that modified the visibility of these methods.
Awesome. Thanks, Bryan!
Here is my stab at it.
Are you sure that those protected methods need to become public? Also, I'd be more comfortable with an accessor method on TBaseProcessor that returns an immutable view of the processMap - we really don't want people to accidentally mess that map up by accessing it directly.
+1 for your approach Bryan, completely agree
New patch incorporating Bryan's suggestion of returning immutable view of processMap instead of directly returning it.
Thanks for updating your patch, committed
Integrated in Thrift #397 (See https://builds.apache.org/job/Thrift/397/)
Thrift-1465:Visibility of methods in generated java code
Patch: Ashutosh Chauhan
Changes visibility of processor getProcessMap() and getEmptyArgs() methods