Index: build.gradle
===================================================================
--- build.gradle	(revision 35733)
+++ build.gradle	(working copy)
@@ -1,15 +1,18 @@
+import com.github.spotbugs.snom.SpotBugsTask
+import net.ltgt.gradle.errorprone.CheckSeverity
+
 plugins {
-  id "org.sonarqube" version "2.6.2"
-  id "org.kordamp.markdown.convert" version "1.1.0"
-  id 'org.openstreetmap.josm' version "0.4.4"
-  id "com.github.ben-manes.versions" version "0.17.0"
-  id 'com.github.spotbugs' version '1.6.1'
-  id "net.ltgt.errorprone" version "0.0.14"
-
+  id 'java'
   id 'eclipse'
   id 'jacoco'
-  id 'java'
   id 'pmd'
+  id("com.github.ben-manes.versions").version("0.38.0")
+  id("net.ltgt.errorprone").version("2.0.1")
+  id("org.kordamp.markdown.convert").version("1.2.0")
+  id("org.sonarqube").version("3.1.1")
+  id('com.github.spotbugs').version('4.7.0')
+  id('org.openstreetmap.josm').version("0.7.1")
+  id("com.diffplug.spotless").version("5.12.1")
 }
 
 apply from: 'gradle/tool-config.gradle'
@@ -34,15 +37,31 @@
   mavenCentral()
 }
 
+def versions = [
+  awaitility: "4.0.3",
+  jackson: "2.12.3",
+  jmockit: "1.46",
+  junit: "5.7.1",
+  wiremock: "2.27.2"
+]
+
 dependencies {
-  compile 'com.fasterxml.jackson.core:jackson-core:2.2.4'
-  compile 'com.fasterxml.jackson.core:jackson-databind:2.2.4'
-  compile 'com.fasterxml.jackson.core:jackson-annotations:2.2.4'
-  compile 'us.monoid.web:resty:0.3.2'
-  compile 'log4j:log4j:1.2.17'
-  testImplementation ('org.openstreetmap.josm:josm-unittest'){changing=true}
-  testImplementation 'com.github.tomakehurst:wiremock:2.17.0'
-  testImplementation 'junit:junit:4.12'
+  if (!JavaVersion.current().isJava9Compatible()) {
+    errorproneJavac("com.google.errorprone:javac:9+181-r4173-1")
+  }
+  implementation "com.fasterxml.jackson.core:jackson-core:${versions.jackson}"
+  implementation "com.fasterxml.jackson.core:jackson-databind:${versions.jackson}"
+  implementation "com.fasterxml.jackson.core:jackson-annotations:${versions.jackson}"
+  implementation "us.monoid.web:resty:0.3.2"
+  implementation "log4j:log4j:1.2.17"
+  testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${versions.junit}")
+  testImplementation("org.junit.jupiter:junit-jupiter-params:${versions.junit}")
+  testImplementation("org.junit.jupiter:junit-jupiter-api:${versions.junit}")
+  testImplementation("org.junit.vintage:junit-vintage-engine:${versions.junit}")
+  testImplementation ("org.openstreetmap.josm:josm-unittest"){changing=true}
+  testImplementation "com.github.tomakehurst:wiremock:${versions.wiremock}"
+  testImplementation("org.jmockit:jmockit:${versions.jmockit}") { because("versions >= 1.47 are incompatible with JOSM, see https://josm.openstreetmap.de/ticket/18200") }
+  testImplementation("org.awaitility:awaitility:${versions.awaitility}")
 }
 
 sourceSets {
@@ -68,16 +87,27 @@
   }
 }
 
