Index: applications/editors/josm/plugins/imagerycache/src/org/mapdb/AsyncWriteEngine.java
===================================================================
--- applications/editors/josm/plugins/imagerycache/src/org/mapdb/AsyncWriteEngine.java	(revision 30197)
+++ applications/editors/josm/plugins/imagerycache/src/org/mapdb/AsyncWriteEngine.java	(revision 30532)
@@ -49,6 +49,5 @@
     protected Throwable writerFailedException = null;
 
-
-    protected final LongConcurrentHashMap<Fun.Tuple2<Object,Serializer>> items = new LongConcurrentHashMap<Fun.Tuple2<Object, Serializer>>();
+    protected final LongConcurrentHashMap<Fun.Tuple2<Object,Serializer<Object>>> items = new LongConcurrentHashMap<>();
 
     protected final Thread newRecidsThread = new Thread("MapDB prealloc #"+threadNum){
@@ -73,5 +72,5 @@
 
                 for(;;){
-                    LongMap.LongMapIterator<Fun.Tuple2<Object,Serializer>> iter = items.longMapIterator();
+                    LongMap.LongMapIterator<Fun.Tuple2<Object,Serializer<Object>>> iter = items.longMapIterator();
 
                     if(!iter.moveToNext()){
@@ -87,5 +86,5 @@
                                     while(iter.moveToNext()){
                                         long recid = iter.key();
-                                        Fun.Tuple2<Object,Serializer> value = iter.value();
+                                        Fun.Tuple2<Object,Serializer<Object>> value = iter.value();
                                         if(value.a==DELETED){
                                             AsyncWriteEngine.super.delete(recid, value.b);
@@ -107,5 +106,5 @@
                         Utils.lock(writeLocks,recid);
                         try{
-                            Fun.Tuple2<Object,Serializer> value = iter.value();
+                            Fun.Tuple2<Object,Serializer<Object>> value = iter.value();
                             if(value.a==DELETED){
                                 AsyncWriteEngine.super.delete(recid, value.b);
@@ -165,4 +164,5 @@
     }
 
+    @SuppressWarnings("unchecked")
     @Override
     public <A> A get(long recid, Serializer<A> serializer) {
@@ -172,5 +172,5 @@
             try{
                 checkState();
-                Fun.Tuple2<Object,Serializer> item = items.get(recid);
+                Fun.Tuple2<Object,Serializer<Object>> item = items.get(recid);
                 if(item!=null){
                     if(item.a == DELETED) return null;
@@ -187,4 +187,5 @@
     }
 
+    @SuppressWarnings({ "rawtypes", "unchecked" })
     @Override
     public <A> void update(long recid, A value, Serializer<A> serializer) {
@@ -206,4 +207,5 @@
     }
 
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     @Override
     public <A> boolean compareAndSwap(long recid, A expectedOldValue, A newValue, Serializer<A> serializer) {
@@ -212,5 +214,5 @@
         try{
             checkState();
-            Fun.Tuple2<Object, Serializer> existing = items.get(recid);
+            Fun.Tuple2<Object, Serializer<Object>> existing = items.get(recid);
             A oldValue = existing!=null? (A) existing.a : super.get(recid, serializer);
             if(oldValue == expectedOldValue || (oldValue!=null && oldValue.equals(expectedOldValue))){
@@ -226,4 +228,5 @@
     }
 
+    @SuppressWarnings("unchecked")
     @Override
     public <A> void delete(long recid, Serializer<A> serializer) {
@@ -245,5 +248,4 @@
             shutdownCondition.await();
 
-
             super.close();
         } catch (InterruptedException e) {
@@ -251,6 +253,4 @@
         }
     }
-
-
 
     protected WeakReference<Engine> parentEngineWeakRef = null;
@@ -302,4 +302,3 @@
         }
     }
-
 }
Index: applications/editors/josm/plugins/imagerycache/src/org/mapdb/BTreeKeySerializer.java
===================================================================
--- applications/editors/josm/plugins/imagerycache/src/org/mapdb/BTreeKeySerializer.java	(revision 30197)
+++ applications/editors/josm/plugins/imagerycache/src/org/mapdb/BTreeKeySerializer.java	(revision 30532)
@@ -18,7 +18,7 @@
     static final class BasicKeySerializer extends BTreeKeySerializer<Object> {
 
-        protected final Serializer defaultSerializer;
+        protected final Serializer<Object> defaultSerializer;
 
-        BasicKeySerializer(Serializer defaultSerializer) {
+        BasicKeySerializer(Serializer<Object> defaultSerializer) {
             this.defaultSerializer = defaultSerializer;
         }
Index: applications/editors/josm/plugins/imagerycache/src/org/mapdb/BTreeMap.java
===================================================================
--- applications/editors/josm/plugins/imagerycache/src/org/mapdb/BTreeMap.java	(revision 30197)
+++ applications/editors/josm/plugins/imagerycache/src/org/mapdb/BTreeMap.java	(revision 30532)
@@ -275,5 +275,4 @@
     }
 
-
     protected final Serializer<BNode> nodeSerializer = new Serializer<BNode>() {
         @Override
@@ -298,11 +297,8 @@
                     }
                 }
-
-            }
-
+            }
 
             final boolean left = value.keys()[0] == null;
             final boolean right = value.keys()[value.keys().length-1] == null;
-
 
             final int header;
@@ -334,6 +330,4 @@
             }
 
-
-
             out.write(header);
             out.write(value.keys().length);
@@ -346,6 +340,4 @@
                     Utils.packLong(out, child);
             }
-
-
 
             keySerializer.serialize(out,left?1:0,
Index: applications/editors/josm/plugins/imagerycache/src/org/mapdb/Bind.java
===================================================================
--- applications/editors/josm/plugins/imagerycache/src/org/mapdb/Bind.java	(revision 30197)
+++ applications/editors/josm/plugins/imagerycache/src/org/mapdb/Bind.java	(revision 30532)
@@ -4,5 +4,4 @@
 import java.util.Map;
 import java.util.NavigableSet;
-import java.util.Set;
 import java.util.concurrent.ConcurrentMap;
 
@@ -21,9 +20,10 @@
             public Iterator<K1> iterator() {
                 //use range query to get all values
+                @SuppressWarnings("unchecked")
                 final Iterator<Fun.Tuple2<K2,K1>> iter =
-                    ((NavigableSet)secondaryKeys) //cast is workaround for generics
+                    secondaryKeys
                         .subSet(
-                                Fun.t2(secondaryKey,null), //NULL represents lower bound, everything is larger than null
-                                Fun.t2(secondaryKey,Fun.HI) // HI is upper bound everything is smaller then HI
+                                Fun.t2(secondaryKey,(K1)null), //NULL represents lower bound, everything is larger than null
+                                Fun.t2(secondaryKey,(K1)Fun.HI) // HI is upper bound everything is smaller then HI
                         ).iterator();
 
@@ -59,10 +59,10 @@
     }
 
-    public static void size(MapWithModificationListener map, final Atomic.Long size){
+    public static <K,V> void size(MapWithModificationListener<K, V> map, final Atomic.Long size){
         //set initial value first if necessary
         if(size.get() == 0 && map.isEmpty())
             size.set(map.size()); //TODO long overflow?
 
-        map.addModificationListener(new MapListener() {
+        map.addModificationListener(new MapListener<K, V>() {
             @Override
             public void update(Object key, Object oldVal, Object newVal) {
Index: applications/editors/josm/plugins/imagerycache/src/org/mapdb/CacheLRU.java
===================================================================
--- applications/editors/josm/plugins/imagerycache/src/org/mapdb/CacheLRU.java	(revision 30197)
+++ applications/editors/josm/plugins/imagerycache/src/org/mapdb/CacheLRU.java	(revision 30532)
@@ -78,5 +78,5 @@
             Utils.lock(locks,recid);
             Engine engine = getWrappedEngine();
-            LongMap cache2 = checkClosed(cache);
+            LongMap<Object> cache2 = checkClosed(cache);
             Object oldValue = cache.get(recid);
             if(oldValue == expectedOldValue || oldValue.equals(expectedOldValue)){
@@ -94,5 +94,4 @@
         }
     }
-
 
     @SuppressWarnings("rawtypes")
Index: applications/editors/josm/plugins/imagerycache/src/org/mapdb/EngineWrapper.java
===================================================================
--- applications/editors/josm/plugins/imagerycache/src/org/mapdb/EngineWrapper.java	(revision 30197)
+++ applications/editors/josm/plugins/imagerycache/src/org/mapdb/EngineWrapper.java	(revision 30532)
@@ -14,7 +14,5 @@
  *  limitations under the License.
  */
-
 package org.mapdb;
-
 
 import java.io.IOError;
@@ -26,5 +24,4 @@
 import java.util.concurrent.ConcurrentLinkedQueue;
 
-
 /**
  * EngineWrapper adapter. It implements all methods on Engine interface.
@@ -293,17 +290,16 @@
     }
 
-
     /**
      * check if Record Instances were not modified while in cache.
      * Usuful to diagnose strange problems with Instance Cache.
      */
-    public static class ImmutabilityCheckEngine extends EngineWrapper{
-
-        protected static class Item {
-            final Serializer serializer;
-            final Object item;
+    public static class ImmutabilityCheckEngine extends EngineWrapper {
+
+        protected static class Item<E> {
+            final Serializer<E> serializer;
+            final E item;
             final int oldChecksum;
 
-            public Item(Serializer serializer, Object item) {
+            public Item(Serializer<E> serializer, E item) {
                 if(item==null || serializer==null) throw new AssertionError("null");
                 this.serializer = serializer;
@@ -313,5 +309,5 @@
             }
 
-            private int checksum(){
+            private int checksum() {
                 try {
                     DataOutput2 out = new DataOutput2();
@@ -324,5 +320,5 @@
             }
 
-            void check(){
+            void check() {
                 int newChecksum = checksum();
                 if(oldChecksum!=newChecksum) throw new AssertionError("Record instance was modified: \n  "+item+"\n  "+serializer);
@@ -330,5 +326,5 @@
         }
 
-        protected LongConcurrentHashMap<Item> items = new LongConcurrentHashMap<Item>();
+        protected LongConcurrentHashMap<Item<?>> items = new LongConcurrentHashMap<>();
 
         protected ImmutabilityCheckEngine(Engine engine) {
@@ -338,8 +334,8 @@
         @Override
         public <A> A get(long recid, Serializer<A> serializer) {
-            Item item = items.get(recid);
+            Item<?> item = items.get(recid);
             if(item!=null) item.check();
             A ret = super.get(recid, serializer);
-            if(ret!=null) items.put(recid, new Item(serializer,ret));
+            if(ret!=null) items.put(recid, new Item<A>(serializer,ret));
             return ret;
         }
@@ -348,5 +344,5 @@
         public <A> long put(A value, Serializer<A> serializer) {
             long ret =  super.put(value, serializer);
-            if(value!=null) items.put(ret, new Item(serializer,value));
+            if(value!=null) items.put(ret, new Item<A>(serializer,value));
             return ret;
         }
@@ -354,13 +350,14 @@
         @Override
         public <A> void update(long recid, A value, Serializer<A> serializer) {
-            Item item = items.get(recid);
+            Item<?> item = items.get(recid);
             if(item!=null) item.check();
             super.update(recid, value, serializer);
-            if(value!=null) items.put(recid, new Item(serializer,value));
-        }
-
+            if(value!=null) items.put(recid, new Item<A>(serializer,value));
+        }
+
+        @SuppressWarnings({ "unchecked", "rawtypes" })
         @Override
         public <A> boolean compareAndSwap(long recid, A expectedOldValue, A newValue, Serializer<A> serializer) {
-            Item item = items.get(recid);
+            Item<?> item = items.get(recid);
             if(item!=null) item.check();
             boolean ret = super.compareAndSwap(recid, expectedOldValue, newValue, serializer);
@@ -372,5 +369,5 @@
         public void close() {
             super.close();
-            for(Iterator<Item> iter = items.valuesIterator(); iter.hasNext();){
+            for(Iterator<Item<?>> iter = items.valuesIterator(); iter.hasNext();){
                 iter.next().check();
             }
@@ -378,5 +375,4 @@
         }
     }
-    
     
     /** Engine wrapper with all methods synchronized on global lock, useful to diagnose concurrency issues.*/ 
@@ -442,4 +438,3 @@
         }
     }
-
 }
Index: applications/editors/josm/plugins/imagerycache/src/org/mapdb/Queues.java
===================================================================
--- applications/editors/josm/plugins/imagerycache/src/org/mapdb/Queues.java	(revision 30197)
+++ applications/editors/josm/plugins/imagerycache/src/org/mapdb/Queues.java	(revision 30532)
@@ -40,4 +40,5 @@
             }
 
+            @SuppressWarnings("unchecked")
             @Override
             public Node<E> deserialize(DataInput in, int available) throws IOException {
@@ -71,4 +72,5 @@
         protected static final class Node<E>{
 
+            @SuppressWarnings({ "unchecked", "rawtypes" })
             protected static final Node EMPTY = new Node(0L, null);
 
@@ -302,4 +304,5 @@
     }
 
+    @SuppressWarnings("unchecked")
     static <E> Stack<E> getStack(Engine engine, Serializer<Serializer> serializerSerializer, long rootRecid){
         StackRoot root = engine.get(rootRecid, new StackRootSerializer(serializerSerializer));
@@ -323,4 +326,5 @@
         }
 
+        @SuppressWarnings("unchecked")
         @Override
         public boolean add(E item){
@@ -337,4 +341,5 @@
         }
 
+        @SuppressWarnings("unchecked")
         @Override
         public E poll(){
@@ -416,4 +421,5 @@
     }
 
+    @SuppressWarnings("unchecked")
     static <E> long createQueue(Engine engine, Serializer<Serializer> serializerSerializer, Serializer<E> serializer){
         long headerRecid = engine.put(0L, Serializer.LONG_SERIALIZER);
@@ -426,5 +432,5 @@
     }
 
-
+    @SuppressWarnings("unchecked")
     static <E> Queue<E> getQueue(Engine engine, Serializer<Serializer> serializerSerializer, long rootRecid){
         QueueRoot root = engine.get(rootRecid, new QueueRootSerializer(serializerSerializer));
@@ -439,4 +445,5 @@
         protected final long size;
 
+        @SuppressWarnings("unchecked")
         public CircularQueue(Engine engine, Serializer serializer, long headRecid, long headInsertRecid, long size) {
             super(engine, serializer, headRecid);
@@ -445,4 +452,5 @@
         }
 
+        @SuppressWarnings("unchecked")
         @Override
         public boolean add(Object o) {
@@ -545,4 +553,5 @@
     }
 
+    @SuppressWarnings({ "rawtypes", "unchecked" })
     static <E> long createCircularQueue(Engine engine, Serializer<Serializer> serializerSerializer, Serializer<E> serializer, long size){
         if(size<2) throw new IllegalArgumentException();
Index: applications/editors/josm/plugins/imagerycache/src/org/mapdb/SerializerBase.java
===================================================================
--- applications/editors/josm/plugins/imagerycache/src/org/mapdb/SerializerBase.java	(revision 30197)
+++ applications/editors/josm/plugins/imagerycache/src/org/mapdb/SerializerBase.java	(revision 30532)
@@ -354,5 +354,5 @@
         /** classes bellow need object stack, so initialize it if not alredy initialized*/
         if (objectStack == null) {
-            objectStack = new FastArrayList();
+            objectStack = new FastArrayList<>();
             objectStack.add(obj);
         }
@@ -1065,5 +1065,5 @@
 
         if (objectStack == null)
-            objectStack = new FastArrayList();
+            objectStack = new FastArrayList<>();
         int oldObjectStackSize = objectStack.size();
 
@@ -1112,5 +1112,5 @@
                 break;
             case SERIALIZER_COMPRESSION_WRAPPER:
-                ret = CompressLZF.CompressionWrapper((Serializer) deserialize(is, objectStack));
+                ret = CompressLZF.CompressionWrapper((Serializer<?>) deserialize(is, objectStack));
                 break;
             default:
Index: applications/editors/josm/plugins/imagerycache/src/org/mapdb/SerializerPojo.java
===================================================================
--- applications/editors/josm/plugins/imagerycache/src/org/mapdb/SerializerPojo.java	(revision 30197)
+++ applications/editors/josm/plugins/imagerycache/src/org/mapdb/SerializerPojo.java	(revision 30532)
@@ -542,5 +542,5 @@
     static{
         try{
-            Class clazz = Class.forName("sun.reflect.ReflectionFactory");
+            Class<?> clazz = Class.forName("sun.reflect.ReflectionFactory");
             if(clazz!=null){
                 Method getReflectionFactory = clazz.getMethod("getReflectionFactory");
@@ -582,5 +582,5 @@
      *   If non of these works we fallback into usual reflection which requires an no-arg constructor
      */
-    @SuppressWarnings("restriction")
+    @SuppressWarnings({ "restriction", "unchecked" })
 	protected <T> T createInstanceSkippinkConstructor(Class<T> clazz)
             throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException {
Index: applications/editors/josm/plugins/imagerycache/src/org/mapdb/SnapshotEngine.java
===================================================================
--- applications/editors/josm/plugins/imagerycache/src/org/mapdb/SnapshotEngine.java	(revision 30197)
+++ applications/editors/josm/plugins/imagerycache/src/org/mapdb/SnapshotEngine.java	(revision 30532)
@@ -36,4 +36,5 @@
     protected final ReentrantReadWriteLock snapshotsLock = new ReentrantReadWriteLock();
 
+    @SuppressWarnings("unchecked")
     @Override
     public <A> long put(A value, Serializer<A> serializer) {
@@ -50,4 +51,5 @@
     }
 
+    @SuppressWarnings("unchecked")
     @Override
     public <A> boolean compareAndSwap(long recid, A expectedOldValue, A newValue, Serializer<A> serializer) {
@@ -66,4 +68,5 @@
     }
 
+    @SuppressWarnings("unchecked")
     @Override
     public <A> void update(long recid, A value, Serializer<A> serializer) {
@@ -85,4 +88,5 @@
     }
 
+    @SuppressWarnings("unchecked")
     @Override
     public  <A> void delete(long recid, Serializer<A> serializer) {
@@ -130,4 +134,5 @@
 
 
+        @SuppressWarnings("unchecked")
         @Override
         public <A> A get(long recid, Serializer<A> serializer) {
Index: applications/editors/josm/plugins/imagerycache/src/org/mapdb/TxMaker.java
===================================================================
--- applications/editors/josm/plugins/imagerycache/src/org/mapdb/TxMaker.java	(revision 30197)
+++ applications/editors/josm/plugins/imagerycache/src/org/mapdb/TxMaker.java	(revision 30532)
@@ -11,4 +11,5 @@
 public class TxMaker {
 
+    @SuppressWarnings("unchecked")
     protected static final Fun.Tuple2<Object, Serializer> DELETED = new Fun.Tuple2(null, Serializer.STRING_SERIALIZER);
 
@@ -62,5 +63,4 @@
         protected Set<Long> newItems = new LinkedHashSet<Long>();
 
-
         protected TxEngine(Engine engine) {
             super(engine);
@@ -79,4 +79,5 @@
         }
 
+        @SuppressWarnings("unchecked")
         @Override
         public <A> A get(long recid, Serializer<A> serializer) {
@@ -93,4 +94,5 @@
         }
 
+        @SuppressWarnings({ "rawtypes", "unchecked" })
         @Override
         public <A> void update(long recid, A value, Serializer<A> serializer) {
@@ -128,4 +130,5 @@
         }
 
+        @SuppressWarnings({ "unchecked", "rawtypes" })
         @Override
         public void commit() {
@@ -144,5 +147,4 @@
                 engine.commit();
             }
-
         }
 
@@ -163,5 +165,4 @@
                 newItems = null;
             }
-
         }
 
@@ -171,5 +172,3 @@
         }
     }
-
-
 }
