出于好奇:我关注 SSCCE
import javax.ws.rs.Path;
@Path("/")
public class T {
void a() {
Path p = getClass().getAnnotation(Path.class); //1
Class z = getClass();
p = z.getAnnotation(Path.class); //2
}
}
编译器给出以下错误信息:
T.java:12: incompatible types
found : java.lang.annotation.Annotation
required: javax.ws.rs.Path
p = z.getAnnotation(Path.class);
Note: T.java uses unchecked or unsafe operations.
//1 和 //2 行的区别是什么?