Open shekhargulati opened 8 years ago
This was from a while ago, so I'll post some code snippets to refresh your memory. I've been wrestling with a problem trying to get a Transform to utilize the default value for the annotation parameters when empty.
`import playground.Hash
@Hash
class Foo{
String msg`
where in Hash:
String algorithm() default "SHA1";
the AnnotationNode will have null for .getMember("algorithm")
In ToHashAdderAstTransformation you get around this by checking for null and providing the default value again:
List<ASTNode> astNodes = new AstBuilder() .buildFromString(String.format(hashString, classNode.getName(), hashProvider != null ? hashProvider.getValue() : "SHA1"));
Is there a way to use the actual default value set in the Annotation class? What is the point of supplying it if it is not available to the Transform class? Thanks for any help you can provide.
Please provide your feedback by posting a comment against this issue.