id summary reporter owner description type status priority milestone component version resolution keywords cc 12472 Java 8: Use error-prone in build simon04 Don-vip "[http://errorprone.info/ Error-prone] aims at identifying issues at compile time. Running it on the current code base reveals: {{{ compile: [javac] Compiling 434 source files to /home/simon/src/josm.svngit/build [javac] Note: /home/simon/src/josm.svngit/src/oauth/signpost/AbstractOAuthProvider.java uses or overrides a deprecated API. [javac] Note: Recompile with -Xlint:deprecation for details. [javac] Note: Some input files use unchecked or unsafe operations. [javac] Note: Recompile with -Xlint:unchecked for details. [javac] Compiling 60 source files to /home/simon/src/josm.svngit/build [javac] /home/simon/src/josm.svngit/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java:305: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. [javac] synchronized (mapMarkerList) { [javac] ^ [javac] (see http://errorprone.info/bugpattern/SynchronizeOnNonFinalField) [javac] /home/simon/src/josm.svngit/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java:319: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. [javac] synchronized (mapRectangleList) { [javac] ^ [javac] (see http://errorprone.info/bugpattern/SynchronizeOnNonFinalField) [javac] /home/simon/src/josm.svngit/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java:334: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. [javac] synchronized (mapPolygonList) { [javac] ^ [javac] (see http://errorprone.info/bugpattern/SynchronizeOnNonFinalField) [javac] /home/simon/src/josm.svngit/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java:653: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. [javac] synchronized (mapPolygonList) { [javac] ^ [javac] (see http://errorprone.info/bugpattern/SynchronizeOnNonFinalField) [javac] /home/simon/src/josm.svngit/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java:662: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. [javac] synchronized (mapRectangleList) { [javac] ^ [javac] (see http://errorprone.info/bugpattern/SynchronizeOnNonFinalField) [javac] /home/simon/src/josm.svngit/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java:671: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. [javac] synchronized (mapMarkerList) { [javac] ^ [javac] (see http://errorprone.info/bugpattern/SynchronizeOnNonFinalField) [javac] 6 warnings [javac] Compiling 1290 source files to /home/simon/src/josm.svngit/build [javac] /home/simon/src/josm.svngit/src/org/openstreetmap/josm/data/osm/Storage.java:414: warning: [NonAtomicVolatileUpdate] This update of a volatile variable is non-atomic [javac] modCount++; [javac] ^ [javac] (see http://errorprone.info/bugpattern/NonAtomicVolatileUpdate) [javac] /home/simon/src/josm.svngit/src/org/openstreetmap/josm/gui/SideButton.java:59: warning: [StringEquality] String comparison using reference equality instead of value equality [javac] if (evt.getPropertyName() == javax.swing.Action.SMALL_ICON) { [javac] ^ [javac] (see http://errorprone.info/bugpattern/StringEquality) [javac] Did you mean 'if (javax.swing.Action.SMALL_ICON.equals(evt.getPropertyName())) {'? [javac] /home/simon/src/josm.svngit/src/org/openstreetmap/josm/io/NmeaReader.java:54: warning: [NonOverridingEquals] equals method doesn't override Object.equals; enum instances can safely be compared by reference equality, so please delete this [javac] public boolean equals(String type) { [javac] ^ [javac] (see http://errorprone.info/bugpattern/NonOverridingEquals) [javac] Did you mean to remove this line? [javac] 3 warnings [copy] Copying 1 file to /home/simon/src/josm.svngit/build }}} To integrate it, the following modifications on `build.xml` are required: {{{#!diff diff --git a/build.xml b/build.xml index bd7e95c..019fd16 100644 --- a/build.xml +++ b/build.xml @@ -225,8 +225,12 @@ Build-Date: ${build.tstamp} - + + + @@ -242,8 +246,12 @@ Build-Date: ${build.tstamp} - + + + }}} Shall we add this to our build process?" enhancement closed normal 16.07 Core fixed build error prone ant java8 Don-vip bastiK