Index: trunk/tools/pmd/josm-ruleset.xml
===================================================================
--- trunk/tools/pmd/josm-ruleset.xml	(revision 18918)
+++ trunk/tools/pmd/josm-ruleset.xml	(revision 19113)
@@ -6,8 +6,8 @@
 
   <description>JOSM PMD ruleset</description>
+  <!-- Generated files -->
+  <exclude-pattern>.*/org/openstreetmap/josm/gui/mappaint/mapcss/parsergen/.*</exclude-pattern>
 
   <rule ref="category/java/bestpractices.xml">
-    <exclude name="AccessorClassGeneration"/>
-    <exclude name="AccessorMethodGeneration"/>
     <exclude name="ArrayIsStoredDirectly"/>
     <exclude name="AvoidPrintStackTrace"/>
@@ -15,39 +15,32 @@
     <exclude name="AvoidReassigningParameters"/>
     <exclude name="AvoidStringBufferField"/>
-    <exclude name="AvoidUsingHardCodedIP"/>
     <exclude name="ConstantsInInterface"/>
-    <exclude name="ForLoopCanBeForeach"/>
-    <exclude name="ForLoopVariableCount"/>
     <exclude name="GuardLogStatement"/>
-    <exclude name="JUnit4TestShouldUseAfterAnnotation"/>
-    <exclude name="JUnit4TestShouldUseTestAnnotation"/>
+    <exclude name="JUnit4TestShouldUseTestAnnotation" reason="False positive in src/org/openstreetmap/josm/data/validation/Test.java"/>
     <exclude name="LiteralsFirstInComparisons" reason="Introduced in 6.24, some positives in source code at this time. Replaces PositionLiteralsFirstInComparisons."/>
     <exclude name="LooseCoupling"/>
     <exclude name="MethodReturnsInternalArray"/>
     <exclude name="OneDeclarationPerLine"/>
-    <exclude name="PreserveStackTrace"/>
     <exclude name="ReplaceHashtableWithMap"/>
     <exclude name="SwitchStmtsShouldHaveDefault"/>
     <exclude name="SystemPrintln"/>
     <exclude name="UnusedAssignment" reason="Introduced in 6.26, some number of positives in source code at this time"/>
-    <exclude name="UnusedFormalParameter"/>
     <exclude name="UnusedPrivateMethod" reason="Broken since PMD 6.33, see https://github.com/pmd/pmd/issues/3468"/>
+    <exclude name="UnusedPrivateField" reason="Broken in 7.2.x"/>
     <exclude name="UseVarargs"/>
   </rule>
-  <rule ref="category/java/bestpractices.xml/PreserveStackTrace">
+  <rule ref="category/java/bestpractices.xml/ForLoopCanBeForeach">
     <properties>
-        <property name="violationSuppressXPath" value="//PrimaryExpression/PrimaryPrefix/Name[@Image='BugReport.intercept']"/>
+      <!-- The list is expanded during iteration -->
+      <property name="violationSuppressXPath" value="//ClassDeclaration[@SimpleName='PurgeCommand']/ClassBody/MethodDeclaration[@Name='build']/Block/IfStatement/Block/ForStatement/InfixExpression/MethodCall/VariableAccess[@Name='relLst']"/>
     </properties>
   </rule>
-  <rule ref="category/java/bestpractices.xml/UnusedFormalParameter">
+  <rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP">
     <properties>
-        <property name="violationSuppressXPath" value="//Annotation[MarkerAnnotation/Name/@SimpleName='Deprecated']/..[MethodDeclaration|ConstructorDeclaration]"/>
+      <property name="violationSuppressXPath" value="//ClassDeclaration[@SimpleName='DefaultProxySelector' or @SimpleName='RemoteControl']"/>
     </properties>
   </rule>
   <rule ref="category/java/codestyle.xml">
-    <exclude name="AbstractNaming"/>
     <exclude name="AtLeastOneConstructor"/>
-    <exclude name="AvoidFinalLocalVariable"/>
-    <exclude name="AvoidPrefixingMethodParameters"/>
     <exclude name="BooleanGetMethodName"/>
     <exclude name="CallSuperInConstructor"/>
