这是indexloc提供的服务,不要输入任何密码
Skip to content

Refactor symbol doesn't work with @Builder annotation #3181

@snjeza

Description

@snjeza

Steps to reproduce:

  • open the following file in Eclipse or VS Code
import lombok.Builder;
@Builder
public class Input {
	private String id;
}
  • select the id field
  • try to rename it
    You can also try to find its references.

The original issue: redhat-developer/vscode-java#2411

A potential patch:

diff --git a/src/core/lombok/eclipse/handlers/HandleBuilder.java b/src/core/lombok/eclipse/handlers/HandleBuilder.java
index a2dd5057..6c6e50a2 100755
--- a/src/core/lombok/eclipse/handlers/HandleBuilder.java
+++ b/src/core/lombok/eclipse/handlers/HandleBuilder.java
@@ -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);
@@ -991,7 +991,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
                                        field = injectFieldAndMarkGenerated(job.builderType, fd);
                                }
                                if (setFlag == null && bfd.nameOfSetFlag != null) {
-                                       FieldDeclaration fd = new FieldDeclaration(bfd.nameOfSetFlag, 0, 0);
+                                       FieldDeclaration fd = new FieldDeclaration(bfd.nameOfSetFlag.clone(), 0, 0);
                                        fd.bits |= Eclipse.ECLIPSE_DO_NOT_TOUCH_FLAG;
                                        fd.modifiers = ClassFileConstants.AccPrivate;
                                        fd.type = TypeReference.baseTypeReference(TypeIds.T_boolean, 0);

  • Version: 1.8.24
  • Platform: all

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions