It would be nice if the symbol solver would provide a way to read the annotations that are defined on a class declaration, method declaration or field declaration (and possibly all the others that apply). Since the annotation interface itself might not be present on the classpath it would be necessary to add some kind of wrapper that allows getting the declared annotation values.
For the Javassist and reflection model this should be implementable quite easily by just reading the values from the class or using reflection. In a simplified form, if all values are just literals (and no constant fields are referenced as values of an annotation), it could be also implemented for the JavaParser model. At a later point, this could be extended with a way to resolve these constant expressions.
Im currently using
final Optional<AnnotationExpr> rpgAnnotation = cu.getClassByName(mainClassInCompilationUnit)
.get()
.getAnnotationByClass(RPGSkipFormatter.class);
if (rpgAnnotation.isPresent()) { ... }
to get the information if a certain annotation is present on a given class.
Is that wrong?
I have no idea, I was moving issues from the old project to here. @ftomassetti might.
To me it seems correct.
Damn, we have too many features in this project, I am getting constantly surprised by things JP can do :D
Is the issue right, or is @stefanleh right? Can we close this?
Is the issue right, or is @stefanleh right? Can we close this?
Yes, tnx.
Most helpful comment
To me it seems correct.
Damn, we have too many features in this project, I am getting constantly surprised by things JP can do :D