Open dyorgio opened 8 years ago
I made a ASTHelper class, using '$' as prefix to allow reserved words as method names... The final result appears to be very good, on my point of view :P:
From:
@RefGetter
private Ref<Concorrent> concorrent;
Code:
private JCBlock body(JavacNode fieldNode) {
return $if($field(fieldNode).$neq().$null())
.$then(
$field(fieldNode).$set($invokeStatic("com.googlecode.objectify.Ref", "create", $invoke(fieldNode.getName(), "get"))),
$return($invoke(fieldNode.getName(), "get"))
).$else()
/* */.$return().$null().toBlock();
}
Result:
public Concorrent getConcorrent() {
if (concorrent != null){
concorrent = Ref.create(concorrent.get());
return concorrent.get();
} else {
return null;
}
}
second @dyorgio . "Lombok extension is a good feature to support I think. Many developers want to make specific instrumentations and use official lombok distro too." Is there a plan to do this? :)
I'm curious about this feature too. It's hard to find out how to fix this.
No error here, if you are not reusing lombok coer to "extend" lombok by creating your very own custom annotations leave them as they are otherwise do a custom build of the project to change the extension to .class to enable the classloader to load them.
I used lombok in my projects, but I have other annotations processors and it will be better if I could merge all in one.
So any news regarding this one? Can i create my own annotation using the 1.16 version? I'm getting: Cannot resolve symbol 'HandleUtilityClass' While trying import lombok.javac.handlers.HandleUtilityClass;
I made a ASTHelper class, using '$' as prefix to allow reserved words as method names... The final result appears to be very good, on my point of view :P:
From:
@RefGetter private Ref<Concorrent> concorrent;
Code:
private JCBlock body(JavacNode fieldNode) { return $if($field(fieldNode).$neq().$null()) .$then( $field(fieldNode).$set($invokeStatic("com.googlecode.objectify.Ref", "create", $invoke(fieldNode.getName(), "get"))), $return($invoke(fieldNode.getName(), "get")) ).$else() /* */.$return().$null().toBlock(); }
Result:
public Concorrent getConcorrent() { if (concorrent != null){ concorrent = Ref.create(concorrent.get()); return concorrent.get(); } else { return null; } }
Where can I find your ASTHelper
class?
Hello @Stephcraft here is all Handler classes: handler.zip
You need to replace Ref and @RefGetter (used for this example) with your cenario/classes/annotations.
Hello,
I already did a lombok extension with a new annotation and Handler. But it is just compatible with 1.14.x, because on 1.16.x There is no lombok.javac.JavacAnnotationHandler.class... just *.lombok files.
How can I extend lombok 1.16.x in another project?
Lombok extension is a good feature to support I think. Many developers want to make specific instrumentations and use official lombok distro too.