Open dmlloyd opened 10 years ago
I've pushed up a fix here https://github.com/dmlloyd/metainf-services/tree/safe-apis which depends on my patch for #6 / #7 - use it if you want to, or don't.
Did not follow all of https://github.com/dmlloyd/metainf-services/commit/0d2f2a9b4495c627332dc06c264fcce943b175b5 (seems like some method inlining along with the primary change), but looks right to me.
If the annotation processor isn't linked with the compile-time dependencies of whatever you're building, then you will get CNFEs when it runs because of usage of the
javax.lang.model.element.Element#getAnnotation
method. The fix is to use the much more boringjavax.lang.model.element.Element#getAnnotationMirrors
method instead, and iterate the list until the right annotation is found, and then use the returned TypeMirror of the AnnotationValue to do type determination.