获取字段注释会拒绝访问

时间:2016-10-07 06:20:39

标签: java annotations

Annotation Access Denied

Hello Guys,

我试图在JDK 1.5中从字段中获取注释,但我得到了上图中提到的异常。

private WorkFlowHeader getFlowHeader(Field field)
    {
        for(Annotation annotationL:field.getAnnotations())
        {if(annotationL instanceof WorkFlowHeader)
            return (WorkFlowHeader) annotationL;
        }
        return null;
    }

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface WorkFlowHeader {
}

0 个答案:

没有答案