Changeset 5590 in josm for trunk


Ignore:
Timestamp:
2012-11-18T16:40:44+01:00 (12 years ago)
Author:
bastiK
Message:

suppress some warnings (unchecked cast mostly)

Location:
trunk/src/org/openstreetmap/josm
Files:
7 edited

Legend:

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

    r5258 r5590  
    10281028        engine.eval(finish);
    10291029
     1030        @SuppressWarnings("unchecked")
    10301031        Map<String, String> stringMap =  (Map<String, String>) engine.get("stringMap");
     1032        @SuppressWarnings("unchecked")
    10311033        Map<String, List<String>> listMap = (SortedMap<String, List<String>> ) engine.get("listMap");
     1034        @SuppressWarnings("unchecked")
    10321035        Map<String, List<Collection<String>>> listlistMap = (SortedMap<String, List<Collection<String>>>) engine.get("listlistMap");
     1036        @SuppressWarnings("unchecked")
    10331037        Map<String, List<Map<String, String>>> listmapMap = (SortedMap<String, List<Map<String,String>>>) engine.get("listmapMap");
    10341038
     
    10501054        for (Entry<String, List<Collection<String>>> e : listlistMap.entrySet()) {
    10511055            if (Preferences.equalArray(e.getValue(), tmpPref.arrayDefaults.get(e.getKey()))) continue;
    1052             tmpPref.arrayProperties.put(e.getKey(), (List<List<String>>)(List)e.getValue());
     1056            @SuppressWarnings("unchecked") List<List<String>> value = (List)e.getValue();
     1057            tmpPref.arrayProperties.put(e.getKey(), value);
    10531058        }
    10541059
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r5467 r5590  
    17991799        if (a instanceof StringSetting)
    18001800            return (a.getValue().equals(b.getValue()));
    1801         if (a instanceof ListSetting)
    1802             return equalCollection((Collection<String>) a.getValue(), (Collection<String>) b.getValue());
    1803         if (a instanceof ListListSetting)
    1804             return equalArray((Collection<Collection<String>>) a.getValue(), (Collection<List<String>>) b.getValue());
    1805         if (a instanceof MapListSetting)
    1806             return equalListOfStructs((Collection<Map<String, String>>) a.getValue(), (Collection<Map<String, String>>) b.getValue());
     1801        if (a instanceof ListSetting) {
     1802            @SuppressWarnings("unchecked") Collection<String> aValue = (Collection) a.getValue();
     1803            @SuppressWarnings("unchecked") Collection<String> bValue = (Collection) b.getValue();
     1804            return equalCollection(aValue, bValue);
     1805        }
     1806        if (a instanceof ListListSetting) {
     1807            @SuppressWarnings("unchecked") Collection<Collection<String>> aValue = (Collection) a.getValue();
     1808            @SuppressWarnings("unchecked") Collection<List<String>> bValue = (Collection) b.getValue();
     1809            return equalArray(aValue, bValue);
     1810        }
     1811        if (a instanceof MapListSetting) {
     1812            @SuppressWarnings("unchecked") Collection<Map<String, String>> aValue = (Collection) a.getValue();
     1813            @SuppressWarnings("unchecked") Collection<Map<String, String>> bValue = (Collection) b.getValue();
     1814            return equalListOfStructs(aValue, bValue);
     1815        }
    18071816        return a.equals(b);
    18081817    }
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r5571 r5590  
    2424import java.awt.geom.Rectangle2D;
    2525import java.util.ArrayList;
    26 import java.util.Arrays;
    2726import java.util.Collection;
    2827import java.util.Collections;
     
    6160import org.openstreetmap.josm.gui.mappaint.TextElement;
    6261import org.openstreetmap.josm.tools.ImageProvider;
    63 import org.openstreetmap.josm.tools.Pair;
    6462import org.openstreetmap.josm.tools.Utils;
    6563
     
    11941192
    11951193                            while (dist < segmentLength) {
    1196                                 for (Pair<Float, GeneralPath> sizeAndPath : Arrays.asList(new Pair[] {
    1197                                         new Pair<Float, GeneralPath>(3f, onewayArrowsCasing),
    1198                                         new Pair<Float, GeneralPath>(2f, onewayArrows)})) {
     1194                                for (int i=0; i<2; ++i) {
     1195                                    float onewaySize = i == 0 ? 3f : 2f;
     1196                                    GeneralPath onewayPath = i == 0 ? onewayArrowsCasing : onewayArrows;
    11991197
    12001198                                    // scale such that border is 1 px
    1201                                     final double fac = - (onewayReversed ? -1 : 1) * sizeAndPath.a * (1 + sinPHI) / (sinPHI * cosPHI);
     1199                                    final double fac = - (onewayReversed ? -1 : 1) * onewaySize * (1 + sinPHI) / (sinPHI * cosPHI);
    12021200                                    final double sx = nx * fac;
    12031201                                    final double sy = ny * fac;
     
    12051203                                    // Attach the triangle at the incenter and not at the tip.
    12061204                                    // Makes the border even at all sides.
    1207                                     final double x = p1.x + nx * (dist + (onewayReversed ? -1 : 1) * (sizeAndPath.a / sinPHI));
    1208                                     final double y = p1.y + ny * (dist + (onewayReversed ? -1 : 1) * (sizeAndPath.a / sinPHI));
    1209 
    1210                                     sizeAndPath.b.moveTo(x, y);
    1211                                     sizeAndPath.b.lineTo (x + cosPHI * sx - sinPHI * sy, y + sinPHI * sx + cosPHI * sy);
    1212                                     sizeAndPath.b.lineTo (x + cosPHI * sx + sinPHI * sy, y - sinPHI * sx + cosPHI * sy);
    1213                                     sizeAndPath.b.lineTo(x, y);
     1205                                    final double x = p1.x + nx * (dist + (onewayReversed ? -1 : 1) * (onewaySize / sinPHI));
     1206                                    final double y = p1.y + ny * (dist + (onewayReversed ? -1 : 1) * (onewaySize / sinPHI));
     1207
     1208                                    onewayPath.moveTo(x, y);
     1209                                    onewayPath.lineTo (x + cosPHI * sx - sinPHI * sy, y + sinPHI * sx + cosPHI * sy);
     1210                                    onewayPath.lineTo (x + cosPHI * sx + sinPHI * sy, y - sinPHI * sx + cosPHI * sy);
     1211                                    onewayPath.lineTo(x, y);
    12141212                                }
    12151213                                dist += interval;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r5587 r5590  
    238238     * @param row The row of the table from which the value is edited.
    239239     */
    240     @SuppressWarnings("unchecked")
    241240    private void editProperty(int row) {
    242241        Collection<OsmPrimitive> sel = Main.main.getCurrentDataSet().getSelected();
     
    269268        p.add(keys, GBC.eol().fill(GBC.HORIZONTAL));
    270269
     270        @SuppressWarnings("unchecked")
    271271        final Map<String, Integer> m = (Map<String, Integer>) propertyData.getValueAt(row, 1);
    272272
     
    13761376                    row = propertyTable.getSelectedRow();
    13771377                    String key = URLEncoder.encode(propertyData.getValueAt(row, 0).toString(), "UTF-8");
    1378                     String val = URLEncoder.encode(
    1379                             ((Map<String,Integer>)propertyData.getValueAt(row, 1))
    1380                             .entrySet().iterator().next().getKey(), "UTF-8"
    1381                             );
     1378                    @SuppressWarnings("unchecked")
     1379                    Map<String, Integer> m = (Map<String, Integer>) propertyData.getValueAt(row, 1);
     1380                    String val = URLEncoder.encode(m.entrySet().iterator().next().getKey(), "UTF-8");
    13821381
    13831382                    uris.add(new URI(String.format("%s%sTag:%s=%s", base, lang, key, val)));
  • trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java

    r5438 r5590  
    585585                if (llEditor.getValue() == 1) {
    586586                    List<List<String>> data = llEditor.getData();
    587                     if (!Preferences.equalArray((Collection) llSetting.getValue(), data)) {
     587                    @SuppressWarnings("unchecked")
     588                    Collection<Collection<String>> llSettingValue = (Collection) llSetting.getValue();
     589                    if (!Preferences.equalArray(llSettingValue, data)) {
    588590                        pe.setValue(new ListListSetting(data));
    589591                        ok = true;
     
    645647            if (llEditor.getValue() == 1) {
    646648                List<List<String>> data = llEditor.getData();
    647                 if (!Preferences.equalArray((Collection) stg.getValue(), data)) {
     649                @SuppressWarnings("unchecked")
     650                Collection<Collection<String>> stgValue = (Collection) stg.getValue();
     651                if (!Preferences.equalArray(stgValue, data)) {
    648652                    e.setValue(new ListListSetting(data));
    649653                    applyFilter();
  • trunk/src/org/openstreetmap/josm/gui/preferences/advanced/MapListEditor.java

    r4637 r5590  
    203203        private List<List<String>> data() {
    204204            if (entryIdx == null) return Collections.emptyList();
    205             return Arrays.asList(dataKeys.get(entryIdx), dataValues.get(entryIdx));
     205            @SuppressWarnings("unchecked")
     206            List<List<String>> result = Arrays.asList(dataKeys.get(entryIdx), dataValues.get(entryIdx));
     207            return result;
    206208        }
    207209
  • trunk/src/org/openstreetmap/josm/io/GpxReader.java

    r5398 r5590  
    385385                GpxLink link = new GpxLink(url);
    386386                link.text = urlname;
    387                 ((Collection<GpxLink>) attr.get(GpxData.META_LINKS)).add(link);
     387                @SuppressWarnings("unchecked")
     388                Collection<GpxLink> links = (Collection) attr.get(GpxData.META_LINKS);
     389                links.add(link);
    388390            }
    389391        }
Note: See TracChangeset for help on using the changeset viewer.