I'm trying to track down th source of a warning:
warning: Cannot find annotation method 'itemFieldName()' in type 'com.thoughtworks.xstream.annotations.XStreamImplicit'
The relevant code is:
@XStreamAlias("things")
@XStreamImplicit(itemFieldName = "things")
private List<Thing> things;
Looking at the XStream JAR I see:
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
@java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD})
public static @interface XStreamImplicit {
java.lang.String itemFieldName() default "";
}
So I'm not really sure why I'm getting the warning. It does not appear to be causing problems, but I'm getting a bunch of these in my compiler output and I'd like to tidy them up.
Edit: Did some more digging and found this: http://java.dzone.com/articles/when-good-annotations-go-bad look at the comment from "Fabrizio"
Hmm.... maybe I'm answering too in a hurry and I didn't understand well... but AFAIK when you have compiled a class C1 that is annotated with A, you can put C1 in the compile (and run) classpath for C2 without the need of putting A in C2 classpath.You only get warnings and A is ignored (as it's proper to do: annotations have a meaning only in a certain context, and in C2 context A is meaningless).
I' ve just double checked, compiling a sample class X against a JAR that contains javax.persistence annotations (but not putting jpa.jar in the compiler classpath):
istral:/tmp> javac -classpath it-tidalwave-catalog.jar X.java it/tidalwave/catalog/persistence/CategoryPB.class(it/tidalwave/catalog/persistence:CategoryPB.class): warning: Cannot find annotation method 'name()' in type 'javax.persistence.Table': class file for javax.persistence.Table not found it/tidalwave/catalog/persistence/CategoryPB.class(it/tidalwave/catalog/persistence:CategoryPB.class): warning: Cannot find annotation method 'length()' in type 'javax.persistence.Column': class file for javax.persistence.Column not found it/tidalwave/catalog/persistence/CategoryPB.class(it/tidalwave/catalog/persistence:CategoryPB.class): warning: Cannot find annotation method 'name()' in type 'javax.persistence.Column'
etc... Just warnings, the compilation is successful.
So I think, this is just an annotation/classpath issue.