Fix generics on LeadDocLookup
All the warnings were upsetting me. This doesn't change behavior.
@@ -33,9 +33,9 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Set;
-public class LeafDocLookup implements Map {
+public class LeafDocLookup implements Map<String, ScriptDocValues<?>> {
- private final Map<String, ScriptDocValues> localCacheFieldData = new HashMap<>(4);
+ private final Map<String, ScriptDocValues<?>> localCacheFieldData = new HashMap<>(4);
private final MapperService mapperService;
private final IndexFieldDataService fieldDataService;
@@ -67,10 +67,10 @@ public class LeafDocLookup implements Map {
}
@Override
- public Object get(Object key) {
+ public ScriptDocValues<?> get(Object key) {
// assume its a string...
String fieldName = key.toString();
- ScriptDocValues scriptValues = localCacheFieldData.get(fieldName);
+ ScriptDocValues<?> scriptValues = localCacheFieldData.get(fieldName);
if (scriptValues == null) {
final MappedFieldType fieldType = mapperService.fullName(fieldName);
if (fieldType == null) {
@@ -78,9 +78,9 @@ public class LeafDocLookup implements Map {
}
// load fielddata on behalf of the script: otherwise it would need additional permissions
// to deal with pagedbytes/ramusagestimator/etc
- scriptValues = AccessController.doPrivileged(new PrivilegedAction<ScriptDocValues>() {
+ scriptValues = AccessController.doPrivileged(new PrivilegedAction<ScriptDocValues<?>>() {
@Override
- public ScriptDocValues run() {
+ public ScriptDocValues<?> run() {
return fieldDataService.getForField(fieldType).load(reader).getScriptValues();
}
});
@@ -94,7 +94,7 @@ public class LeafDocLookup implements Map {
public boolean containsKey(Object key) {
// assume its a string...
String fieldName = key.toString();
- ScriptDocValues scriptValues = localCacheFieldData.get(fieldName);
+ ScriptDocValues<?> scriptValues = localCacheFieldData.get(fieldName);
if (scriptValues == null) {
MappedFieldType fieldType = mapperService.fullName(fieldName);
if (fieldType == null) {
@@ -120,17 +120,17 @@ public class LeafDocLookup implements Map {
}
@Override
- public Object put(Object key, Object value) {
+ public ScriptDocValues<?> put(String key, ScriptDocValues<?> value) {
throw new UnsupportedOperationException();
}
@Override
- public Object remove(Object key) {
+ public ScriptDocValues<?> remove(Object key) {
throw new UnsupportedOperationException();
}
@Override
- public void putAll(Map m) {
+ public void putAll(Map<? extends String, ? extends ScriptDocValues<?>> m) {
throw new UnsupportedOperationException();
}
@@ -140,17 +140,17 @@ public class LeafDocLookup implements Map {
}
@Override
- public Set keySet() {
+ public Set<String> keySet() {
throw new UnsupportedOperationException();
}
@Override
- public Collection values() {
+ public Collection<ScriptDocValues<?>> values() {
throw new UnsupportedOperationException();
}
@Override
- public Set entrySet() {
+ public Set<Map.Entry<String, ScriptDocValues<?>>> entrySet() {
throw new UnsupportedOperationException();
}
}
