0

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.

skaffman
  • 398,947
  • 96
  • 818
  • 769
holic87
  • 791
  • 2
  • 17
  • 29

1 Answers1

2

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.

@Intercepts({ @Signature(type = ResultSetHandler.class, method = "handleResultSets", args = {Statement.class}) })
Edwin Buck
  • 69,361
  • 7
  • 100
  • 138