@@ -56,5 +49,4 @@
     <exclude name="ConfusingTernary"/>
     <exclude name="ControlStatementBraces"/>
-    <exclude name="DefaultPackage"/>
     <!-- EmptyControlStatement is not configurable, so the behavior of the old excludes of EmptyIfStmt/EmptyWhileStmt (errorprone.xml) while getting new functionality cannot be done -->
     <exclude name="EmptyControlStatement"/>
@@ -62,7 +54,4 @@
     <exclude name="FieldDeclarationsShouldBeAtStartOfClass"/>
     <exclude name="FieldNamingConventions"/>
-    <exclude name="ForLoopsMustUseBraces"/>
-    <exclude name="IfElseStmtsMustUseBraces"/>
-    <exclude name="IfStmtsMustUseBraces"/>
     <exclude name="LinguisticNaming"/>
     <exclude name="LocalVariableCouldBeFinal"/>
@@ -81,17 +70,14 @@
     <exclude name="UseUnderscoresInNumericLiterals"/>
     <exclude name="UselessParentheses"/>
-    <exclude name="VariableNamingConventions"/>
-    <exclude name="WhileLoopsMustUseBraces"/>
+    <exclude name="UnnecessaryFullyQualifiedName" reason="7.x increased sensitivity (250 new issues), and it now warns on qualified names inside a class, e.g. ClassName.STATIC_VARIABLE. Should probably be fixed in our source code."/>
   </rule>
   <rule ref="category/java/codestyle.xml/ShortMethodName">
     <properties>
-        <property name="violationSuppressXPath" value="//MethodDeclaration[@Name='at' or @Name='ht' or @Name='of' or @Name='ok' or @Name='tr']
-          | //MethodDeclaration/../../Annotation/MarkerAnnotation/Name[@Image='Deprecated']
-          | //MethodDeclaration/../../../..[@Image='LambertConformalConic']"/>
+      <property name="violationSuppressXPath" value="//MethodDeclaration[@Name='at' or @Name='ht' or @Name='of' or @Name='ok' or @Name='tr']"/>
     </properties>
   </rule>
   <rule ref="category/java/codestyle.xml/MethodNamingConventions">
     <properties>
-        <property name="violationSuppressXPath" value="//MethodDeclaration/../../..[@SimpleName='Functions' or @SimpleName='PseudoClasses' or @SimpleName='Role' or @SimpleName='TaggingPreset' or @SimpleName='RegionSpecific']"/>
+      <property name="violationSuppressXPath" value="//ClassDeclaration[@SimpleName='Functions' or @SimpleName='PseudoClasses' or @SimpleName='Role' or @SimpleName='TaggingPreset' or @SimpleName='RegionSpecific']"/>
     </properties>
   </rule>
@@ -99,18 +85,18 @@
     <properties>
         <property name="enumConstantPattern" value="[A-Za-z][A-Za-z_0-9]*"/>
-        <property name="violationSuppressXPath" value="//FieldDeclaration[@Public='true']
-          | //FieldDeclaration/../Annotation/MarkerAnnotation/Name[@Image='pref']
-          | //FieldDeclaration/Type/ReferenceType/ClassOrInterfaceType[@Image!='Boolean' and
-                                                                       @Image!='Byte' and
-                                                                       @Image!='Character' and
-                                                                       @Image!='Class' and
-                                                                       @Image!='Double' and
-                                                                       @Image!='Enum' and
-                                                                       @Image!='Float' and
-                                                                       @Image!='Integer' and
-                                                                       @Image!='Long' and
-                                                                       @Image!='Number' and
-                                                                       @Image!='Short' and
-                                                                       @Image!='String' ]"/>
+        <property name="violationSuppressXPath" value="//FieldDeclaration[@Visibility='public']
+          | //FieldDeclaration/ModifierList/Annotation[@SimpleName='StructEntry']
+          | //FieldDeclaration/ClassType[@SimpleName!='Boolean' and
+                                         @SimpleName!='Byte' and
+                                         @SimpleName!='Character' and
+                                         @SimpleName!='Class' and
+                                         @SimpleName!='Double' and
+                                         @SimpleName!='Enum' and
+                                         @SimpleName!='Float' and
+                                         @SimpleName!='Integer' and
+                                         @SimpleName!='Long' and
+                                         @SimpleName!='Number' and
+                                         @SimpleName!='Short' and
+                                         @SimpleName!='String' ]"/>
     </properties>
   </rule>
