BUG-7464: remove uneeded casts and similar warnings 40/49940/9
authorRobert Varga <rovarga@cisco.com>
Mon, 2 Jan 2017 10:41:36 +0000 (11:41 +0100)
committerRobert Varga <rovarga@cisco.com>
Tue, 10 Jan 2017 19:12:11 +0000 (20:12 +0100)
In some places we do not need to cast nodes to their
generic arguments, so eliminate a couple of warnings.

Also remove global TrieMap @SuppressWarnings and add
suppressions as needed.

Change-Id: Ia060097673052ab5ab214704c2980db5052919f8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/CNode.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/FailedNode.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/INode.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/LNode.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/MainNode.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/TNode.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/TrieMap.java

index ba6109eea76de4900e364390c00ec2a59766b428..b16355d67e965b345956328b32c4e41813ad34eb 100644 (file)
@@ -61,7 +61,7 @@ final class CNode<K, V> extends MainNode<K, V> {
 
     // this should only be called from within read-only snapshots
     @Override
-    int cachedSize(final TrieMap<K, V> ct) {
+    int cachedSize(final TrieMap<?, ?> ct) {
         int sz = csize;
         if (sz == NO_SIZE) {
             // We have not computed the size yet, do that now
@@ -80,7 +80,7 @@ final class CNode<K, V> extends MainNode<K, V> {
     // => if there are concurrent size computations, they start
     // at different positions, so they are more likely to
     // to be independent
-    private int computeSize(final TrieMap<K, V> ct) {
+    private int computeSize(final TrieMap<?, ?> ct) {
         int i = 0;
         int sz = 0;
         // final int offset = (array.length > 0) ?
@@ -97,7 +97,7 @@ final class CNode<K, V> extends MainNode<K, V> {
             if (elem instanceof SNode) {
                 sz += 1;
             } else if (elem instanceof INode) {
-                sz += ((INode<K, V>) elem).cachedSize(ct);
+                sz += ((INode<?, ?>) elem).cachedSize(ct);
             }
             i += 1;
         }
@@ -143,8 +143,7 @@ final class CNode<K, V> extends MainNode<K, V> {
         while (i < len) {
             BasicNode elem = arr[i];
             if (elem instanceof INode) {
-                INode<K, V> in = (INode<K, V>) elem;
-                narr [i] = in.copyToGen(ngen, ct);
+                narr [i] = ((INode<?, ?>) elem).copyToGen(ngen, ct);
             } else if (elem != null) {
                 narr [i] = elem;
             }
@@ -153,20 +152,10 @@ final class CNode<K, V> extends MainNode<K, V> {
         return new CNode<>(ngen, bitmap, narr);
     }
 
-    private BasicNode resurrect(final INode<K, V> inode, final Object inodemain) {
-        if (inodemain instanceof TNode) {
-            TNode<K, V> tn = (TNode<K, V>) inodemain;
-            return tn.copyUntombed();
-        }
-
-        return inode;
-    }
-
     MainNode<K, V> toContracted(final int lev) {
         if (array.length == 1 && lev > 0) {
             if (array[0] instanceof SNode) {
-                final SNode<K, V> sn = (SNode<K, V>) array[0];
-                return sn.copyTombed();
+                return ((SNode<K, V>) array[0]).copyTombed();
             }
             return this;
         }
@@ -180,7 +169,7 @@ final class CNode<K, V> extends MainNode<K, V> {
     // returns the version of this node with at least some null-inodes
     // removed (those existing when the op began)
     // - if there are only null-i-nodes below, returns null
-    MainNode<K, V> toCompressed(final TrieMap<K, V> ct, final int lev, final Gen gen) {
+    MainNode<K, V> toCompressed(final TrieMap<?, ?> ct, final int lev, final Gen gen) {
         int bmp = bitmap;
         int i = 0;
         BasicNode[] arr = array;
@@ -188,10 +177,10 @@ final class CNode<K, V> extends MainNode<K, V> {
         while (i < arr.length) { // construct new bitmap
             BasicNode sub = arr[i];
             if (sub instanceof INode) {
-                INode<K, V> in = (INode<K, V>) sub;
-                MainNode<K, V> inodemain = in.gcasRead (ct);
+                final INode<?, ?> in = (INode<?, ?>) sub;
+                final MainNode<?, ?> inodemain = in.gcasRead(ct);
                 assert (inodemain != null);
-                tmparray [i] = resurrect (in, inodemain);
+                tmparray [i] = resurrect(in, inodemain);
             } else if (sub instanceof SNode) {
                 tmparray [i] = sub;
             }
@@ -201,6 +190,10 @@ final class CNode<K, V> extends MainNode<K, V> {
         return new CNode<K, V>(gen, bmp, tmparray).toContracted(lev);
     }
 
+    private static BasicNode resurrect(final INode<?, ?> inode, final MainNode<?, ?> inodemain) {
+        return inodemain instanceof TNode ? ((TNode<?, ?>) inodemain).copyUntombed() : inode;
+    }
+
     @Override
     String string(final int lev) {
         // "CNode %x\n%s".format(bitmap, array.map(_.string(lev +
index 74185053dd1978f9b7e964023078dba4d5716c90..a2ac9ca90cf8d6b702533c8fefe22c35226ec109 100644 (file)
@@ -29,7 +29,7 @@ final class FailedNode<K, V> extends MainNode<K, V> {
     }
 
     @Override
-    int cachedSize(final TrieMap<K, V> ct) {
+    int cachedSize(final TrieMap<?, ?> ct) {
         throw new UnsupportedOperationException();
     }
 
index 94f10ce901df730d02d8ae4beca1b9c263586b60..b86d4c4152003eaf0c54850f62ef83b5d4c49342 100644 (file)
@@ -36,11 +36,11 @@ final class INode<K, V> extends BasicNode {
         this.mainnode = mainnode;
     }
 
-    MainNode<K, V> gcasRead(final TrieMap<K, V> ct) {
+    MainNode<K, V> gcasRead(final TrieMap<?, ?> ct) {
         return GCAS_READ(ct);
     }
 
-    MainNode<K, V> GCAS_READ(final TrieMap<K, V> ct) {
+    private MainNode<K, V> GCAS_READ(final TrieMap<?, ?> ct) {
         MainNode<K, V> m = /* READ */ mainnode;
         MainNode<K, V> prevval = /* READ */ m.READ_PREV();
         if (prevval == null) {
@@ -50,7 +50,7 @@ final class INode<K, V> extends BasicNode {
         return GCAS_Complete(m, ct);
     }
 
-    private MainNode<K, V> GCAS_Complete(MainNode<K, V> m, final TrieMap<K, V> ct) {
+    private MainNode<K, V> GCAS_Complete(MainNode<K, V> m, final TrieMap<?, ?> ct) {
         while (true) {
             if (m == null) {
                 return null;
@@ -58,7 +58,7 @@ final class INode<K, V> extends BasicNode {
 
             // complete the GCAS
             final MainNode<K, V> prev = /* READ */ m.READ_PREV();
-            final INode<K, V> ctr = ct.readRoot(true);
+            final Gen rdgen = ct.readRoot(true).gen;
             if (prev == null) {
                 return m;
             }
@@ -83,7 +83,7 @@ final class INode<K, V> extends BasicNode {
             // ==> if `ctr.gen` = `gen` then they are both equal to G.
             // ==> otherwise, we know that either `ctr.gen` > G, `gen` < G,
             // or both
-            if (ctr.gen == gen && !ct.isReadOnly()) {
+            if (rdgen == gen && !ct.isReadOnly()) {
                 // try to commit
                 if (m.CAS_PREV(prev, null)) {
                     return m;
@@ -101,7 +101,7 @@ final class INode<K, V> extends BasicNode {
         }
     }
 
-    private boolean GCAS(final MainNode<K, V> old, final MainNode<K, V> n, final TrieMap<K, V> ct) {
+    private boolean GCAS(final MainNode<K, V> old, final MainNode<K, V> n, final TrieMap<?, ?> ct) {
         n.WRITE_PREV(old);
         if (MAINNODE_UPDATER.compareAndSet(this, old, n)) {
             GCAS_Complete(n, ct);
@@ -115,7 +115,7 @@ final class INode<K, V> extends BasicNode {
         return new INode<>(gen, cn);
     }
 
-    INode<K, V> copyToGen(final Gen ngen, final TrieMap<K, V> ct) {
+    INode<K, V> copyToGen(final Gen ngen, final TrieMap<?, ?> ct) {
         return new INode<>(ngen, GCAS_READ(ct));
     }
 
@@ -168,8 +168,8 @@ final class INode<K, V> extends BasicNode {
                         return GCAS (cn, nn, ct);
                     }
                 } else {
-                    CNode<K, V> rn = (cn.gen == gen) ? cn : cn.renewed(gen, ct);
-                    MainNode<K, V> ncnode = rn.insertedAt(pos, flag, new SNode<> (k, v, hc), gen);
+                    final CNode<K, V> rn = (cn.gen == gen) ? cn : cn.renewed(gen, ct);
+                    final MainNode<K, V> ncnode = rn.insertedAt(pos, flag, new SNode<>(k, v, hc), gen);
                     return GCAS (cn, ncnode, ct);
                 }
             } else if (m instanceof TNode) {
@@ -427,19 +427,19 @@ final class INode<K, V> extends BasicNode {
     /**
      * Removes the key associated with the given value.
      *
-     * @param v
+     * @param cond
      *            if null, will remove the key regardless of the value;
      *            otherwise removes only if binding contains that exact key
      *            and value
-     * @return null if not successful, an Option[V] indicating the previous
+     * @return null if not successful, an Optional indicating the previous
      *         value otherwise
      */
-    Optional<V> rec_remove(final K k, final V v, final int hc, final int lev, final INode<K, V> parent,
+    Optional<V> rec_remove(final K k, final Object cond, final int hc, final int lev, final INode<K, V> parent,
             final TrieMap<K, V> ct) {
-        return rec_remove(k, v, hc, lev, parent, gen, ct);
+        return rec_remove(k, cond, hc, lev, parent, gen, ct);
     }
 
-    private Optional<V> rec_remove(final K k, final V v, final int hc, final int lev, final INode<K, V> parent,
+    private Optional<V> rec_remove(final K k, final Object cond, final int hc, final int lev, final INode<K, V> parent,
             final Gen startgen, final TrieMap<K, V> ct) {
         final MainNode<K, V> m = GCAS_READ(ct); // use -Yinline!
 
@@ -458,10 +458,10 @@ final class INode<K, V> extends BasicNode {
             if (sub instanceof INode) {
                 final INode<K, V> in = (INode<K, V>) sub;
                 if (startgen == in.gen) {
-                    res = in.rec_remove(k, v, hc, lev + 5, this, startgen, ct);
+                    res = in.rec_remove(k, cond, hc, lev + 5, this, startgen, ct);
                 } else {
                     if (GCAS(cn, cn.renewed (startgen, ct), ct)) {
-                        res = rec_remove(k, v, hc, lev, parent, startgen, ct);
+                        res = rec_remove(k, cond, hc, lev, parent, startgen, ct);
                     } else {
                         res = null;
                     }
@@ -469,7 +469,7 @@ final class INode<K, V> extends BasicNode {
 
             } else if (sub instanceof SNode) {
                 final SNode<K, V> sn = (SNode<K, V>) sub;
-                if (sn.hc == hc && ct.equal(sn.k, k) && (v == null || v.equals(sn.v))) {
+                if (sn.hc == hc && ct.equal(sn.k, k) && (cond == null || cond.equals(sn.v))) {
                     final MainNode<K, V> ncn = cn.removedAt(pos, flag, gen).toContracted(lev);
                     if (GCAS(cn, ncn, ct)) {
                         res = Optional.of(sn.v);
@@ -506,7 +506,7 @@ final class INode<K, V> extends BasicNode {
             }
 
             final V value = entry.value();
-            if (v != null && !v.equals(value)) {
+            if (cond != null && !cond.equals(value)) {
                 // Value does not match
                 return Optional.empty();
             }
@@ -539,8 +539,8 @@ final class INode<K, V> extends BasicNode {
             final BasicNode sub = cn.array[pos];
             if (sub == this) {
                 if (nonlive instanceof TNode) {
-                    final TNode<K, V> tn = (TNode<K, V>) nonlive;
-                    MainNode<K, V> ncn = cn.updatedAt(pos, tn.copyUntombed(), gen).toContracted(lev - 5);
+                    final TNode<?, ?> tn = (TNode<?, ?>) nonlive;
+                    final MainNode<K, V> ncn = cn.updatedAt(pos, tn.copyUntombed(), gen).toContracted(lev - 5);
                     if (!parent.GCAS(cn, ncn, ct)) {
                         if (ct.readRoot().gen == startgen) {
                             // Tail recursion: cleanParent(nonlive, parent, ct, hc, lev, startgen);
@@ -561,9 +561,8 @@ final class INode<K, V> extends BasicNode {
         }
     }
 
-    int cachedSize(final TrieMap<K, V> ct) {
-        MainNode<K, V> m = GCAS_READ(ct);
-        return m.cachedSize(ct);
+    int cachedSize(final TrieMap<?, ?> ct) {
+        return GCAS_READ(ct).cachedSize(ct);
     }
 
     // /* this is a quiescent method! */
index 0bc4c925258a065001353aaa09bcc9c3380cf165..40d2b782b2c55dc19cacba3fe3f9d3f6190ac2d6 100644 (file)
@@ -57,7 +57,7 @@ final class LNode<K, V> extends MainNode<K, V> {
     }
 
     @Override
-    int cachedSize(final TrieMap<K, V> ct) {
+    int cachedSize(final TrieMap<?, ?> ct) {
         return listmap.size();
     }
 
index fcc747160fe66c3b788cb4e85fb90b9061b63c2a..ac0af2f417f6daf3c2b5895cf581a657de2b6c99 100644 (file)
@@ -32,7 +32,7 @@ abstract class MainNode<K, V> extends BasicNode {
         this.prev = prev;
     }
 
-    abstract int cachedSize(TrieMap<K, V> ct);
+    abstract int cachedSize(TrieMap<?, ?> ct);
 
     final boolean CAS_PREV(final MainNode<K, V> oldval, final MainNode<K, V> nval) {
         return PREV_UPDATER.compareAndSet(this, oldval, nval);
index 45913d1b416fdcaf3966c3a3404131dd46b865da..e845816c776f2dd28da7c0cd00c5548b61f41d4a 100644 (file)
@@ -39,7 +39,7 @@ final class TNode<K, V> extends MainNode<K, V> implements EntryNode<K, V> {
     }
 
     @Override
-    int cachedSize(final TrieMap<K, V> ct) {
+    int cachedSize(final TrieMap<?, ?> ct) {
         return 1;
     }
 
index e421646ed0cb0ecbfdf50d6a55535fd145236bae..e8818a4b1edf4b19c3666a71e326ca7a138c9e08 100644 (file)
@@ -28,7 +28,6 @@ import java.io.Serializable;
 import java.util.AbstractMap;
 import java.util.AbstractSet;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 import java.util.NoSuchElementException;
@@ -46,8 +45,8 @@ import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
  * @param <K> the type of keys maintained by this map
  * @param <V> the type of mapped values
  */
-@SuppressWarnings({"unchecked", "rawtypes", "unused"})
 public final class TrieMap<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K,V>, Serializable {
+    @SuppressWarnings("rawtypes")
     private static final AtomicReferenceFieldUpdater<TrieMap, Object> ROOT_UPDATER =
             AtomicReferenceFieldUpdater.newUpdater(TrieMap.class, Object.class, "root");
     private static final long serialVersionUID = 1L;
@@ -86,9 +85,13 @@ public final class TrieMap<K, V> extends AbstractMap<K, V> implements Concurrent
         return new INode<>(gen, new CNode<>(gen));
     }
 
-    final boolean CAS_ROOT(final Object ov, final Object nv) {
+    private boolean CAS_ROOT(final Object ov, final Object nv) {
         checkState(!readOnly, "Attempted to modify a read-only snapshot");
-        return ROOT_UPDATER.compareAndSet (this, ov, nv);
+        return ROOT_UPDATER.compareAndSet(this, ov, nv);
+    }
+
+    final INode<K, V> readRoot() {
+        return RDCSS_READ_ROOT(false);
     }
 
     // FIXME: abort = false by default
@@ -96,16 +99,12 @@ public final class TrieMap<K, V> extends AbstractMap<K, V> implements Concurrent
         return RDCSS_READ_ROOT(abort);
     }
 
-    final INode<K, V> readRoot() {
+    private final INode<K, V> RDCSS_READ_ROOT() {
         return RDCSS_READ_ROOT(false);
     }
 
-    final INode<K, V> RDCSS_READ_ROOT() {
-        return RDCSS_READ_ROOT(false);
-    }
-
-    final INode<K, V> RDCSS_READ_ROOT(final boolean abort) {
-        final Object r = /* READ */root;
+    private final INode<K, V> RDCSS_READ_ROOT(final boolean abort) {
+        final Object r = /* READ */ root;
         if (r instanceof INode) {
             return (INode<K, V>) r;
         }
@@ -116,12 +115,13 @@ public final class TrieMap<K, V> extends AbstractMap<K, V> implements Concurrent
 
     private INode<K, V> RDCSS_Complete(final boolean abort) {
         while (true) {
-            final Object r = /* READ */root;
+            final Object r = /* READ */ root;
             if (r instanceof INode) {
                 return (INode<K, V>) r;
             }
 
             checkState(r instanceof RDCSS_Descriptor, "Unhandled root %s", r);
+            @SuppressWarnings("unchecked")
             final RDCSS_Descriptor<K, V> desc = (RDCSS_Descriptor<K, V>) r;
             final INode<K, V> ov = desc.old;
             final MainNode<K, V> exp = desc.expectedmain;
@@ -168,11 +168,15 @@ public final class TrieMap<K, V> extends AbstractMap<K, V> implements Concurrent
     private void inserthc(final K k, final int hc, final V v) {
         // TODO: this is called from serialization only, which means we should not be observing any races,
         //       hence we should not need to pass down the entire tree, just equality (I think).
-        final INode<K, V> r = RDCSS_READ_ROOT();
-        final boolean success = r.rec_insert(k, v, hc, 0, null, this);
+        final boolean success = RDCSS_READ_ROOT().rec_insert(k, v, hc, 0, null, this);
         Verify.verify(success, "Concurrent modification during serialization of map %s", this);
     }
 
+    void add(final K key, final V value) {
+        final K k = checkNotNull(key);
+        inserthc(k, computeHash(k), checkNotNull(value));
+    }
+
     private Optional<V> insertifhc(final K k, final int hc, final V v, final Object cond) {
         Optional<V> res;
         do {
@@ -183,6 +187,7 @@ public final class TrieMap<K, V> extends AbstractMap<K, V> implements Concurrent
         return res;
     }
 
+    @SuppressWarnings("unchecked")
     private V lookuphc(final K k, final int hc) {
         Object res;
         do {
@@ -193,11 +198,11 @@ public final class TrieMap<K, V> extends AbstractMap<K, V> implements Concurrent
         return (V) res;
     }
 
-    private Optional<V> removehc(final K k, final V v, final int hc) {
+    private Optional<V> removehc(final K k, final Object cond, final int hc) {
         Optional<V> res;
         do {
             // Keep looping as long as we do not get a reply
-            res = RDCSS_READ_ROOT().rec_remove(k, v, hc, 0, null, this);
+            res = RDCSS_READ_ROOT().rec_remove(k, cond, hc, 0, null, this);
         } while (res == null);
 
         return res;
@@ -290,41 +295,44 @@ public final class TrieMap<K, V> extends AbstractMap<K, V> implements Concurrent
 
     @Override
     public V get(final Object key) {
+        @SuppressWarnings("unchecked")
         final K k = (K) checkNotNull(key);
         return lookuphc(k, computeHash(k));
     }
 
+    @SuppressWarnings("null")
+    private static <V> V toNullable(final Optional<V> opt) {
+        return opt.orElse(null);
+    }
+
     @Override
     public V put(final K key, final V value) {
         ensureReadWrite();
         final K k = checkNotNull(key);
-        return insertifhc(k, computeHash(k), checkNotNull(value), null).orElse(null);
-    }
-
-    void add(final K key, final V value) {
-        final K k = checkNotNull(key);
-        inserthc(k, computeHash(k), checkNotNull(value));
+        return toNullable(insertifhc(k, computeHash(k), checkNotNull(value), null));
     }
 
     @Override
     public V remove(final Object key) {
         ensureReadWrite();
+        @SuppressWarnings("unchecked")
         final K k = (K) checkNotNull(key);
-        return removehc(k, (V) null, computeHash(k)).orElse(null);
+        return toNullable(removehc(k, null, computeHash(k)));
     }
 
     @Override
     public V putIfAbsent(final K key, final V value) {
         ensureReadWrite();
         final K k = checkNotNull(key);
-        return insertifhc(k, computeHash(k), checkNotNull(value), ABSENT).orElse(null);
+        return toNullable(insertifhc(k, computeHash(k), checkNotNull(value), ABSENT));
     }
 
     @Override
     public boolean remove(final Object key, final Object v) {
         ensureReadWrite();
+        @SuppressWarnings("unchecked")
         final K k = (K) checkNotNull(key);
-        return removehc(k, (V) checkNotNull(v), computeHash(k)).isPresent();
+        return removehc(k, checkNotNull(v), computeHash(k)).isPresent();
     }
 
     @Override
@@ -338,7 +346,7 @@ public final class TrieMap<K, V> extends AbstractMap<K, V> implements Concurrent
     public V replace(final K key, final V value) {
         ensureReadWrite();
         final K k = checkNotNull(key);
-        return insertifhc (k, computeHash(k), checkNotNull(value), PRESENT).orElse(null);
+        return toNullable(insertifhc(k, computeHash(k), checkNotNull(value), PRESENT));
     }
 
     /***
@@ -366,8 +374,7 @@ public final class TrieMap<K, V> extends AbstractMap<K, V> implements Concurrent
     }
 
     private int cachedSize() {
-        INode<K, V> r = RDCSS_READ_ROOT ();
-        return r.cachedSize (this);
+        return RDCSS_READ_ROOT().cachedSize (this);
     }
 
     @Override
@@ -471,13 +478,13 @@ public final class TrieMap<K, V> extends AbstractMap<K, V> implements Concurrent
                 throw new NoSuchElementException();
             }
 
-            Entry<K, V> r = null;
+            final Entry<K, V> r;
             if (subiter != null) {
-                r = subiter.next ();
-                checkSubiter ();
+                r = subiter.next();
+                checkSubiter();
             } else {
                 r = current;
-                advance ();
+                advance();
             }
 
             lastReturned = r;
@@ -490,6 +497,7 @@ public final class TrieMap<K, V> extends AbstractMap<K, V> implements Concurrent
 
         Entry<K, V> nextEntry(final Entry<K, V> rr) {
             return new Entry<K, V>() {
+                @SuppressWarnings("null")
                 private V updated = null;
 
                 @Override
@@ -539,8 +547,7 @@ public final class TrieMap<K, V> extends AbstractMap<K, V> implements Concurrent
         // @inline
         void initialize () {
 //            assert (ct.isReadOnly ());
-            INode<K, V> r = ct.RDCSS_READ_ROOT ();
-            readin (r);
+            readin(ct.RDCSS_READ_ROOT());
         }
 
         void advance () {
@@ -563,11 +570,11 @@ public final class TrieMap<K, V> extends AbstractMap<K, V> implements Concurrent
             }
         }
 
-        protected TrieMapIterator<K, V> newIterator (final int _lev, final TrieMap<K, V> _ct, final boolean _mustInit) {
+        protected TrieMapIterator<K, V> newIterator(final int _lev, final TrieMap<K, V> _ct, final boolean _mustInit) {
             return new TrieMapIterator<> (_lev, _ct, _mustInit);
         }
 
-        protected void dupTo (final TrieMapIterator<K, V> it) {
+        protected void dupTo(final TrieMapIterator<K, V> it) {
             it.level = this.level;
             it.ct = this.ct;
             it.depth = this.depth;
@@ -632,14 +639,6 @@ public final class TrieMap<K, V> extends AbstractMap<K, V> implements Concurrent
             return list;
         }
 
-        void printDebug () {
-            System.out.println ("ctrie iterator");
-            System.out.println (Arrays.toString (stackpos));
-            System.out.println ("depth: " + depth);
-            System.out.println ("curr.: " + current);
-            // System.out.println(stack.mkString("\n"));
-        }
-
         @Override
         public void remove() {
             checkState(lastReturned != null);
@@ -676,7 +675,7 @@ public final class TrieMap<K, V> extends AbstractMap<K, V> implements Concurrent
             if (!(o instanceof Entry)) {
                 return false;
             }
-            final Entry<?, ?> e = (Entry<K, V>) o;
+            final Entry<?, ?> e = (Entry<?, ?>) o;
             final Object key = e.getKey();
             if (key == null) {
                 return false;