Cor*_*ore 12 java ant aop spring annotations
[javac] C:\ws\galileo\test\Cacheable.java:13: incompatible types
[javac] found : com.io.CacheType
[javac] required: com.io.CacheType
[javac] public CacheType id() default CacheType.COMMON;
Run Code Online (Sandbox Code Playgroud)
我真的不懂这个.我有一个项目,我自定义为Spring构建一个缓存拦截器.它只是通过缓存名称来指向EhCache并使用aop-autoproxy来加载CacheableAspect(这是我的缓存拦截器).现在,当我在注释中使用默认值时,ANT会在下面给出编译器错误.我尝试更新到最新的JDK(我现在在1.6 16)并在ant脚本中设置源/目标级别但没有成功.当我删除默认值并强制所有区域指定一个值时,它会在ant中编译.
它总是在Eclipse中工作,我的单元测试与之前的默认值完美匹配.
是什么赋予了?我尝试构建一个项目(没有弹簧),简单地用ant回显配置,并在ant fine(和eclipse)中编译.
告诉我可能它可能是春天自动代理的某种方式?但那么为什么编译器不会给我生成的类型名称?GRRRR.有什么想法吗?
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import com.io.CacheType;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
public @interface Cacheable {
public CacheType value() default Cachetype.COMMON;
}
public enum CacheType {
COMMON("common"),
PERSISTENT("persistent";
private String cache;
CacheType(String cache) {
this.cache = cache;
}
public String cache() {
return this.cache;
}
}
Run Code Online (Sandbox Code Playgroud)
yur*_*rez 18
仍然存在于JDK 6u25中,但是将包添加到默认值就可以了:
CacheType value() default com.io.CacheType.COMMON;
Run Code Online (Sandbox Code Playgroud)