Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-3698

[Java] SpecificData.getClassName must replace reserved words

    XMLWordPrintableJSON

Details

    Description

      [Java] SpecificData.getClassName must replace reserved words

       

      When makes Java Class, SpecificCompiler adds "$" after reserved words like public, new, etc...

      https://github.com/apache/avro/blob/master/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java#L1129

      https://github.com/apache/avro/blob/master/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java#L643

       

      For example, if the namespace of a schema is db.public.table, then the package name of the generated Java Class, made by SpecificCompiler, is db.public$.table. (Because public is a reserved word in java)

       

      But when deserializes an Avro Record to a SpecificRecord, SpecificData.getClassName returns db.public.table.Name.

       

      So, it can't find a class by name from SpecificData.getClassName.

      Attachments

        Issue Links

          Activity

            People

              mgrigorov Martin Tzvetanov Grigorov
              seunghyun.cheong Seung-Hyun Cheong
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

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