We have encountered a bug in the getName() method of the FieldImpl class in the Roaster library version 2.28.0.Final. When multiple variable declarations are made on the same line (e.g., String a, b;), the method returns the name of the first variable (a) for both variables instead of returning the correct name (b) for the second variable.
steps to reproduce:
JavaType<?> javaType = Roaster.parse(MultipleFieldDeclarationDataObject);
if (javaType instanceof FieldHolderSource) {
FieldHolderSource fieldHolderSource = (FieldHolderSource) javaType;
fieldHolderSource.getFields().forEach(f -> System.out.println(f.getName()));
}
Environment:
Roaster Version: 2.28.0.Final
Java Version: 11 (Although we know newer versions support Java 17, we need a fix that remains compatible with Java 11)
This issue is urgent because it affects our application's core functionality in production. We ask for your quick attention.
Thanks in advance.
MultipleFieldDeclarationDataObject.txt
We have encountered a bug in the getName() method of the FieldImpl class in the Roaster library version 2.28.0.Final. When multiple variable declarations are made on the same line (e.g., String a, b;), the method returns the name of the first variable (a) for both variables instead of returning the correct name (b) for the second variable.
steps to reproduce:
JavaType<?> javaType = Roaster.parse(MultipleFieldDeclarationDataObject);
if (javaType instanceof FieldHolderSource) {
FieldHolderSource fieldHolderSource = (FieldHolderSource) javaType;
fieldHolderSource.getFields().forEach(f -> System.out.println(f.getName()));
}
Environment:
Roaster Version: 2.28.0.Final
Java Version: 11 (Although we know newer versions support Java 17, we need a fix that remains compatible with Java 11)
This issue is urgent because it affects our application's core functionality in production. We ask for your quick attention.
Thanks in advance.
MultipleFieldDeclarationDataObject.txt