Ant 中的 Java 编译错误:在注释中使用类文字
我在一个类上有以下 Java 注释(用于 myBatis 插件):
@Intercepts({ @Signature(type = ResultSetHandler.class, method = "handleResultSets", args = (Statement.class)) })
public class MyResultSetHandlerPlugin implements Interceptor {
//do stuff...
}
它在 Eclipse 中编译并正常工作,但是当尝试运行 Ant 构建脚本时,出现以下错误:
[javac] C:CLIP_PoC\src\com\lmig\am\claims\clip\MyPResultSetHandlerPlugin.java:27: annotation value must be a class literal
[javac] @Intercepts({ @Signature(type = ResultSetHandler.class, method = "handleResultSets", args = (Statement.class)) })
[javac] ^
[javac] 1 error
我已尝试完全限定所使用的类在注释中,但这会导致相同的错误。对我做错了什么有什么想法吗?
谢谢。
I have the following Java annotation on a class (it's for a myBatis plugin):
@Intercepts({ @Signature(type = ResultSetHandler.class, method = "handleResultSets", args = (Statement.class)) })
public class MyResultSetHandlerPlugin implements Interceptor {
//do stuff...
}
It compiles and works fine in Eclipse, but when trying to run an Ant build script, I get the following error:
[javac] C:CLIP_PoC\src\com\lmig\am\claims\clip\MyPResultSetHandlerPlugin.java:27: annotation value must be a class literal
[javac] @Intercepts({ @Signature(type = ResultSetHandler.class, method = "handleResultSets", args = (Statement.class)) })
[javac] ^
[javac] 1 error
I've tried fully qualifying the classes used in the annotation, but that results in the same error. Any thoughts on what I'm doing wrong?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您尝试将项目数组作为注释参数传递,则需要使用花括号而不是圆括号来指示该项目是数组。
If you are attempting to pass an array of items as an annotation parameter, you need to use curly braces, not parenthesis to indicate that the item is an array.