-josm {
-  debugPort = 7051
-  manifest {
-      //oldVersionDownloadLink 10824, 'v1.5.3', new URL('https://github.com/JOSM/Mapillary/releases/download/v1.5.3/Mapillary.jar')
+spotless {
+  enforceCheck = false
+  format("misc") {
+    target("**/*.gradle", "**.*.md", "**/.gitignore")
+
+    trimTrailingWhitespace()
+    indentWithSpaces(2)
+    endWithNewline()
   }
-  i18n {
-    pathTransformer = getGithubPathTransformer('spatialdev/MicrosoftStreetside')
+  java {
+    trimTrailingWhitespace()
+    indentWithSpaces(2)
+    endWithNewline()
+    removeUnusedImports()
   }
 }
 
+josm {
+  debugPort = 7051
+}
+
 eclipse {
   project {
     name = 'MicrosoftStreetside'
@@ -99,7 +129,7 @@
 tasks.withType(Javadoc) {
   failOnError false
 }
-tasks.withType(com.github.spotbugs.SpotBugsTask) {
+tasks.withType(SpotBugsTask) {
   reports {
     xml.enabled = false
     html.enabled = true
@@ -109,6 +139,10 @@
 import org.gradle.api.tasks.testing.logging.TestLogEvent
 
 test {
+  project.afterEvaluate {
+    jvmArgs("-javaagent:${classpath.find { it.name.contains("jmockit") }.absolutePath}")
+  }
+  useJUnitPlatform()
   testLogging {
     exceptionFormat "full"
     events TestLogEvent.FAILED, TestLogEvent.SKIPPED
Index: config/pmd/ruleset.xml
===================================================================
--- config/pmd/ruleset.xml	(revision 35733)
+++ config/pmd/ruleset.xml	(working copy)
@@ -6,45 +6,24 @@
   <description>
     This ruleset checks some rules that you should normally follow for the ms-streetside-josm-plugin.
   </description>
-  <rule ref="rulesets/java/basic.xml"/>
-  <rule ref="rulesets/java/braces.xml">
-    <exclude name="IfStmtsMustUseBraces"/>
-  </rule>
-  <rule ref="rulesets/java/clone.xml"/>
 
-  <rule ref="rulesets/java/controversial.xml/UnnecessaryConstructor"/>
-  <rule ref="rulesets/java/controversial.xml/AssignmentInOperand"/>
-  <rule ref="rulesets/java/controversial.xml/DontImportSun"/>
-  <rule ref="rulesets/java/controversial.xml/SuspiciousOctalEscape"/>
-  <rule ref="rulesets/java/controversial.xml/UnnecessaryParentheses"/>
-
-  <rule ref="rulesets/java/coupling.xml">
+  <rule ref="category/java/design.xml">
     <exclude name="LoosePackageCoupling" />
     <exclude name="LawOfDemeter" />
   </rule>
-  <rule ref="rulesets/java/design.xml">
-    <exclude name="AvoidSynchronizedAtMethodLevel" />
+  <rule ref="category/java/codestyle.xml">
     <exclude name="ConfusingTernary" />
+    <exclude name="LocalVariableCouldBeFinal" />
+    <exclude name="MethodArgumentCouldBeFinal" />
+    <exclude name="UselessParentheses" />
+    <exclude name="IfStmtsMustUseBraces"/>
   </rule>
-  <rule ref="rulesets/java/empty.xml"/>
-  <rule ref="rulesets/java/finalizers.xml"/>
-  <rule ref="rulesets/java/imports.xml"/>
-  <rule ref="rulesets/java/naming.xml">
-    <exclude name="ShortVariable"/>
-    <exclude name="LongVariable"/>
-    <exclude name="AbstractNaming"/>
+  <rule ref="category/java/multithreading.xml">
+    <exclude name="AvoidSynchronizedAtMethodLevel" />
   </rule>
-  <rule ref="rulesets/java/optimizations.xml">
-    <exclude name="LocalVariableCouldBeFinal" />
-    <exclude name="MethodArgumentCouldBeFinal" />
+  <rule ref="category/java/bestpractices.xml"/>
+  <rule ref="category/java/errorprone.xml"/>
+  <rule ref="category/java/performance.xml">
     <exclude name="AvoidInstantiatingObjectsInLoops" />
   </rule>
-  <rule ref="rulesets/java/strictexception.xml"/>
-  <rule ref="rulesets/java/strings.xml"/>
-  <rule ref="rulesets/java/sunsecure.xml"/>
-  <rule ref="rulesets/java/typeresolution.xml"/>
-  <rule ref="rulesets/java/unnecessary.xml">
-    <exclude name="UselessParentheses" />
-  </rule>
-  <rule ref="rulesets/java/unusedcode.xml"/>
 </ruleset>
Index: gradle/tool-config.gradle
===================================================================
--- gradle/tool-config.gradle	(revision 35733)
+++ gradle/tool-config.gradle	(working copy)
@@ -1,10 +1,11 @@
-def pmdVersion = "5.8.0" // TODO: Update to PMD 6
-def spotbugsVersion = "3.1.3"
-def jacocoVersion = "0.8.1"
-def errorproneVersion = "2.3.1"
+def pmdVersion = "6.21.0" // TODO: Update to PMD 6
+def spotbugsVersion = "4.0.3"
+def jacocoVersion = "0.8.5"
+def errorproneVersion = "2.3.4"
 
 // Set up ErrorProne (currently only for JDK8, until JDK9 is supported)
 dependencies.errorprone "com.google.errorprone:error_prone_core:$errorproneVersion"
+/*
 tasks.withType(JavaCompile) {
 options.compilerArgs += ['-Xep:DefaultCharset:ERROR',
   '-Xep:ClassCanBeStatic:ERROR',
@@ -16,6 +17,7 @@
   '-Xep:LambdaFunctionalInterface:WARN',
   '-Xep:ConstantField:WARN']
 }
+*/
 
 // Spotbugs config
 spotbugs {
@@ -23,7 +25,7 @@
   ignoreFailures = true
   effort = "max"
   reportLevel = "low"
-  sourceSets = [sourceSets.main, sourceSets.test]
+  //sourceSets = [sourceSets.main, sourceSets.test]
 }
 
 // JaCoCo config
Index: gradle/wrapper/gradle-wrapper.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: gradle/wrapper/gradle-wrapper.properties
===================================================================
--- gradle/wrapper/gradle-wrapper.properties	(revision 35733)
+++ gradle/wrapper/gradle-wrapper.properties	(working copy)
@@ -1,5 +1,6 @@
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip
+distributionSha256Sum=eb8b89184261025b0430f5b2233701ff1377f96da1ef5e278af6ae8bac5cc305
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
Index: gradlew
===================================================================
--- gradlew	(revision 35733)
+++ gradlew	(working copy)
@@ -1,5 +1,21 @@
 #!/usr/bin/env sh
 
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
 ##############################################################################
 ##
 ##  Gradle start up script for UN*X
@@ -28,7 +44,7 @@
 APP_BASE_NAME=`basename "$0"`
 
 # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
 
 # Use the maximum available, or set MAX_FD != -1 to use that value.
 MAX_FD="maximum"
@@ -66,6 +82,7 @@
 
 CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
 
+
 # Determine the Java command to use to start the JVM.
 if [ -n "$JAVA_HOME" ] ; then
     if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -109,10 +126,11 @@
     GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
 fi
 
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
     APP_HOME=`cygpath --path --mixed "$APP_HOME"`
     CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+    
     JAVACMD=`cygpath --unix "$JAVACMD"`
 
     # We build the pattern for arguments to be converted via cygpath
@@ -138,19 +156,19 @@
         else
             eval `echo args$i`="\"$arg\""
         fi
-        i=$((i+1))
+        i=`expr $i + 1`
     done
     case $i in
-        (0) set -- ;;
-        (1) set -- "$args0" ;;
-        (2) set -- "$args0" "$args1" ;;
-        (3) set -- "$args0" "$args1" "$args2" ;;
-        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
-        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
-        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
-        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
-        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
-        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+        0) set -- ;;
+        1) set -- "$args0" ;;
+        2) set -- "$args0" "$args1" ;;
+        3) set -- "$args0" "$args1" "$args2" ;;
+        4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+        5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+        6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+        7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+        8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+        9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
     esac
 fi
 
@@ -159,14 +177,9 @@
     for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
     echo " "
 }
-APP_ARGS=$(save "$@")
+APP_ARGS=`save "$@"`
 
 # Collect all arguments for the java command, following the shell quoting and substitution rules
 eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
 
-# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
-if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
-  cd "$(dirname "$0")"
-fi
-
 exec "$JAVACMD" "$@"
Index: gradlew.bat
===================================================================
--- gradlew.bat	(revision 35733)
+++ gradlew.bat	(working copy)
@@ -1,3 +1,19 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem      https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
 @if "%DEBUG%" == "" @echo off
 @rem ##########################################################################
 @rem
@@ -13,8 +29,11 @@
 set APP_BASE_NAME=%~n0
 set APP_HOME=%DIRNAME%
 
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
 @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
 
 @rem Find java.exe
 if defined JAVA_HOME goto findJavaFromJavaHome
@@ -65,6 +84,7 @@
 
 set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
 
+
 @rem Execute Gradle
 "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
 
Index: ivy_settings.xml
===================================================================
--- ivy_settings.xml	(revision 35733)
+++ ivy_settings.xml	(working copy)
@@ -1,7 +1,7 @@
 <ivysettings>
-    <version-matchers usedefaults="true">
+    <!--<version-matchers usedefaults="true">
         <maven-tsnap-vm/>
-    </version-matchers>
+    </version-matchers>-->
     <settings defaultResolver="central"/>
     <resolvers>
         <ibiblio name="central" m2compatible="true"/>
