Hello,

I am using Avro Compiler (1.11.1) to generate Java Objects (PoJo) from Avro 
Schema (avsc) files.
I found a scenario, where if the field name starts with undersore (e.g. 
_employeeName), getter/setter names are generated using $ symbol 
(getEmployeeName$1()).
Debugging the scenario a bit, found that this is happening due to a check to 
detect conflicted fields as below:


SpecificCompile -> generateMethodName()



// Check for the special case in which the schema defines two fields whose
// names are identical except for the case of the first character:
char firstChar = field.name().charAt(0);
String conflictingFieldName = (Character.isLowerCase(firstChar) ? 
Character.toUpperCase(firstChar)
    : Character.toLowerCase(firstChar)) + (field.name().length() > 1 ? 
field.name().substring(1) : "");
boolean fieldNameConflict = schema.getField(conflictingFieldName) != null;


This check doesn't behave properly in case, fieldname starts with underscore 
(as it is same either Upper case or Small case), resulting is conflicted with 
itself only.
Has someone encountered this issue and is there any workaround?

Regards,
Kirti Dhar

Reply via email to