你是否突然遇到这样的报错?
java: 未知的枚举常量 org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.NON_NULL
原因: 找不到org.codehaus.jackson.map.annotate.JsonSerialize$Inclusion的类文件
java: 未知的枚举常量 org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.NON_NULL
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 <T> T jbUnwrap(Class<? extends T> iface, T wrapper) {
T unwrapped = null;
try {
final Class<?> apiWrappers = wrapper.getClass().getClassLoader().loadClass("org.jetbrains.jps.javac.APIWrappers");
final Method unwrapMethod = apiWrappers.getDeclaredMethod("unwrap", Class.class, Object.class);
unwrapped = iface.cast(unwrapMethod.invoke(null, iface, wrapper));
}
catch (Throwable ignored) {}
return unwrapped != null? unwrapped : wrapper;
}
java: Workaround: to make project compile with the current annotation processor implementation, start JPS with VM option: -Djps.track.ap.dependencies=false
When run from IDE, the option can be set in "Compiler Settings | build process VM options"
java: java.lang.IllegalArgumentException
java: java.lang.IllegalArgumentException
解决方法:
拿走不谢!
-Djps.track.ap.dependencies=false