[fixes #3181] Copy field name arrays in (Super)Builder

The eclipse SelectionEngine uses the identity, finds the field in the
builder and gets confused by the wrong source positions. If we clone the
array it only finds the correct field and it works as expected.
This commit is contained in:
Rawi01 committed 2022-05-20 00:08:05 +02:00
1 parent 1473389f39
commit 59717d0c95
2 files changed
+2 -2

No files matched your search

@@ -983,7 +983,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
}
if (field == null) {
FieldDeclaration fd = new FieldDeclaration(bfd.builderFieldName, 0, 0);
FieldDeclaration fd = new FieldDeclaration(bfd.builderFieldName.clone(), 0, 0);
fd.bits |= Eclipse.ECLIPSE_DO_NOT_TOUCH_FLAG;
fd.modifiers = ClassFileConstants.AccPrivate;
fd.type = copyType(bfd.type);
@@ -948,7 +948,7 @@ public class HandleSuperBuilder extends EclipseAnnotationHandler<SuperBuilder> {
}
if (field == null) {
FieldDeclaration fd = new FieldDeclaration(bfd.builderFieldName, 0, 0);
FieldDeclaration fd = new FieldDeclaration(bfd.builderFieldName.clone(), 0, 0);
fd.bits |= Eclipse.ECLIPSE_DO_NOT_TOUCH_FLAG;
fd.modifiers = ClassFileConstants.AccPrivate;
fd.type = copyType(bfd.type);