New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java generator: Added "java.lang." to all generated instances of type… #1119
Conversation
… java.lang.Object to enable the usage of "Object" as struct name in thrift.
Hi @ne0h, could you just create a JIRA ticket for this? @java devs: Comments anyone? |
Hi Jens-G, of course: https://issues.apache.org/jira/browse/THRIFT-3954 |
IMO this is a valid use case but it is not necessarily a great idea because in general its not very user friendly to design an API that clashes names in java.lang.* ... it is even more complicated in Thrift because other languages may also have constructs called "Object" (javascript for example). There is not a Java-specific technical reason why this shouldn't be allowed however. That said, there is a related JIRA, not exactly the same problem because java.lang classes do not require import statements, but the idea is the same: |
@bgould Generated code should always be explicitly fully pathed or namespaced and never make any assumptions. Thrift already uses namespaces so I would have no problem with org.king.Object as a thrift structure so long as it derives from java.lang.Object. If the code generator uses "Object" without qualifications that could be ambiguous, and that is a valid defect .. I like the idea of eliminating that. With regards to using a structure named Object, well that's really up to the folks using thrift, it isn't up to the thrift project to tell them how to name their structures and we should stay out of their way where we can. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generated code should always be fully explicit with namespaces, I like this change.
I agree completely. Didn't mean to give the impression that it shouldn't be supported. |
Client: Java Patch: Maximilian Hess <mail@ne0h.de> This closes apache#1119
Client: Java Patch: Maximilian Hess <mail@ne0h.de> This closes apache#1119
Client: Java Patch: Maximilian Hess <mail@ne0h.de> This closes apache#1119
Client: Java Patch: Maximilian Hess <mail@ne0h.de> This closes apache#1119
Client: Java Patch: Maximilian Hess <mail@ne0h.de> This closes apache#1119
… java.lang.Object to enable the usage of "Object" as struct name in thrift.