Ticket #3818: suppress-warnings.patch

File suppress-warnings.patch, 2.3 KB (added by hansendc, 15 years ago)
  • (a) core/src/org/openstreetmap/josm/data/osm/QuadBuckets.java~suppress-warnings vs. (b) core-dave/src/org/openstreetmap/josm/data/osm/QuadBuckets.java

    
    ---
    
     core-dave/src/org/openstreetmap/josm/data/osm/QuadBuckets.java |   19 ++++++----
     1 file changed, 12 insertions(+), 7 deletions(-)
    
    diff -puN src/org/openstreetmap/josm/data/osm/QuadBuckets.java~suppress-warnings src/org/openstreetmap/josm/data/osm/QuadBuckets.java
    a b public class QuadBuckets<T extends OsmPr  
    268268                this.content = null;
    269269            return ret;
    270270        }
     271        @SuppressWarnings("unchecked")
     272        QBLevel[] newChildren()
     273        {
     274            // This is ugly and hackish.  But, it seems to work,
     275            // and using an ArrayList here seems to cost us
     276            // a significant performance penalty -- 50% in my
     277            // testing.  Child access is one of the single
     278            // hottest code paths in this entire class.
     279            return (QBLevel[])Array.newInstance(this.getClass(), QuadTiling.TILES_PER_LEVEL);
     280        }
    271281        // Get the correct index for the given primitive
    272282        // at the given level.  If the primitive can not
    273283        // fit into a single quad at this level, return -1
    public class QuadBuckets<T extends OsmPr  
    326336            if (children != null) {
    327337                abort("overwrote children");
    328338            }
    329             // This is ugly and hackish.  But, it seems to work,
    330             // and using an ArrayList here seems to cost us
    331             // a significant performance penalty -- 50% in my
    332             // testing.  Child access is one of the single
    333             // hottest code paths in this entire class.
    334             children = (QBLevel[])Array.newInstance(this.getClass(), QuadTiling.TILES_PER_LEVEL);
     339            children = newChildren();
    335340            // deferring allocation of children until use
    336341            // seems a bit faster
    337342            //for (int i = 0; i < TILES_PER_LEVEL; i++)
    public class QuadBuckets<T extends OsmPr  
    878883    }
    879884    // If anyone has suggestions for how to fix
    880885    // this properly, I'm listening :)
     886    @SuppressWarnings("unchecked")
    881887    private T convert(Object raw)
    882888    {
    883         //@SuppressWarnings("unchecked")
    884889        return (T)raw;
    885890    }
    886891    public boolean remove(Object o)