Ticket #8902: warnings.diff

File warnings.diff, 24.7 KB (added by shinigami, 11 years ago)

compiler warnings

  • src/org/openstreetmap/josm/actions/FollowLineAction.java

     
    119119            // from aerial imagery or GPS tracks.
    120120            if (Main.map.mapView.viewportFollowing) {
    121121                Main.map.mapView.smoothScrollTo(newPoint.getEastNorth());
    122             };
     122            }
    123123        }
    124124    }
    125125}
  • src/org/openstreetmap/josm/command/SequenceCommand.java

     
    9696    }
    9797
    9898    @Override
    99     @SuppressWarnings("unchecked")
    10099    public Collection<PseudoCommand> getChildren() {
    101         return (List) Arrays.asList(sequence);
     100        return Arrays.<PseudoCommand>asList(sequence);
    102101    }
    103102
    104103    @Override
  • src/org/openstreetmap/josm/data/CustomConfigurator.java

     
    10841084            listmapMap.putAll(tmpPref.listOfStructsDefaults);
    10851085        }
    10861086
    1087         while (stringMap.values().remove(null)) { };
    1088         while (listMap.values().remove(null)) { };
    1089         while (listlistMap.values().remove(null)) { };
    1090         while (listmapMap.values().remove(null)) { };
     1087        while (stringMap.values().remove(null)) { }
     1088        while (listMap.values().remove(null)) { }
     1089        while (listlistMap.values().remove(null)) { }
     1090        while (listmapMap.values().remove(null)) { }
    10911091
    10921092        stringMap.putAll(tmpPref.properties);
    10931093        listMap.putAll(tmpPref.collectionProperties);
  • src/org/openstreetmap/josm/data/Preferences.java

     
    12871287            public void visit(MapListSetting setting) {
    12881288                changed = putListOfStructs(key, setting.getValue());
    12891289            }
    1290         };
     1290        }
    12911291        PutVisitor putVisitor = new PutVisitor();
    12921292        value.visit(putVisitor);
    12931293        return putVisitor.changed;
     
    16681668        }
    16691669    }
    16701670
    1671     public static boolean isEqual(Setting a, Setting b) {
     1671    public static boolean isEqual(Setting<?> a, Setting<?> b) {
    16721672        if (a==null && b==null) return true;
    16731673        if (a==null) return false;
    16741674        if (b==null) return false;
     
    16771677        if (a instanceof StringSetting)
    16781678            return (a.getValue().equals(b.getValue()));
    16791679        if (a instanceof ListSetting) {
    1680             @SuppressWarnings("unchecked") Collection<String> aValue = (Collection) a.getValue();
    1681             @SuppressWarnings("unchecked") Collection<String> bValue = (Collection) b.getValue();
     1680            @SuppressWarnings("unchecked") Collection<String> aValue = (Collection<String>) a.getValue();
     1681            @SuppressWarnings("unchecked") Collection<String> bValue = (Collection<String>) b.getValue();
    16821682            return equalCollection(aValue, bValue);
    16831683        }
    16841684        if (a instanceof ListListSetting) {
    1685             @SuppressWarnings("unchecked") Collection<Collection<String>> aValue = (Collection) a.getValue();
    1686             @SuppressWarnings("unchecked") Collection<List<String>> bValue = (Collection) b.getValue();
     1685            @SuppressWarnings("unchecked") Collection<Collection<String>> aValue = (Collection<Collection<String>>) a.getValue();
     1686            @SuppressWarnings("unchecked") Collection<List<String>> bValue = (Collection<List<String>>) b.getValue();
    16871687            return equalArray(aValue, bValue);
    16881688        }
    16891689        if (a instanceof MapListSetting) {
    1690             @SuppressWarnings("unchecked") Collection<Map<String, String>> aValue = (Collection) a.getValue();
    1691             @SuppressWarnings("unchecked") Collection<Map<String, String>> bValue = (Collection) b.getValue();
     1690            @SuppressWarnings("unchecked") Collection<Map<String, String>> aValue = (Collection<Map<String, String>>) a.getValue();
     1691            @SuppressWarnings("unchecked") Collection<Map<String, String>> bValue = (Collection<Map<String, String>>) b.getValue();
    16921692            return equalListOfStructs(aValue, bValue);
    16931693        }
    16941694        return a.equals(b);
  • src/org/openstreetmap/josm/data/gpx/IWithAttributes.java

     
    3636     *         or {@code null} if this map contains no Collection mapping for the key
    3737     * @since 5502
    3838     */
    39     Collection getCollection(String key);
     39    Collection<?> getCollection(String key);
    4040
    4141    /**
    4242     * Put a key / value pair as a new attribute.
  • src/org/openstreetmap/josm/data/gpx/WithAttributes.java

     
    5656     * @since 5502
    5757     */
    5858    @Override
    59     public Collection getCollection(String key) {
     59    public Collection<?> getCollection(String key) {
    6060        Object value = attr.get(key);
    61         return (value instanceof Collection) ? (Collection)value : null;
     61        return (value instanceof Collection) ? (Collection<?>)value : null;
    6262    }
    6363
    6464    /**
  • src/org/openstreetmap/josm/data/projection/CustomProjection.java

     
    326326    }
    327327
    328328    public Proj parseProjection(Map<String, String> parameters, Ellipsoid ellps) throws ProjectionConfigurationException {
    329         String id = (String) parameters.get(Param.proj.key);
     329        String id = parameters.get(Param.proj.key);
    330330        if (id == null) throw new ProjectionConfigurationException(tr("Projection required (+proj=*)"));
    331331
    332332        Proj proj =  Projections.getBaseProjection(id);
  • src/org/openstreetmap/josm/data/projection/proj/LambertConformalConic.java

     
    2323        public Parameters(double latitudeOrigin) {
    2424            this.latitudeOrigin = latitudeOrigin;
    2525        }
    26     };
     26    }
    2727
    2828    public static class Parameters1SP extends Parameters {
    2929        public Parameters1SP(double latitudeOrigin) {
  • src/org/openstreetmap/josm/data/validation/tests/TagChecker.java

     
    821821                }
    822822                return noMatch;
    823823            }
    824         };
     824        }
    825825
    826826        public String getData(String str) {
    827827            Matcher m = Pattern.compile(" *# *([^#]+) *$").matcher(str);
  • src/org/openstreetmap/josm/data/validation/tests/UntaggedWay.java

     
    4949        NAMED_WAYS.add( "secondary" );
    5050        NAMED_WAYS.add( "tertiary" );
    5151        NAMED_WAYS.add( "residential" );
    52         NAMED_WAYS.add( "pedestrian" ); ;
     52        NAMED_WAYS.add( "pedestrian" );
    5353    }
    5454
    5555    /** Whitelist of roles allowed to reference an untagged way */
  • src/org/openstreetmap/josm/gui/NavigatableComponent.java

     
    493493                    {
    494494                        // fixme - not use zoom history here
    495495                        zoomTo(oldCenter.interpolate(finalNewCenter, (i+1) / frames));
    496                         try { Thread.sleep(1000 / fps); } catch (InterruptedException ex) { };
     496                        try { Thread.sleep(1000 / fps); } catch (InterruptedException ex) { }
    497497                    }
    498498                }
    499499            }.start();
  • src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

     
    850850        @Override public Class<?> getColumnClass(int columnIndex) {
    851851            return String.class;
    852852        }
    853     };
     853    }
    854854
    855855    /**
    856856     * Action handling delete button press in properties dialog.
  • src/org/openstreetmap/josm/gui/io/UpdatePrimitivesTask.java

     
    9090        getProgressMonitor().indeterminateSubTask(tr("Initializing nodes to update ..."));
    9191        for (OsmPrimitive primitive : toUpdate) {
    9292            if (primitive instanceof Node && !primitive.isNew()) {
    93                 reader.append((Node)primitive);
     93                reader.append(primitive);
    9494            } else if (primitive instanceof Way) {
    9595                Way way = (Way)primitive;
    9696                for (Node node: way.getNodes()) {
     
    106106        getProgressMonitor().indeterminateSubTask(tr("Initializing ways to update ..."));
    107107        for (OsmPrimitive primitive : toUpdate) {
    108108            if (primitive instanceof Way && !primitive.isNew()) {
    109                 reader.append((Way)primitive);
     109                reader.append(primitive);
    110110            }
    111111        }
    112112    }
     
    115115        getProgressMonitor().indeterminateSubTask(tr("Initializing relations to update ..."));
    116116        for (OsmPrimitive primitive : toUpdate) {
    117117            if (primitive instanceof Relation && !primitive.isNew()) {
    118                 reader.append((Relation)primitive);
     118                reader.append(primitive);
    119119            }
    120120        }
    121121    }
  • src/org/openstreetmap/josm/gui/layer/gpx/ChooseTrackVisibilityAction.java

     
    155155    }
    156156
    157157    private void updateVisibilityFromTable() {
    158         ListSelectionModel s = (ListSelectionModel) table.getSelectionModel();
     158        ListSelectionModel s = table.getSelectionModel();
    159159        for (int i = 0; i < layer.trackVisibility.length; i++) {
    160160            layer.trackVisibility[table.convertRowIndexToModel(i)] = s.isSelectedIndex(i);
    161161        }
  • src/org/openstreetmap/josm/gui/mappaint/Cascade.java

     
    146146        if (o instanceof float[])
    147147            return (float[]) o;
    148148        if (o instanceof List) {
    149             List l = (List) o;
     149            List<?> l = (List<?>) o;
    150150            float[] a = new float[l.size()];
    151151            for (int i=0; i<l.size(); ++i) {
    152152                Float f = toFloat(l.get(i));
  • src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java

     
    130130            return Arrays.asList(args);
    131131        }
    132132
    133         public static Object get(List objects, float index) {
     133        public static Object get(List<? extends Object> objects, float index) {
    134134            int idx = Math.round(index);
    135135            if (idx >= 0 && idx < objects.size()) {
    136136                return objects.get(idx);
     
    138138            return null;
    139139        }
    140140
    141         public static List split(String sep, String toSplit) {
     141        public static List<String> split(String sep, String toSplit) {
    142142            return Arrays.asList(toSplit.split(Pattern.quote(sep), -1));
    143143        }
    144144
     
    264264            return a < b;
    265265        }
    266266
    267         @SuppressWarnings(value = "unchecked")
    268267        public static boolean equal(Object a, Object b) {
    269268            // make sure the casts are done in a meaningful way, so
    270269            // the 2 objects really can be considered equal
    271             for (Class klass : new Class[]{Float.class, Boolean.class, Color.class, float[].class, String.class}) {
     270            for (Class<?> klass : new Class[]{Float.class, Boolean.class, Color.class, float[].class, String.class}) {
    272271                Object a2 = Cascade.convertTo(a, klass);
    273272                Object b2 = Cascade.convertTo(b, klass);
    274273                if (a2 != null && b2 != null && a2.equals(b2)) {
     
    316315            return Pattern.compile(pattern, f).matcher(target).matches();
    317316        }
    318317
    319         public static List regexp_match(String pattern, String target, String flags) {
     318        public static List<String> regexp_match(String pattern, String target, String flags) {
    320319            int f = 0;
    321320            if (flags.contains("i")) {
    322321                f |= Pattern.CASE_INSENSITIVE;
     
    339338            }
    340339        }
    341340
    342         public static List regexp_match(String pattern, String target) {
     341        public static List<String> regexp_match(String pattern, String target) {
    343342            Matcher m = Pattern.compile(pattern).matcher(target);
    344343            if (m.matches()) {
    345344                List<String> result = new ArrayList<String>(m.groupCount() + 1);
     
    479478
    480479        @Override
    481480        public Object evaluate(Environment env) {
    482             List l = Cascade.convertTo(arg.evaluate(env), List.class);
     481            List<?> l = Cascade.convertTo(arg.evaluate(env), List.class);
    483482            if (l != null)
    484483                return l.size();
    485484            String s = Cascade.convertTo(arg.evaluate(env), String.class);
  • src/org/openstreetmap/josm/gui/preferences/PluginPreference.java

     
    346346                                JOptionPane.INFORMATION_MESSAGE,
    347347                                null // FIXME: provide help context
    348348                                );
    349                     };
     349                    }
    350350                });
    351351            } catch (Exception e) {
    352352                e.printStackTrace();
  • src/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTable.java

     
    116116            if (llEditor.getValue() == 1) {
    117117                List<List<String>> data = llEditor.getData();
    118118                @SuppressWarnings("unchecked")
    119                 Collection<Collection<String>> stgValue = (Collection) stg.getValue();
     119                Collection<Collection<String>> stgValue = (Collection<Collection<String>>) stg.getValue();
    120120                if (!Preferences.equalArray(stgValue, data)) {
    121121                    e.setValue(new Preferences.ListListSetting(data));
    122122                    return true;
  • src/org/openstreetmap/josm/gui/preferences/plugin/PluginListPanel.java

     
    150150                }
    151151            }
    152152        }
    153     };
     153    }
    154154
    155155
    156156    /**
  • src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java

     
    555555                    bg.add(aibutton);
    556556                    try {
    557557                        // TODO there must be a better way to parse a number like "+3" than this.
    558                         final int buttonvalue = ((Number)NumberFormat.getIntegerInstance().parse(ai.replace("+", ""))).intValue();
     558                        final int buttonvalue = (NumberFormat.getIntegerInstance().parse(ai.replace("+", ""))).intValue();
    559559                        if (auto_increment_selected == buttonvalue) aibutton.setSelected(true);
    560560                        aibutton.addActionListener(new ActionListener() {
    561561                            @Override
  • src/org/openstreetmap/josm/io/GpxReader.java

     
    406406                GpxLink link = new GpxLink(url);
    407407                link.text = urlname;
    408408                @SuppressWarnings("unchecked")
    409                 Collection<GpxLink> links = (Collection) attr.get(META_LINKS);
     409                Collection<GpxLink> links = (Collection<GpxLink>) attr.get(META_LINKS);
    410410                links.add(link);
    411411            }
    412412        }
  • src/org/openstreetmap/josm/io/GpxWriter.java

     
    8181        for (String key : WPT_KEYS) {
    8282            if (key.equals(META_LINKS)) {
    8383                @SuppressWarnings("unchecked")
    84                 Collection<GpxLink> lValue = obj.getCollection(key);
     84                Collection<GpxLink> lValue = (Collection<GpxLink>) obj.getCollection(key);
    8585                if (lValue != null) {
    8686                    for (GpxLink link : lValue) {
    8787                        gpxLink(link);
  • src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java

     
    134134        final DefaultTableModel tm = new DefaultTableModel(new String[] {tr("Assume"), tr("Key"), tr("Value"), tr("Existing values")}, tags.length) {
    135135            final Class<?>[] types = {Boolean.class, String.class, Object.class, ExistingValues.class};
    136136            @Override
    137             public Class getColumnClass(int c) {
     137            public Class<?> getColumnClass(int c) {
    138138                return types[c];
    139139            }
    140140        };
  • src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java

     
    384384        PrintWriter r = new PrintWriter(w);
    385385        RequestHandler handler = null;
    386386        try {
    387             Class c = handlers.get(cmd);
     387            Class<?> c = handlers.get(cmd);
    388388            if (c==null) return null;
    389389            handler = handlers.get(cmd).newInstance();
    390390        } catch (Exception ex) {
  • src/org/openstreetmap/josm/io/session/SessionWriter.java

     
    7272        Class<? extends SessionLayerExporter> exporterClass = sessionLayerExporters.get(layerClass);
    7373        if (exporterClass == null) return null;
    7474        try {
    75             @SuppressWarnings("unchecked")
    76             Constructor<? extends SessionLayerExporter> constructor = (Constructor) exporterClass.getConstructor(layerClass);
     75            Constructor<? extends SessionLayerExporter> constructor = exporterClass.getConstructor(layerClass);
    7776            return constructor.newInstance(layer);
    7877        } catch (Exception e) {
    7978            throw new RuntimeException(e);
  • src/org/openstreetmap/josm/tools/Diff.java

     
    815815            realindexes = new int[buffered_lines];
    816816
    817817            for (int i = 0; i < data.length; ++i) {
    818                 Integer ir = (Integer)h.get(data[i]);
     818                Integer ir = h.get(data[i]);
    819819                if (ir == null) {
    820820                    h.put(data[i],new Integer(equivs[i] = equiv_max++));
    821821                } else {
  • src/org/openstreetmap/josm/tools/ExifReader.java

     
    5050        return null;
    5151    }
    5252
    53     @SuppressWarnings("unchecked") public static Integer readOrientation(File filename) throws ParseException {
     53    public static Integer readOrientation(File filename) throws ParseException {
    5454        Integer orientation = null;
    5555        try {
    5656            final Metadata metadata = JpegMetadataReader.readMetadata(filename);
  • src/org/openstreetmap/josm/tools/Geometry.java

     
    4949    public static Set<Node> addIntersections(List<Way> ways, boolean test, List<Command> cmds) {
    5050
    5151        //stupid java, cannot instantiate array of generic classes..
     52        int n = ways.size();
    5253        @SuppressWarnings("unchecked")
    53         int n = ways.size();
    5454        ArrayList<Node>[] newNodes = new ArrayList[n];
    5555        BBox[] wayBounds = new BBox[n];
    5656        boolean[] changedWays = new boolean[n];
     
    6666
    6767        //iterate over all way pairs and introduce the intersections
    6868        Comparator<Node> coordsComparator = new NodePositionComparator();
    69         WayLoop: for (int seg1Way = 0; seg1Way < n; seg1Way ++) {
     69        for (int seg1Way = 0; seg1Way < n; seg1Way ++) {
    7070            for (int seg2Way = seg1Way; seg2Way < n; seg2Way ++) {
    7171
    7272                //do not waste time on bounds that do not intersect
  • src/org/openstreetmap/josm/tools/LanguageInfo.java

     
    1717        BASELANGUAGE,
    1818        /** The standard english texts */
    1919        ENGLISH
    20     };
     20    }
    2121
    2222    /**
    2323     * Replies the wiki language prefix for the given locale. The wiki language
  • src/org/openstreetmap/josm/tools/TextTagParser.java

     
    109109       
    110110        private void skipSign() {
    111111            char c;
    112             boolean signFound = false;;
     112            boolean signFound = false;
    113113            while (pos < n) {
    114114                c = data.charAt(pos);
    115115                if (c == '\t' || c == '\n'  || c == ' ') {