마법 오류가 나타납니다구아바 캐시 제네릭 오류
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import java.util.concurrent.ConcurrentMap;
public class Main {
private static ConcurrentMap<Long, Object> cache = CacheBuilder
.newBuilder()
.build(new CacheLoader<Long, Object>() {
@Override
public Object load(Long key) throws Exception {
return null;
}
}).asMap();
}
자바 컴파일 오류 : 사용하는 동안 1.6
이Error:(17, 21) java: C:\JavaWorkspace\untitled\src\...\Main.java:17: incompatible types
found : java.util.concurrent.ConcurrentMap<java.lang.Object,java.lang.Object>
required: java.util.concurrent.ConcurrentMap<java.lang.Long,java.lang.Object>
구아바 버전이 20.0 자바 버전입니다 자바 1.8 및 구아바 23.0 - 괜찮습니다!
private static LoadingCache<Long, Object> cache = CacheBuilder
.newBuilder()
.build(new CacheLoader<Long, Object>() {
@Override
public Object load(Long key) throws Exception {
return null;
}
});
private static ConcurrentMap<Long, Object> cacheMap = cache.asMap();
나는 지금까지 본 마법 습관이 – user2602807