Denys Rtveliashvili created THRIFT-5329:
-------------------------------------------
Summary: Shorten names of inner classes in Java code generated by
the compiler
Key: THRIFT-5329
URL: https://issues.apache.org/jira/browse/THRIFT-5329
Project: Thrift
Issue Type: Improvement
Components: Java - Compiler
Affects Versions: 0.13.0
Reporter: Denys Rtveliashvili
Sometimes, when method names in IDL are particularly long, the compiler is
generating Java code which cannot be compiled.
The class corresponding to a service contains two inner classes corresponding
to the method and those inner classes contain private inner classes. There is a
bit of tautology as the name of the method is present in both levels of inner
classes.
For example, when the Thrift IDL looks like this:
{code:java}
namespace java com.acmecorporation.projects.bestproductever
service ExtremelyVeryImportantService {
string performImportantActionAndReportOnSuccess(1: string action)
}
{code}
The generated Java code may fail with an error like this:
{noformat}
/home/user/src/thrift-code-example/target/generated-sources/thrift/com/acmecorporation/projects/bestproductever/ExtremelyVeryImportantService.java:[518,19]
error: error while writing
performImportantActionAndReportOnSuccess_argsStandardSchemeFactory:
/home/user/src/thrift-code-example/target/classes/com/acmecorporation/projects/bestproductever/ExtremelyVeryImportantService$performImportantActionAndReportOnSuccess_args$performImportantActionAndReportOnSuccess_argsStandardSchemeFactory.class:
File name too long{noformat}
Naturally, there is more than one reason why the name is too long, but a simple
optimisation can be made nevertheless by removing the name of method from the
names of inner classes in the innermost level.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)