Changeset 13202 in josm


Ignore:
Timestamp:
2017-12-16T21:06:42+01:00 (5 weeks ago)
Author:
Don-vip
Message:

update to PMD 6.0.0

Location:
trunk
Files:
6 added
4 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/build.xml

    r13113 r13202  
    844844    <target name="pmd" depends="init-properties">
    845845        <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpath="${toString:pmd.classpath}"/>
    846         <pmd shortFilenames="true" encoding="UTF-8">
     846        <pmd shortFilenames="true" cacheLocation="tools/pmd/cache" encoding="UTF-8">
    847847            <sourceLanguage name="java" version="${java.lang.version}" />
    848848            <ruleset>${base.dir}/tools/pmd/josm-ruleset.xml</ruleset>
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java

    r12809 r13202  
    152152        // if latest version from history is higher than a non existing primitive version,
    153153        // that means this version has been redacted and the primitive cannot be used.
    154         if (history.getLatest().getVersion() > primitive.getVersion())
    155             return false;
     154        return history.getLatest().getVersion() <= primitive.getVersion();
    156155
    157156        // latest has a higher version than one of the primitives
    158157        // in the history (probably because the history got out of sync
    159158        // with uploaded data) -> show the primitive as latest
    160         return true;
    161159    }
    162160
  • trunk/src/org/openstreetmap/josm/tools/HiDPISupport.java

    r12868 r13202  
    187187     */
    188188    public static Image processMRImages(List<Image> imgs, Function<List<Image>, Image> processor) {
    189         CheckParameterUtil.ensureThat(imgs.size() >= 1, "at least on element expected");
     189        CheckParameterUtil.ensureThat(!imgs.isEmpty(), "at least one element expected");
    190190        if (!getBaseMultiResolutionImageClass().isPresent()) {
    191191            return processor.apply(imgs);
  • trunk/tools/pmd

    • Property svn:ignore set to
      cache
  • trunk/tools/pmd/designer.bat

    r11713 r13202  
    22set TOPDIR=%~dp0..
    33set OPTS=
    4 set MAIN_CLASS=net.sourceforge.pmd.util.designer.Designer
     4set MAIN_CLASS=net.sourceforge.pmd.util.fxdesigner.Designer
    55
    6 java -classpath %TOPDIR%\pmd\* %OPTS% %MAIN_CLASS% %*
     6java -classpath "%TOPDIR%\pmd\*" %OPTS% %MAIN_CLASS% %*
  • trunk/tools/pmd/josm-ruleset.xml

    r12877 r13202  
    77  <description>JOSM PMD ruleset</description>
    88 
    9   <!-- <rule ref="rulesets/java/basic.xml"/>
    10   <rule ref="rulesets/java/braces.xml"/>
    11   <rule ref="rulesets/java/clone.xml"/>
    12   <rule ref="rulesets/java/codesize.xml"/>
    13   <rule ref="rulesets/java/comments.xml"/>
    14   <rule ref="rulesets/java/design.xml"/>
    15   <rule ref="rulesets/java/empty.xml"/>
    16   <rule ref="rulesets/java/finalizers.xml"/>
    17   <rule ref="rulesets/java/imports.xml"/>
    18   <rule ref="rulesets/java/migrating.xml"/>-->
    19   <rule ref="rulesets/java/naming.xml">
    20         <exclude name="AbstractNaming"/>
    21         <exclude name="AvoidFieldNameMatchingMethodName"/>
    22         <exclude name="AvoidFieldNameMatchingTypeName"/>
    23         <exclude name="BooleanGetMethodName"/>
    24         <exclude name="LongVariable"/>
    25         <exclude name="ShortClassName"/>
    26         <exclude name="ShortMethodName"/>
    27         <exclude name="ShortVariable"/>
    28         <exclude name="MethodNamingConventions"/>
    29         <exclude name="VariableNamingConventions"/>
     9  <rule ref="category/java/bestpractices.xml">
     10    <exclude name="AccessorClassGeneration"/>
     11    <exclude name="AccessorMethodGeneration"/>
     12    <exclude name="ArrayIsStoredDirectly"/>
     13    <exclude name="AvoidPrintStackTrace"/>
     14    <exclude name="AvoidReassigningParameters"/>
     15    <exclude name="AvoidStringBufferField"/>
     16    <exclude name="AvoidUsingHardCodedIP"/>
     17    <exclude name="ConstantsInInterface"/>
     18    <exclude name="ForLoopCanBeForeach"/>
     19    <exclude name="GuardLogStatement"/>
     20    <exclude name="JUnit4TestShouldUseAfterAnnotation"/>
     21    <exclude name="JUnit4TestShouldUseTestAnnotation"/>
     22    <exclude name="LooseCoupling"/>
     23    <exclude name="MethodReturnsInternalArray"/>
     24    <exclude name="OneDeclarationPerLine"/>
     25    <exclude name="PositionLiteralsFirstInComparisons"/>
     26    <exclude name="PreserveStackTrace"/>
     27    <exclude name="ReplaceHashtableWithMap"/>
     28    <exclude name="SwitchStmtsShouldHaveDefault"/>
     29    <exclude name="SystemPrintln"/>
     30    <exclude name="UnusedFormalParameter"/>
     31    <exclude name="UseVarargs"/>
    3032  </rule>
    31   <rule ref="rulesets/java/naming.xml/ShortMethodName">
     33  <rule ref="category/java/bestpractices.xml/UnusedFormalParameter">
     34    <properties>
     35        <property name="violationSuppressXPath" value="//Annotation[MarkerAnnotation/Name/@Image='Deprecated']/..[MethodDeclaration|ConstructorDeclaration]"/>
     36    </properties>
     37  </rule>
     38  <rule ref="category/java/codestyle.xml">
     39    <exclude name="AbstractNaming"/>
     40    <exclude name="AtLeastOneConstructor"/>
     41    <exclude name="AvoidFinalLocalVariable"/>
     42    <exclude name="AvoidPrefixingMethodParameters"/>
     43    <exclude name="BooleanGetMethodName"/>
     44    <exclude name="CallSuperInConstructor"/>
     45    <exclude name="CommentDefaultAccessModifier"/>
     46    <exclude name="ConfusingTernary"/>
     47    <exclude name="DefaultPackage"/>
     48    <exclude name="EmptyMethodInAbstractClassShouldBeAbstract"/>
     49    <exclude name="FieldDeclarationsShouldBeAtStartOfClass"/>
     50    <exclude name="ForLoopsMustUseBraces"/>
     51    <exclude name="IfElseStmtsMustUseBraces"/>
     52    <exclude name="IfStmtsMustUseBraces"/>
     53    <exclude name="LocalVariableCouldBeFinal"/>
     54    <exclude name="LongVariable"/>
     55    <exclude name="MethodArgumentCouldBeFinal"/>
     56    <exclude name="MethodNamingConventions"/>
     57    <exclude name="OnlyOneReturn"/>
     58    <exclude name="PrematureDeclaration"/>
     59    <exclude name="ShortClassName"/>
     60    <exclude name="ShortMethodName"/>
     61    <exclude name="ShortVariable"/>
     62    <exclude name="TooManyStaticImports"/>
     63    <exclude name="UnnecessaryConstructor"/>
     64    <exclude name="UselessParentheses"/>
     65    <exclude name="VariableNamingConventions"/>
     66    <exclude name="WhileLoopsMustUseBraces"/>
     67  </rule>
     68  <rule ref="category/java/codestyle.xml/ShortMethodName">
    3269    <properties>
    3370        <property name="violationSuppressXPath" value="//MethodDeclarator[@Image='at' or @Image='ht' or @Image='of' or @Image='ok' or @Image='tr']
    34                 | //MethodDeclarator/../../Annotation/MarkerAnnotation/Name[@Image='Deprecated']
    35                 | //MethodDeclarator/../../../..[@Image='LambertConformalConic']"/>
     71          | //MethodDeclarator/../../Annotation/MarkerAnnotation/Name[@Image='Deprecated']
     72          | //MethodDeclarator/../../../..[@Image='LambertConformalConic']"/>
    3673    </properties>
    3774  </rule>
    38   <rule ref="rulesets/java/naming.xml/MethodNamingConventions">
     75  <rule ref="category/java/codestyle.xml/MethodNamingConventions">
    3976    <properties>
    4077        <property name="violationSuppressXPath" value="//MethodDeclarator/../../../..[@Image='Functions' or @Image='PseudoClasses' or @Image='Role' or @Image='TaggingPreset']"/>
    4178    </properties>
    4279  </rule>
    43   <rule ref="rulesets/java/naming.xml/VariableNamingConventions">
     80  <rule ref="category/java/codestyle.xml/VariableNamingConventions">
    4481    <properties>
    4582        <property name="violationSuppressXPath" value="//FieldDeclaration[@Public='true']
    46                 | //FieldDeclaration/../Annotation/MarkerAnnotation/Name[@Image='pref']
    47                 | //FieldDeclaration/Type/ReferenceType/ClassOrInterfaceType[@Image!='Boolean' and
    48                                                                              @Image!='Byte' and
    49                                                                              @Image!='Character' and
    50                                                                              @Image!='Class' and
    51                                                                              @Image!='Double' and
    52                                                                              @Image!='Enum' and
    53                                                                              @Image!='Float' and
    54                                                                              @Image!='Integer' and
    55                                                                              @Image!='Long' and
    56                                                                              @Image!='Number' and
    57                                                                              @Image!='Short' and
    58                                                                              @Image!='String' ]"/>
     83          | //FieldDeclaration/../Annotation/MarkerAnnotation/Name[@Image='pref']
     84          | //FieldDeclaration/Type/ReferenceType/ClassOrInterfaceType[@Image!='Boolean' and
     85                                                                       @Image!='Byte' and
     86                                                                       @Image!='Character' and
     87                                                                       @Image!='Class' and
     88                                                                       @Image!='Double' and
     89                                                                       @Image!='Enum' and
     90                                                                       @Image!='Float' and
     91                                                                       @Image!='Integer' and
     92                                                                       @Image!='Long' and
     93                                                                       @Image!='Number' and
     94                                                                       @Image!='Short' and
     95                                                                       @Image!='String' ]"/>
    5996    </properties>
    6097  </rule>
    61   <rule ref="rulesets/java/naming.xml/LongVariable">
     98  <rule ref="category/java/codestyle.xml/LongVariable">
    6299    <properties>
    63100        <property name="minimum" value="44"/>
    64101    </properties>
    65102  </rule>
    66   <rule ref="rulesets/java/optimizations.xml">
    67         <exclude name="LocalVariableCouldBeFinal"/>
    68         <exclude name="MethodArgumentCouldBeFinal"/>
    69         <exclude name="AvoidInstantiatingObjectsInLoops"/>
    70         <exclude name="PrematureDeclaration"/>
    71         <exclude name="SimplifyStartsWith"/>
    72         <exclude name="UseStringBufferForStringAppends"/>
    73         <exclude name="UseArrayListInsteadOfVector"/>
     103  <rule ref="category/java/design.xml">
     104    <exclude name="AvoidCatchingGenericException"/>
     105    <exclude name="AvoidDeeplyNestedIfStmts"/>
     106    <exclude name="AvoidRethrowingException"/>
     107    <exclude name="CollapsibleIfStatements"/>
     108    <exclude name="CouplingBetweenObjects"/>
     109    <exclude name="CyclomaticComplexity"/>
     110    <exclude name="DataClass"/>
     111    <exclude name="ExceptionAsFlowControl"/>
     112    <exclude name="ExcessiveClassLength"/>
     113    <exclude name="ExcessiveImports"/>
     114    <exclude name="ExcessiveMethodLength"/>
     115    <exclude name="ExcessiveParameterList"/>
     116    <exclude name="ExcessivePublicCount"/>
     117    <exclude name="GodClass"/>
     118    <exclude name="ImmutableField"/>
     119    <exclude name="LawOfDemeter"/>
     120    <exclude name="LoosePackageCoupling"/>
     121    <exclude name="NcssCount"/>
     122    <exclude name="NPathComplexity"/>
     123    <exclude name="SignatureDeclareThrowsException"/>
     124    <exclude name="SimplifiedTernary"/>
     125    <exclude name="SimplifyConditional"/>
     126    <exclude name="SingularField"/>
     127    <exclude name="SwitchDensity"/>
     128    <exclude name="TooManyFields"/>
     129    <exclude name="TooManyMethods"/>
     130    <exclude name="UseObjectForClearerAPI"/>
     131    <exclude name="UselessOverridingMethod"/>
     132    <exclude name="UseUtilityClass"/>
    74133  </rule>
    75   <rule ref="rulesets/java/strictexception.xml">
    76         <exclude name="ExceptionAsFlowControl"/>
    77         <exclude name="AvoidCatchingGenericException"/>
    78         <exclude name="AvoidCatchingNPE"/>
    79         <exclude name="AvoidRethrowingException"/>
    80   </rule>
    81   <rule ref="rulesets/java/strings.xml">
    82         <exclude name="AvoidDuplicateLiterals"/>
    83         <exclude name="ConsecutiveLiteralAppends"/>
    84         <exclude name="AvoidStringBufferField"/>
    85         <exclude name="StringToString"/>
    86         <exclude name="UselessStringValueOf"/>
    87         <exclude name="InefficientEmptyStringCheck"/>
    88   </rule>
    89   <rule ref="rulesets/java/typeresolution.xml">
    90         <exclude name="LooseCoupling"/>
    91         <exclude name="SignatureDeclareThrowsException"/>
    92   </rule>
    93   <rule ref="rulesets/java/typeresolution.xml/SignatureDeclareThrowsException">
     134  <rule ref="category/java/design.xml/SignatureDeclareThrowsException">
    94135    <properties>
    95136        <property name="violationSuppressXPath" value="//MethodDeclaration/../Annotation/MarkerAnnotation/Name[@Image='Override']"/>
     
    97138    </properties>
    98139  </rule>
    99   <rule ref="rulesets/java/unnecessary.xml">
    100         <exclude name="UselessParentheses"/>
    101         <exclude name="UselessOverridingMethod"/>
     140  <rule ref="category/java/errorprone.xml">
     141    <exclude name="AssignmentInOperand"/>
     142    <exclude name="AssignmentToNonFinalStatic"/>
     143    <exclude name="AvoidBranchingStatementAsLastInLoop"/>
     144    <exclude name="AvoidCatchingNPE"/>
     145    <exclude name="AvoidDuplicateLiterals"/>
     146    <exclude name="AvoidFieldNameMatchingMethodName"/>
     147    <exclude name="AvoidFieldNameMatchingTypeName"/>
     148    <exclude name="AvoidInstanceofChecksInCatchClause"/>
     149    <exclude name="AvoidLiteralsInIfCondition"/>
     150    <exclude name="BeanMembersShouldSerialize"/>
     151    <exclude name="CompareObjectsWithEquals"/>
     152    <exclude name="ConstructorCallsOverridableMethod"/>
     153    <exclude name="DataflowAnomalyAnalysis"/>
     154    <exclude name="DoNotCallGarbageCollectionExplicitly"/>
     155    <exclude name="DoNotCallSystemExit"/>
     156    <exclude name="DontImportSun"/>
     157    <exclude name="EmptyIfStmt"/>
     158    <exclude name="EmptyWhileStmt"/>
     159    <exclude name="MissingBreakInSwitch"/>
     160    <exclude name="MissingSerialVersionUID"/>
     161    <exclude name="MissingStaticMethodInNonInstantiatableClass"/>
     162    <exclude name="NonStaticInitializer"/>
     163    <exclude name="NullAssignment"/>
     164    <exclude name="ReturnEmptyArrayRatherThanNull"/>
     165    <exclude name="SimpleDateFormatNeedsLocale"/>
     166    <exclude name="SingleMethodSingleton"/>
     167    <exclude name="SingletonClassReturningNewInstance"/>
     168    <exclude name="TestClassWithoutTestCases"/>
     169    <exclude name="UseProperClassLoader"/>
    102170  </rule>
    103   <rule ref="rulesets/java/unusedcode.xml">
    104         <exclude name="UnusedFormalParameter"/>
    105   </rule>
    106   <rule ref="rulesets/java/unusedcode.xml/UnusedFormalParameter">
    107     <properties>
    108         <property name="violationSuppressXPath" value="//Annotation[MarkerAnnotation/Name/@Image='Deprecated']/..[MethodDeclaration|ConstructorDeclaration]"/>
    109     </properties>
     171  <rule ref="category/java/performance.xml">
     172    <exclude name="AvoidFileStream"/>
     173    <exclude name="AvoidInstantiatingObjectsInLoops"/>
     174    <exclude name="AvoidUsingShortType"/>
     175    <exclude name="ConsecutiveLiteralAppends"/>
     176    <exclude name="InefficientEmptyStringCheck"/>
     177    <exclude name="OptimizableToArrayCall"/>
     178    <exclude name="SimplifyStartsWith"/>
     179    <exclude name="StringToString"/>
     180    <exclude name="TooFewBranchesForASwitchStatement"/>
     181    <exclude name="UseArrayListInsteadOfVector"/>
     182    <exclude name="UselessStringValueOf"/>
     183    <exclude name="UseStringBufferForStringAppends"/>
    110184  </rule>
    111185
Note: See TracChangeset for help on using the changeset viewer.