java backend should use fully qualified names for domain types
--------------------------------------------------------------

                 Key: THRIFT-1019
                 URL: https://issues.apache.org/jira/browse/THRIFT-1019
             Project: Thrift
          Issue Type: Bug
          Components: Java - Compiler
            Reporter: Peter Schuller
            Priority: Minor


This is a follow-up to THRIFT-1013. The left-overs from that is to also do 
fully qualified names for the domain classes (for example even with the changes 
in THRIFT-1013, our 'State' still conflicted because an inner class used for 
asynch method calls extended the TAsynchMethodCall, bringing State into scope).

Simply changing type_name() to always generate fully qualified names (not just 
when program differs) was very simple, but unfortunately was not enough. This 
exposes the issues that inner classes are not accessible by "package.classname" 
but rather as "package.outerclass.classname".

I found no trivial way to fix this because it requires maintaining some new 
state that is specific to the Java backend, and it affects code (particularly 
the client bit) that I'm not in a good position to test (currently using it 
only for server-side). I'm having to drop this for time reasons and instead 
rename the structure in our thrift spec for now, but I wanted to file the issue 
anyway even though i don't expect to submit a patch.

Briefly, what I would have started doing (though I'm not comfortable saying 
it's the cleanest way to do it), was to add a map member to the generator where 
one would put the information that maps a t_struct to its enclosing t_struct. 
This could be filled in while looping in generate_service_helpers(), and looked 
at in whenever type_name() is used to refer to a type. I'm not sure whether 
this is enough or not since I haven't tried it.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to