From 7571e415bf21c3a158811532e98110c09264ec85 Mon Sep 17 00:00:00 2001 From: glelouet Date: Fri, 6 Oct 2023 20:32:50 +0200 Subject: [PATCH] #3517 added handler and test, nothing compiles ? --- .../eclipse/handlers/HandleOnstruct.java | 20 ++++++++++++ .../resource/before/OnstructBook.java | 32 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 src/core/lombok/eclipse/handlers/HandleOnstruct.java create mode 100644 test/transform/resource/before/OnstructBook.java diff --git a/src/core/lombok/eclipse/handlers/HandleOnstruct.java b/src/core/lombok/eclipse/handlers/HandleOnstruct.java new file mode 100644 index 0000000000..f332648478 --- /dev/null +++ b/src/core/lombok/eclipse/handlers/HandleOnstruct.java @@ -0,0 +1,20 @@ +package lombok.eclipse.handlers; + +import lombok.Onstruct; +import lombok.core.AnnotationValues; +import lombok.core.HandlerPriority; +import lombok.eclipse.EclipseAnnotationHandler; +import lombok.eclipse.EclipseNode; + +@HandlerPriority(65536) // same as HandleValue // TODO +public class HandleOnstruct extends EclipseAnnotationHandler { + + public static final HandleOnstruct INSTANCE = new HandleOnstruct(); + + @Override + public void handle(AnnotationValues annotation, Annotation ast, EclipseNode annotationNode) { + // TODO Auto-generated method stub + + } + +} diff --git a/test/transform/resource/before/OnstructBook.java b/test/transform/resource/before/OnstructBook.java new file mode 100644 index 0000000000..e77aa3013a --- /dev/null +++ b/test/transform/resource/before/OnstructBook.java @@ -0,0 +1,32 @@ +import java.util.Date; +import java.util.Objects; + +import lombok.AllArgsConstructor; +import lombok.Onstruct; +import lombok.experimental.Accessors; + +public class OnstructBook { + + @lombok.Getter + @AllArgsConstructor + public static class Book { + + private String author; + @Accessors(fluent = true) + private String name; + private Date editionDate; + private boolean purchasable; + + } + + void test() { + Book mybook = new Book("author0", "bookname0", new Date(), true); + @Onstruct(prefix = "b_") + Object author, name, editiondate, purchasable = mybook; + assert Objects.equals(mybook.getAuthor(), author); + assert Objects.equals(mybook.name(), name); + assert Objects.equals(mybook.getEditionDate(), editiondate); + assert Objects.equals(mybook.isPurchasable(), purchasable); + } + +}