Changeset 3453 in josm for trunk


Ignore:
Timestamp:
2010-08-21T14:59:31+02:00 (14 years ago)
Author:
bastiK
Message:

suppress some trivial warnings

Location:
trunk/src/org/openstreetmap/josm/data/osm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java

    r3157 r3453  
    575575        return true;
    576576    }
    577     // If anyone has suggestions for how to fix
    578     // this properly, I'm listening :)
    579     @SuppressWarnings("unchecked")
    580     private T convert(Object raw)
    581     {
    582         return (T)raw;
    583     }
    584577    public boolean remove(Object o) {
    585         return this.remove(convert(o));
    586     }
    587     public boolean remove(T o) {
     578        @SuppressWarnings("unchecked") T t = (T) o;
    588579        synchronized (split_lock) {
    589580            search_cache = null; // Search cache might point to one of removed buckets
    590             QBLevel bucket = root.findBucket(o.getBBox());
    591             if (bucket.remove_content(o)) {
     581            QBLevel bucket = root.findBucket(t.getBBox());
     582            if (bucket.remove_content(t)) {
    592583                size--;
    593584                return true;
     
    597588    }
    598589    public boolean contains(Object o) {
    599         QBLevel bucket = root.findBucket(convert(o).getBBox());
    600         return bucket != null && bucket.content != null && bucket.content.contains(o);
     590        @SuppressWarnings("unchecked") T t = (T) o;
     591        QBLevel bucket = root.findBucket(t.getBBox());
     592        return bucket != null && bucket.content != null && bucket.content.contains(t);
    601593    }
    602594
  • trunk/src/org/openstreetmap/josm/data/osm/Storage.java

    r3398 r3453  
    111111        this.hash = ha;
    112112        int cap = 1 << (int)(Math.ceil(Math.log(capacity/loadFactor) / Math.log(2)));
    113         data = (T[]) new Object[cap];
     113        @SuppressWarnings("unchecked") T[] newData = (T[]) new Object[cap];
     114        data = newData;
    114115        mask = data.length - 1;
    115116        this.safeIterator = safeIterator;
     
    118119    private void copyArray() {
    119120        if (arrayCopyNecessary) {
    120             T[] newData = (T[]) new Object[data.length];
     121            @SuppressWarnings("unchecked") T[] newData = (T[]) new Object[data.length];
    121122            System.arraycopy(data, 0, newData, 0, data.length);
    122123            data = newData;
     
    143144    @Override
    144145    public synchronized boolean contains(Object o) {
    145         int bucket = getBucket(hash, (T)o);
     146        @SuppressWarnings("unchecked") T t = (T) o;
     147        int bucket = getBucket(hash, t);
    146148        return bucket >= 0;
    147149    }
     
    155157    @Override
    156158    public synchronized boolean remove(Object o) {
    157         T orig = removeElem((T)o);
    158         return orig != null;
     159        @SuppressWarnings("unchecked") T t = (T) o;
     160        T tOrig = removeElem(t);
     161        return tOrig != null;
    159162    }
    160163   
     
    292295    private void ensureSpace() {
    293296        if (size > data.length*loadFactor) { // rehash
    294             T[] big = (T[]) new Object[data.length * 2];
     297            @SuppressWarnings("unchecked") T[] big = (T[]) new Object[data.length * 2];
    295298            int nMask = big.length - 1;
    296299
     
    355358        }
    356359
    357         public boolean containsKey(Object key) {
    358             int bucket = getBucket(fHash, (K)key);
     360        public boolean containsKey(Object o) {
     361            @SuppressWarnings("unchecked") K key = (K) o;
     362            int bucket = getBucket(fHash, key);
    359363            return bucket >= 0;
    360364        }
     
    364368        }
    365369
    366         public T get(Object key) {
    367             int bucket = getBucket(fHash, (K)key);
     370        public T get(Object o) {
     371            @SuppressWarnings("unchecked") K key = (K) o;
     372            int bucket = getBucket(fHash, key);
    368373            return bucket < 0 ? null : data[bucket];
    369374        }
     
    374379        }
    375380
    376         public T remove(Object key) {
     381        public T remove(Object o) {
    377382            modCount++;
    378             int bucket = getBucket(fHash,(K)key);
     383            @SuppressWarnings("unchecked") K key = (K) o;
     384            int bucket = getBucket(fHash, key);
    379385
    380386            return bucket < 0 ? null : doRemove(bucket);
Note: See TracChangeset for help on using the changeset viewer.