@@ -124,4 +110,5 @@
     <exclude name="AvoidDeeplyNestedIfStmts"/>
     <exclude name="AvoidRethrowingException"/>
+    <exclude name="AvoidUncheckedExceptionsInSignatures" reason="We disagree with the reasoning for making this an issue; a strength of Java is verbosity, and warning users about adding `@throws &lt;? extends RuntimeException&gt;` is probably a bad long-term idea."/>
     <exclude name="CognitiveComplexity" reason="Introduced in 6.35, some number of positives in source code at this time"/>
     <exclude name="CollapsibleIfStatements"/>
@@ -142,4 +129,5 @@
     <exclude name="SignatureDeclareThrowsException"/>
     <exclude name="SimplifiedTernary"/>
+    <exclude name="SimplifyBooleanReturns" reason="Increased sensitivity in 7.x; should be fixed in our source code." />
     <exclude name="SimplifyConditional"/>
     <exclude name="SingularField"/>
@@ -153,5 +141,5 @@
   <rule ref="category/java/design.xml/SignatureDeclareThrowsException">
     <properties>
-        <property name="violationSuppressXPath" value="//MethodDeclaration/../Annotation/MarkerAnnotation/Name[@Image='Override']"/>
+        <property name="violationSuppressXPath" value="//MethodDeclaration/ModifierList/Annotation[@SimpleName='Override']"/>
         <property name="IgnoreJUnitCompletely" value="true"/>
     </properties>
@@ -167,9 +155,7 @@
     <exclude name="AvoidInstanceofChecksInCatchClause"/>
     <exclude name="AvoidLiteralsInIfCondition"/>
-    <exclude name="CloneThrowsCloneNotSupportedException"/>
-    <!-- <exclude name="CloseResource"/> -->
     <exclude name="CompareObjectsWithEquals"/>
+    <exclude name="ConfusingArgumentToVarargsMethod" reason="Introduced in 7.1.0; there are false positives in source code at this time."/>
     <exclude name="ConstructorCallsOverridableMethod"/>
-    <exclude name="DataflowAnomalyAnalysis"/>
     <exclude name="DoNotTerminateVM"/>
     <exclude name="DontImportSun"/>
@@ -180,5 +166,4 @@
     <exclude name="NonStaticInitializer"/>
     <exclude name="NullAssignment"/>
-    <exclude name="ReturnEmptyArrayRatherThanNull"/>
     <exclude name="ReturnEmptyCollectionRatherThanNull" reason="Introduced in 6.37, there are positives in source code at this time"/>
     <exclude name="SimpleDateFormatNeedsLocale"/>
@@ -190,13 +175,11 @@
   <rule ref="category/java/errorprone.xml/AvoidAccessibilityAlteration">
     <properties>
-      <property name="violationSuppressXPath" value="//MethodDeclaration/../../..[@SimpleName='ReflectionUtils']"/>
+      <property name="violationSuppressXPath" value="//ClassDeclaration[@SimpleName='ReflectionUtils']"/>
     </properties>
   </rule>
   <rule ref="category/java/performance.xml">
     <exclude name="AvoidInstantiatingObjectsInLoops"/>
-    <exclude name="AvoidUsingShortType"/>
     <exclude name="ConsecutiveLiteralAppends"/>
     <exclude name="InefficientEmptyStringCheck"/>
-    <exclude name="SimplifyStartsWith"/>
     <exclude name="InsufficientStringBufferDeclaration" reason="PMD 6.40 has a bug where it doesn't properly count appended strings in if statements."/>
     <exclude name="TooFewBranchesForASwitchStatement"/>
