I’m writing a tests for my annotation processor with Google Compile-Testing and JUnit. How to provide some libraries, which present at maven(as example, “somegroup:somelib:1.0”), to compilation? Answer It can be reached by using withClasspathFrom for provide to test compilation all classes which available at test itself:
Tag: annotation-processing
Intellij Code Inspection for Custom Annotation
One of the problems I’ve encountered while using DTOs is that I often find myself shipping (accidentally) entities along with DTOs. To mitigate this problem, I created another Maven project with an annotation (@ValidDTO) and its processor that finds if a DTO annotated with @ValidDTO has @Entity annotated fields. This is my annotation. And, this is my processor. This is
How to get annotation parameter in annotation processor
I’m writing my own annotation processor and I’m trying to get parameter of my annotation like in the code below in process method: What I get is An exception occurred: javax.lang.model.type.MirroredTypesException: Attempt to access Class objects for TypeMirrors [] during build. Anyone know how to get annotation data? Answer The documentation on the getAnnotation method explains why Class<?> objects are