-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in FieldImpl.getName() Method: Incorrect Handling of Multiple Variables in One Line #339
Comments
Thanks for the report! Roaster requires Java 17 because Eclipse JDT (the library it depends on) requires JDK 17, that's why we can't build Roaster with JDK 11. I can have a look, but if you could provide the fix in a pull request (with a test demonstrating the bug) it would be easier |
The fix is now in 2.28.1.Final and 2.30.1.Final. Enjoy! |
@gastaldi Thank you very much for the prompt fix and release. However, I encountered a couple of issues:
|
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
The text was updated successfully, but these errors were encountered: