Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-5329

Shorten names of inner classes in Java code generated by the compiler

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 0.13.0
    • Fix Version/s: None
    • Component/s: Java - Compiler
    • Labels:
      None

      Description

      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:

      namespace java com.acmecorporation.projects.bestproductever
      
      service ExtremelyVeryImportantService {
        string performImportantActionAndReportOnSuccess(1: string action)
      }
      

       

      The generated Java code may fail with an error like this:

      /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

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                Rtveliashvili Denys Rtveliashvili
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m