Changeset 7022 in josm


Ignore:
Timestamp:
2014-04-29T02:07:27+02:00 (6 years ago)
Author:
Don-vip
Message:

see #8465 - enable and fix more warnings

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/build.xml

    r7021 r7022  
    198198    <target name="compile" depends="init,javacc">
    199199        <!-- COTS -->
    200         <javac srcdir="src" includes="com/**,oauth/**,org/apache/commons/codec/**" nowarn="on"
     200        <javac srcdir="src" includes="com/**,oauth/**,org/apache/commons/codec/**,org/glassfish/**" nowarn="on"
    201201                destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" encoding="iso-8859-1">
    202202            <!-- get rid of "internal proprietary API" warning -->
     
    204204        </javac>
    205205        <!-- JMapViewer/JOSM -->
    206         <javac srcdir="src" excludes="com/**,oauth/**,org/apache/commons/codec/**,org/openstreetmap/gui/jmapviewer/Demo.java"
     206        <javac srcdir="src" excludes="com/**,oauth/**,org/apache/commons/codec/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/Demo.java"
    207207                destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" encoding="UTF-8">
    208208            <compilerarg value="-Xlint:cast"/>
    209209            <compilerarg value="-Xlint:deprecation"/>
     210            <compilerarg value="-Xlint:dep-ann"/>
     211            <compilerarg value="-Xlint:divzero"/>
     212            <compilerarg value="-Xlint:empty"/>
     213            <compilerarg value="-Xlint:finally"/>
     214            <compilerarg value="-Xlint:overrides"/>
     215            <!--<compilerarg value="-Xlint:rawtypes"/>-->
     216            <compilerarg value="-Xlint:static"/>
     217            <compilerarg value="-Xlint:try"/>
    210218            <compilerarg value="-Xlint:unchecked"/>
    211219        </javac>
  • trunk/src/org/openstreetmap/josm/actions/PreferencesAction.java

    r6969 r7022  
    2828    private PreferencesAction(String name, String icon, String tooltip,
    2929                              Class<? extends TabPreferenceSetting> tab, Class<? extends SubPreferenceSetting> subTab) {
    30         super(name, icon, tooltip, null, false, "preference_" + Utils.<Class>firstNonNull(tab, subTab).getName(), false);
     30        super(name, icon, tooltip, null, false, "preference_" + Utils.<Class<?>>firstNonNull(tab, subTab).getName(), false);
    3131        this.tab = tab;
    3232        this.subTab = subTab;
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/WireframeMapRenderer.java

    r7005 r7022  
    1212import java.awt.geom.GeneralPath;
    1313import java.util.ArrayList;
    14 import java.util.Arrays;
    1514import java.util.Iterator;
    1615import java.util.List;
     
    185184
    186185        // Display highlighted ways after the other ones (fix #8276)
    187         for (List<Way> specialWays : Arrays.asList(new List[]{untaggedWays, highlightedWays})) {
    188             for (final Way way : specialWays){
    189                 way.accept(this);
    190             }
    191             specialWays.clear();
    192             displaySegments();
    193         }
     186        List<Way> specialWays = new ArrayList<>(untaggedWays);
     187        specialWays.addAll(highlightedWays);
     188        for (final Way way : specialWays){
     189            way.accept(this);
     190        }
     191        specialWays.clear();
     192        displaySegments();
    194193
    195194        for (final OsmPrimitive osm : data.getSelected()) {
  • trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java

    r7005 r7022  
    66
    77import java.text.MessageFormat;
    8 import java.util.Arrays;
     8import java.util.ArrayList;
    99import java.util.Collection;
    1010import java.util.HashMap;
     
    9393    }
    9494
    95     @SuppressWarnings("unchecked")
    9695    @Override
    9796    public void visit(Relation n) {
     
    201200                        if (r.memberExpression != null) {
    202201                            Set<OsmPrimitive> notMatching = new HashSet<>();
    203                             for (Collection<OsmPrimitive> c : Arrays.asList(new Collection[]{ri.nodes, ri.ways, ri.relations})) {
    204                                 for (OsmPrimitive p : c) {
    205                                     if (p.isUsable() && !r.memberExpression.match(p)) {
    206                                         notMatching.add(p);
    207                                     }
     202                            Collection<OsmPrimitive> allPrimitives = new ArrayList<>();
     203                            allPrimitives.addAll(ri.nodes);
     204                            allPrimitives.addAll(ri.ways);
     205                            allPrimitives.addAll(ri.relations);
     206                            for (OsmPrimitive p : allPrimitives) {
     207                                if (p.isUsable() && !r.memberExpression.match(p)) {
     208                                    notMatching.add(p);
    208209                                }
    209210                            }
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolverTable.java

    r6890 r7022  
    4242        ((MultiValueCellEditor)getColumnModel().getColumn(2).getCellEditor()).addNavigationListeners(this);
    4343
    44         setRowHeight((int)new JosmComboBox().getPreferredSize().getHeight());
     44        setRowHeight((int)new JosmComboBox<String>().getPreferredSize().getHeight());
    4545    }
    4646
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java

    r7015 r7022  
    391391            // make sure the casts are done in a meaningful way, so
    392392            // the 2 objects really can be considered equal
    393             for (Class<?> klass : new Class[]{Float.class, Boolean.class, Color.class, float[].class, String.class}) {
     393            for (Class<?> klass : new Class<?>[]{Float.class, Boolean.class, Color.class, float[].class, String.class}) {
    394394                Object a2 = Cascade.convertTo(a, klass);
    395395                Object b2 = Cascade.convertTo(b, klass);
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetSelector.java

    r7015 r7022  
    3434import javax.swing.JPopupMenu;
    3535import javax.swing.JScrollPane;
     36import javax.swing.ListCellRenderer;
    3637import javax.swing.event.DocumentEvent;
    3738import javax.swing.event.DocumentListener;
     
    8081    private ActionListener clickListener;
    8182
    82     private static class ResultListCellRenderer extends DefaultListCellRenderer {
     83    private static class ResultListCellRenderer implements ListCellRenderer<TaggingPreset> {
     84        final DefaultListCellRenderer def = new DefaultListCellRenderer();
    8385        @Override
    84         public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    85             JLabel result = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
    86             TaggingPreset tp = (TaggingPreset)value;
     86        public Component getListCellRendererComponent(JList<? extends TaggingPreset> list, TaggingPreset tp, int index, boolean isSelected, boolean cellHasFocus) {
     87            JLabel result = (JLabel) def.getListCellRendererComponent(list, tp, index, isSelected, cellHasFocus);
    8788            result.setText(tp.getName());
    8889            result.setIcon((Icon) tp.getValue(Action.SMALL_ICON));
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java

    r7012 r7022  
    3939            Object Ocom_apple_eawt_Application = Ccom_apple_eawt_Application.getConstructor((Class[])null).newInstance((Object[])null);
    4040            Class<?> Ccom_apple_eawt_ApplicationListener = Class.forName("com.apple.eawt.ApplicationListener");
    41             Method MaddApplicationListener = Ccom_apple_eawt_Application.getDeclaredMethod("addApplicationListener", new Class[] { Ccom_apple_eawt_ApplicationListener });
    42             Object Oproxy = Proxy.newProxyInstance(PlatformHookOsx.class.getClassLoader(), new Class[] { Ccom_apple_eawt_ApplicationListener }, ivhandler);
     41            Method MaddApplicationListener = Ccom_apple_eawt_Application.getDeclaredMethod("addApplicationListener", new Class<?>[] { Ccom_apple_eawt_ApplicationListener });
     42            Object Oproxy = Proxy.newProxyInstance(PlatformHookOsx.class.getClassLoader(), new Class<?>[] { Ccom_apple_eawt_ApplicationListener }, ivhandler);
    4343            MaddApplicationListener.invoke(Ocom_apple_eawt_Application, new Object[] { Oproxy });
    44             Method MsetEnabledPreferencesMenu = Ccom_apple_eawt_Application.getDeclaredMethod("setEnabledPreferencesMenu", new Class[] { boolean.class });
     44            Method MsetEnabledPreferencesMenu = Ccom_apple_eawt_Application.getDeclaredMethod("setEnabledPreferencesMenu", new Class<?>[] { boolean.class });
    4545            MsetEnabledPreferencesMenu.invoke(Ocom_apple_eawt_Application, new Object[] { Boolean.TRUE });
    4646        } catch (Exception ex) {
     
    6868        if (args[0] != null) {
    6969            try {
    70                 args[0].getClass().getDeclaredMethod("setHandled", new Class[] { boolean.class }).invoke(args[0], new Object[] { handled });
     70                args[0].getClass().getDeclaredMethod("setHandled", new Class<?>[] { boolean.class }).invoke(args[0], new Object[] { handled });
    7171            } catch (Exception ex) {
    7272                Main.warn("Failed to report handled event: " + ex);
Note: See TracChangeset for help on using the changeset viewer.