Skip to content

Commit

Permalink
#3517 added handler and test, nothing compiles ?
Browse files Browse the repository at this point in the history
  • Loading branch information
glelouet committed Oct 6, 2023
1 parent 82dd428 commit 7571e41
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/core/lombok/eclipse/handlers/HandleOnstruct.java
Original file line number Diff line number Diff line change
@@ -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<Onstruct> {

public static final HandleOnstruct INSTANCE = new HandleOnstruct();

@Override
public void handle(AnnotationValues<Onstruct> annotation, Annotation ast, EclipseNode annotationNode) {
// TODO Auto-generated method stub

}

}
32 changes: 32 additions & 0 deletions test/transform/resource/before/OnstructBook.java
Original file line number Diff line number Diff line change
@@ -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);
}

}

0 comments on commit 7571e41

Please sign in to comment.