Open mouse0w0 opened 5 years ago
jsr 269自己写了个注解器,maven编译没问题,java -jar运行正常,但是idea运行的时候会报错:The class java.lang.IllegalArgumentException may be caused by the wrapped ProcessingEnvironm....... 要加上-Djps.track.ap.dependencies=false才能正常运行,这个是为什么呀
jsr 269自己写了个注解器,maven编译没问题,java -jar运行正常,但是idea运行的时候会报错:The class java.lang.IllegalArgumentException may be caused by the wrapped ProcessingEnvironm....... 要加上-Djps.track.ap.dependencies=false才能正常运行,这个是为什么呀
可以发一下详细的报错吗?
@mouse0w0
jsr 269自己写了个注解器,maven编译没问题,java -jar运行正常,但是idea运行的时候会报错:The class java.lang.IllegalArgumentException may be caused by the wrapped ProcessingEnvironm....... 要加上-Djps.track.ap.dependencies=false才能正常运行,这个是为什么呀
可以发一下详细的报错吗?
java: The class java.lang.IllegalArgumentException may be caused by the wrapped ProcessingEnvironment object. Please pass the wrapped ProcessingEnvironment further to super.init(). If you need to access the original ProcessingEnvironment object (e.g. for creating com.sun.source.util.Trees.instance(ProcessingEnvironment)), you may use following code in the processor implementation:
ProcessingEnvironment unwrappedprocessingEnv = jbUnwrap(ProcessingEnvironment.class, processingEnv);
where
private static
Please pass the wrapped ProcessingEnvironment further to super.init().
看起来应该是使用了IntelliJ自己的Java编译,按报错上的提示做吧。
@mouse0w0
Please pass the wrapped ProcessingEnvironment further to super.init().
看起来应该是使用了IntelliJ自己的Java编译,按报错上的提示做吧。
尝试了一下按照提示确实正常了,虽然还不知道为啥会这样(哭)
https://mouse0w0.github.io/2018/11/28/Introduce-to-Pluggable-Annotation-Processing-API/
插入式注解处理API(JSR269)是用于处理注解(元数据,JSR175)的一套API。其API位于javax.annotation.processing和javax.lang.model包下。 插入式注解处理API可以让你在编译期访问注解元数据,处理和自定义你的编译输出,像反射一样访问类、字段、方法和注解等元素,创建新的源文件等等。可用于减少编写配置文件的劳动量,提高代码可读性等等。本文中我们将