Index: trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java	(revision 3451)
+++ trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java	(revision 3453)
@@ -575,19 +575,10 @@
         return true;
     }
-    // If anyone has suggestions for how to fix
-    // this properly, I'm listening :)
-    @SuppressWarnings("unchecked")
-    private T convert(Object raw)
-    {
-        return (T)raw;
-    }
     public boolean remove(Object o) {
-        return this.remove(convert(o));
-    }
-    public boolean remove(T o) {
+        @SuppressWarnings("unchecked") T t = (T) o;
         synchronized (split_lock) {
             search_cache = null; // Search cache might point to one of removed buckets
-            QBLevel bucket = root.findBucket(o.getBBox());
-            if (bucket.remove_content(o)) {
+            QBLevel bucket = root.findBucket(t.getBBox());
+            if (bucket.remove_content(t)) {
                 size--;
                 return true;
@@ -597,6 +588,7 @@
     }
     public boolean contains(Object o) {
-        QBLevel bucket = root.findBucket(convert(o).getBBox());
-        return bucket != null && bucket.content != null && bucket.content.contains(o);
+        @SuppressWarnings("unchecked") T t = (T) o;
+        QBLevel bucket = root.findBucket(t.getBBox());
+        return bucket != null && bucket.content != null && bucket.content.contains(t);
     }
 
Index: trunk/src/org/openstreetmap/josm/data/osm/Storage.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/Storage.java	(revision 3451)
+++ trunk/src/org/openstreetmap/josm/data/osm/Storage.java	(revision 3453)
@@ -111,5 +111,6 @@
         this.hash = ha;
         int cap = 1 << (int)(Math.ceil(Math.log(capacity/loadFactor) / Math.log(2)));
-        data = (T[]) new Object[cap];
+        @SuppressWarnings("unchecked") T[] newData = (T[]) new Object[cap];
+        data = newData;
         mask = data.length - 1;
         this.safeIterator = safeIterator;
@@ -118,5 +119,5 @@
     private void copyArray() {
         if (arrayCopyNecessary) {
-            T[] newData = (T[]) new Object[data.length];
+            @SuppressWarnings("unchecked") T[] newData = (T[]) new Object[data.length];
             System.arraycopy(data, 0, newData, 0, data.length);
             data = newData;
@@ -143,5 +144,6 @@
     @Override
     public synchronized boolean contains(Object o) {
-        int bucket = getBucket(hash, (T)o);
+        @SuppressWarnings("unchecked") T t = (T) o;
+        int bucket = getBucket(hash, t);
         return bucket >= 0;
     }
@@ -155,6 +157,7 @@
     @Override
     public synchronized boolean remove(Object o) {
-        T orig = removeElem((T)o);
-        return orig != null;
+        @SuppressWarnings("unchecked") T t = (T) o;
+        T tOrig = removeElem(t);
+        return tOrig != null;
     }
     
@@ -292,5 +295,5 @@
     private void ensureSpace() {
         if (size > data.length*loadFactor) { // rehash
-            T[] big = (T[]) new Object[data.length * 2];
+            @SuppressWarnings("unchecked") T[] big = (T[]) new Object[data.length * 2];
             int nMask = big.length - 1;
 
@@ -355,6 +358,7 @@
         }
 
-        public boolean containsKey(Object key) {
-            int bucket = getBucket(fHash, (K)key);
+        public boolean containsKey(Object o) {
+            @SuppressWarnings("unchecked") K key = (K) o;
+            int bucket = getBucket(fHash, key);
             return bucket >= 0;
         }
@@ -364,6 +368,7 @@
         }
 
-        public T get(Object key) {
-            int bucket = getBucket(fHash, (K)key);
+        public T get(Object o) {
+            @SuppressWarnings("unchecked") K key = (K) o;
+            int bucket = getBucket(fHash, key);
             return bucket < 0 ? null : data[bucket];
         }
@@ -374,7 +379,8 @@
         }
 
-        public T remove(Object key) {
+        public T remove(Object o) {
             modCount++;
-            int bucket = getBucket(fHash,(K)key);
+            @SuppressWarnings("unchecked") K key = (K) o;
+            int bucket = getBucket(fHash, key);
 
             return bucket < 0 ? null : doRemove(bucket);
