Java Annotation编译错误“找不到不兼容的类型”

时间:2013-07-04 12:02:57

标签: java compilation annotations

我正在编译其中一个注释时抛出编译错误,如

,这是一个奇怪的错误
[javac] /src/main/java/com/FilterResult.java:29: incompatible types  
[javac] found   : com.FilterResult.Mode  
[javac] required: com.FilterResult.Mode  
[javac]Mode value() default Mode.ENABLE;  

我的源代码内容如下:

package com;

import java.lang.annotation.Documented;

import java.lang.annotation.ElementType;

import java.lang.annotation.Retention;

import java.lang.annotation.RetentionPolicy;

import java.lang.annotation.Target;

@Documented

@Target(value=ElementType.METHOD)

@Retention(RetentionPolicy.RUNTIME)

public @interface FilterResult
{
   public enum Mode { ENABLE, DISABLE };

   Mode value() default Mode.ENABLE;
}

有人可以帮我解决这个问题吗?

使用的JDK版本是1.6U27,并且只有在使用ant编译时才会出现此错误。直接jdk编译通过。

0 个答案:

没有答案