Files

53 KiB
Raw Permalink Blame History

代码审查报告

文件: data\demo-pmd\src\com\demo\bpcs\BestPracticesCodeStyle.java 语言: java 耗时: 290.6s 分析工具: pmd


总计: 524 | 错误: 78 | 警告: 416 | 建议: 30

静态分析 · 517 个问题

  • 🔴 pmd:SystemPrintln L51 Usage of System.out/err
  • 🔴 pmd:ImplicitFunctionalInterface L109 Annotate this interface with @FunctionalInterface or with @SuppressWarnings("PMD.ImplicitFunctionalInterface") to clarify your intent.
  • 🔴 pmd:AvoidFileStream L130 Avoid instantiating FileInputStream, FileOutputStream, FileReader, or FileWriter
  • 🔴 pmd:SystemPrintln L158 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L159 Usage of System.out/err
  • 🔴 pmd:AvoidFileStream L166 Avoid instantiating FileInputStream, FileOutputStream, FileReader, or FileWriter
  • 🔴 pmd:AvoidFileStream L176 Avoid instantiating FileInputStream, FileOutputStream, FileReader, or FileWriter
  • 🔴 pmd:AvoidThrowingRawExceptionTypes L240 Avoid throwing raw exception type RuntimeException.
  • 🔴 pmd:AvoidReassigningParameters L259 Avoid reassigning parameters such as 'x'
  • 🔴 pmd:AvoidThrowingRawExceptionTypes L359 Avoid throwing raw exception type RuntimeException.
  • 🔴 pmd:SystemPrintln L384 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L392 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L401 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L410 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L448 Usage of System.out/err
  • 🔴 pmd:FieldNamingConventions L458 The constant name 'log' doesn't match '[A-Z][A-Z_0-9]*'
  • 🔴 pmd:GuardLogStatement L461 Logger calls should be surrounded by log level guards.
  • 🔴 pmd:SystemPrintln L480 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L508 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L523 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L539 Usage of System.out/err
  • 🔴 pmd:ClassNamingConventions L554 The class name 'Bad$Name' doesn't match '[A-Z][a-zA-Z0-9]*'
  • 🔴 pmd:ClassNamingConventions L582 The class name 'badClassName' doesn't match '[A-Z][a-zA-Z0-9]*'
  • 🔴 pmd:SystemPrintln L607 Usage of System.out/err
  • 🔴 pmd:EmptyMethodInAbstractClassShouldBeAbstract L621 An empty method in an abstract class should be abstract instead
  • 🔴 pmd:FieldNamingConventions L638 The field name 'bad_name' doesn't match '[a-z][a-zA-Z0-9]*'
  • 🔴 pmd:FinalParameterInAbstractMethod L643 Final parameter in abstract method
  • 🔴 pmd:FormalParameterNamingConventions L658 The method parameter name 'bad_param' doesn't match '[a-z][a-zA-Z0-9]*'
  • 🔴 pmd:SystemPrintln L668 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L670 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L693 Usage of System.out/err
  • 🔴 pmd:LocalVariableNamingConventions L700 The local variable name 'bad_var' doesn't match '[a-z][a-zA-Z0-9]*'
  • 🔴 pmd:SystemPrintln L701 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L708 Usage of System.out/err
  • 🔴 pmd:MethodNamingConventions L714 The instance method name 'BadMethod' doesn't match '[a-z][a-zA-Z0-9]*'
  • 🔴 pmd:ModifierOrder L720 Missorted modifiers static public.
  • 🔴 pmd:ModifierOrder L722 Missorted modifiers final private.
  • 🔴 pmd:SystemPrintln L739 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L740 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L741 Usage of System.out/err
  • 🔴 pmd:StringInstantiation L796 Avoid instantiating String objects; this is usually unnecessary.
  • 🔴 pmd:ImplicitFunctionalInterface L805 Annotate this interface with @FunctionalInterface or with @SuppressWarnings("PMD.ImplicitFunctionalInterface") to clarify your intent.
  • 🔴 pmd:SystemPrintln L812 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L821 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L834 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L842 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L851 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L869 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L877 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L878 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L879 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L880 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L881 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L882 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L888 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L926 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L943 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L951 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L952 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L953 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L954 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L958 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L986 Usage of System.out/err
  • 🔴 pmd:AvoidUsingNativeCode L1006 The use of native code is not recommended.
  • 🔴 pmd:SystemPrintln L1025 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L1026 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L1027 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L1028 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L1029 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L1030 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L1031 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L1032 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L1033 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L1034 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L1038 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L1044 Usage of System.out/err
  • 🔴 pmd:SystemPrintln L1053 Usage of System.out/err
  • 🟡 pmd:TooManyStaticImports L29 Too many static imports may lead to messy code
  • 🟡 pmd:AtLeastOneConstructor L48 Each class should declare at least one constructor
  • 🟡 pmd:AbstractClassWithoutAbstractMethod L48 This abstract class does not have any abstract methods
  • 🟡 pmd:PublicMemberInNonPublicType L50 Public member 'start' declared in a non-public type
  • 🟡 pmd:CommentDefaultAccessModifier L59 Missing commented default access modifier on constructor 'DataProcessor(String[])'
  • 🟡 pmd:MethodArgumentCouldBeFinal L59 Parameter 'input' is not assigned and could be declared final
  • 🟡 pmd:ArrayIsStoredDirectly L60 The user-supplied array 'input' is stored directly.
  • 🟡 pmd:PublicMemberInNonPublicType L63 Public member 'getItems' declared in a non-public type
  • 🟡 pmd:MethodReturnsInternalArray L64 Returning 'items' may expose an internal array.
  • 🟡 pmd:AvoidMessageDigestField L71 You shouldnt declare field of MessageDigest type, because unsynchronized access could cause problems
  • 🟡 pmd:UnusedPrivateField L71 Avoid unused private fields such as 'digest'.
  • 🟡 pmd:CommentDefaultAccessModifier L73 Missing commented default access modifier on constructor 'Hasher()'
  • 🟡 pmd:AvoidCatchingGenericException L76 Avoid catching Exception in try-catch block
  • 🟡 pmd:AtLeastOneConstructor L83 Each class should declare at least one constructor
  • 🟡 pmd:AvoidStringBufferField L84 StringBuffers can grow quite a lot, and so may become a source of memory leak (if the owning class has a long life time).
  • 🟡 pmd:ImmutableField L84 Field 'sb' may be declared final
  • 🟡 pmd:CommentDefaultAccessModifier L86 Missing commented default access modifier on method 'add(String)'
  • 🟡 pmd:MethodArgumentCouldBeFinal L86 Parameter 's' is not assigned and could be declared final
  • 🟡 pmd:AtLeastOneConstructor L92 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L93 Missing commented default access modifier on field 'host'
  • 🟡 pmd:ConstantsInInterface L98 Using constants in interfaces is a bad practice.
  • 🟡 pmd:AtLeastOneConstructor L102 Each class should declare at least one constructor
  • 🟡 pmd:UseConcurrentHashMap L103 If you run in Java5 or newer and have concurrent access, you should use the ConcurrentHashMap implementation
  • 🟡 pmd:CommentDefaultAccessModifier L103 Missing commented default access modifier on field 'map'
  • 🟡 pmd:UseDiamondOperator L103 Explicit type arguments can be replaced by a diamond: new HashMap<>()
  • 🟡 pmd:DoubleBraceInitialization L103 Double-brace initialization should be avoided
  • 🟡 pmd:AtLeastOneConstructor L114 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L115 Missing commented default access modifier on method 'outer()'
  • 🟡 pmd:AvoidLiteralsInIfCondition L119 Avoid using literals such as 2 in if statements
  • 🟡 pmd:AtLeastOneConstructor L128 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L129 Missing commented default access modifier on method 'read()'
  • 🟡 pmd:CloseResource L130 Ensure that resources like this FileInputStream object are closed after use
  • 🟡 pmd:LocalVariableCouldBeFinal L130 Local variable 'fis' could be declared final
  • 🟡 pmd:CloseResource L131 Ensure that resources like this InputStreamReader object are closed after use
  • 🟡 pmd:LocalVariableCouldBeFinal L131 Local variable 'isr' could be declared final
  • 🟡 pmd:RelianceOnDefaultCharset L131 Specify a character set instead of relying on the default charset
  • 🟡 pmd:CloseResource L132 Ensure that resources like this BufferedReader object are closed after use
  • 🟡 pmd:LocalVariableCouldBeFinal L132 Local variable 'br' could be declared final
  • 🟡 pmd:AtLeastOneConstructor L138 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L139 Missing commented default access modifier on method 'list()'
  • 🟡 pmd:LooseCoupling L140 Avoid using implementation types like 'Hashtable'; use the interface instead
  • 🟡 pmd:ReplaceHashtableWithMap L140 Consider replacing this Hashtable with the newer java.util.Map
  • 🟡 pmd:LocalVariableCouldBeFinal L140 Local variable 'h' could be declared final
  • 🟡 pmd:ReplaceHashtableWithMap L140 Consider replacing this Hashtable with the newer java.util.Map
  • 🟡 pmd:UnusedLocalVariable L141 Avoid unused local variables such as 'e'.
  • 🟡 pmd:AtLeastOneConstructor L146 Each class should declare at least one constructor
  • 🟡 pmd:LooseCoupling L147 Avoid using implementation types like 'Hashtable'; use the interface instead
  • 🟡 pmd:ReplaceHashtableWithMap L147 Consider replacing this Hashtable with the newer java.util.Map
  • 🟡 pmd:CommentDefaultAccessModifier L147 Missing commented default access modifier on field 'table'
  • 🟡 pmd:ReplaceHashtableWithMap L147 Consider replacing this Hashtable with the newer java.util.Map
  • 🟡 pmd:AtLeastOneConstructor L151 Each class should declare at least one constructor
  • 🟡 pmd:LooseCoupling L152 Avoid using implementation types like 'Vector'; use the interface instead
  • 🟡 pmd:ReplaceVectorWithList L152 Consider replacing this Vector with the newer java.util.List
  • 🟡 pmd:CommentDefaultAccessModifier L152 Missing commented default access modifier on field 'v'
  • 🟡 pmd:ReplaceVectorWithList L152 Consider replacing this Vector with the newer java.util.List
  • 🟡 pmd:UseArrayListInsteadOfVector L152 Use ArrayList instead of Vector
  • 🟡 pmd:AtLeastOneConstructor L156 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L157 Missing commented default access modifier on method 'log()'
  • 🟡 pmd:AtLeastOneConstructor L164 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L165 Missing commented default access modifier on method 'doIt()'
  • 🟡 pmd:CloseResource L166 Ensure that resources like this FileInputStream object are closed after use
  • 🟡 pmd:LocalVariableCouldBeFinal L166 Local variable 'fis' could be declared final
  • 🟡 pmd:CloseResource L167 Ensure that resources like this InputStreamReader object are closed after use
  • 🟡 pmd:LocalVariableCouldBeFinal L167 Local variable 'isr' could be declared final
  • 🟡 pmd:UseStandardCharsets L167 Please use StandardCharsets constants
  • 🟡 pmd:CloseResource L168 Ensure that resources like this BufferedReader object are closed after use
  • 🟡 pmd:LocalVariableCouldBeFinal L168 Local variable 'br' could be declared final
  • 🟡 pmd:AtLeastOneConstructor L174 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L175 Missing commented default access modifier on method 'read()'
  • 🟡 pmd:LocalVariableCouldBeFinal L176 Local variable 'br' could be declared final
  • 🟡 pmd:RelianceOnDefaultCharset L176 Specify a character set instead of relying on the default charset
  • 🟡 pmd:UseTryWithResources L177 Consider using a try-with-resources statement instead of explicitly closing the resource
  • 🟡 pmd:AtLeastOneConstructor L186 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L187 Missing commented default access modifier on method 'accept(String[])'
  • 🟡 pmd:AtLeastOneConstructor L193 Each class should declare at least one constructor
  • 🟡 pmd:RedundantFieldInitializer L194 Avoid using redundant field initializer for 'i'
  • 🟡 pmd:CommentDefaultAccessModifier L194 Missing commented default access modifier on field 'i'
  • 🟡 pmd:CommentDefaultAccessModifier L195 Missing commented default access modifier on method 'loop()'
  • 🟡 pmd:AssignmentInOperand L197 Avoid assignment to i in operand
  • 🟡 pmd:AvoidLiteralsInIfCondition L197 Avoid using literals such as 5 in if statements
  • 🟡 pmd:AtLeastOneConstructor L205 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L206 Missing commented default access modifier on field 'a'
  • 🟡 pmd:AtLeastOneConstructor L210 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L211 Missing commented default access modifier on method 'call()'
  • 🟡 pmd:UnnecessaryVarargsArrayCreation L212 Unnecessary explicit array creation for varargs method call
  • 🟡 pmd:CommentDefaultAccessModifier L214 Missing commented default access modifier on method 'accept2(String[])'
  • 🟡 pmd:AtLeastOneConstructor L220 Each class should declare at least one constructor
  • 🟡 pmd:PublicMemberInNonPublicType L221 Public member 'm' declared in a non-public type
  • 🟡 pmd:AtLeastOneConstructor L226 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L227 Missing commented default access modifier on method 'bad()'
  • 🟡 pmd:UnusedLocalVariable L229 Avoid unused local variables such as 'x'.
  • 🟡 pmd:AvoidPrintStackTrace L231 Avoid printStackTrace(); use a logger call instead.
  • 🟡 pmd:AtLeastOneConstructor L237 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L238 Missing commented default access modifier on method 'bad()'
  • 🟡 pmd:ExceptionAsFlowControl L241 Exception thrown at line 240 is caught in this block.
  • 🟡 pmd:AvoidCatchingGenericException L241 Avoid catching RuntimeException in try-catch block
  • 🟡 pmd:UnusedAssignment L241 The initial value of exception parameter 'e' is never used (overwritten on line 242)
  • 🟡 pmd:AvoidReassigningCatchVariables L242 Avoid reassigning caught exception 'e'
  • 🟡 pmd:UnusedAssignment L242 The value assigned to variable 'e' is never used
  • 🟡 pmd:AtLeastOneConstructor L248 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L249 Missing commented default access modifier on method 'bad()'
  • 🟡 pmd:AvoidReassigningLoopVariables L251 Avoid reassigning the loop control variable 'i'
  • 🟡 pmd:AtLeastOneConstructor L257 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L258 Missing commented default access modifier on method 'bad(int)'
  • 🟡 pmd:UnusedAssignment L258 The initial value of parameter 'x' is never used (overwritten on line 259)
  • 🟡 pmd:UnusedAssignment L259 The value assigned to variable 'x' is never used
  • 🟡 pmd:AtLeastOneConstructor L264 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L265 Missing commented default access modifier on method 'bad()'
  • 🟡 pmd:CloseResource L267 Ensure that resources like this Statement object are closed after use
  • 🟡 pmd:LocalVariableCouldBeFinal L267 Local variable 'st' could be declared final
  • 🟡 pmd:CloseResource L268 Ensure that resources like this ResultSet object are closed after use
  • 🟡 pmd:LocalVariableCouldBeFinal L268 Local variable 'rs' could be declared final
  • 🟡 pmd:CheckResultSet L269 Always check the return of one of the navigation method (next,previous,first,last) of a ResultSet.
  • 🟡 pmd:EmptyCatchBlock L270 Avoid empty catch blocks
  • 🟡 pmd:AvoidCatchingGenericException L270 Avoid catching Exception in try-catch block
  • 🟡 pmd:AtLeastOneConstructor L276 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L277 Missing commented default access modifier on method 'bad()'
  • 🟡 pmd:LocalVariableCouldBeFinal L278 Local variable 'c' could be declared final
  • 🟡 pmd:EmptyControlStatement L279 Empty if statement
  • 🟡 pmd:EnumComparison L279 Enums should be compared using ==
  • 🟡 pmd:CommentDefaultAccessModifier L282 Missing commented default access modifier on nested enum 'Color'
  • 🟡 pmd:AtLeastOneConstructor L286 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L287 Missing commented default access modifier on method 'bad()'
  • 🟡 pmd:LocalVariableCouldBeFinal L288 Local variable 'c' could be declared final
  • 🟡 pmd:ExhaustiveSwitchHasDefault L289 The switch block is exhaustive even without the default case
  • 🟡 pmd:CommentDefaultAccessModifier L295 Missing commented default access modifier on nested enum 'Color'
  • 🟡 pmd:AtLeastOneConstructor L299 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L300 Missing commented default access modifier on method 'bad()'
  • 🟡 pmd:EmptyControlStatement L301 Empty for statement
  • 🟡 pmd:ForLoopVariableCount L301 Too many control variables in the for statement
  • 🟡 pmd:UnusedAssignment L301 The updated value of variable 'j' is never used
  • 🟡 pmd:AtLeastOneConstructor L307 Each class should declare at least one constructor
  • 🟡 pmd:AvoidFieldNameMatchingMethodName L308 Field LOG has the same name as a method
  • 🟡 pmd:CommentDefaultAccessModifier L309 Missing commented default access modifier on method 'log(String)'
  • 🟡 pmd:MethodArgumentCouldBeFinal L309 Parameter 'msg' is not assigned and could be declared final
  • 🟡 pmd:AtLeastOneConstructor L315 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L316 Missing commented default access modifier on method 'bad(String)'
  • 🟡 pmd:MethodArgumentCouldBeFinal L316 Parameter 's' is not assigned and could be declared final
  • 🟡 pmd:EmptyControlStatement L317 Empty if statement
  • 🟡 pmd:LiteralsFirstInComparisons L317 Position literals first in String comparisons
  • 🟡 pmd:AtLeastOneConstructor L323 Each class should declare at least one constructor
  • 🟡 pmd:MissingOverride L324 The method 'toString()' is missing an @Override annotation.
  • 🟡 pmd:OverrideBothEqualsAndHashcode L327 Ensure you override both equals() and hashCode()
  • 🟡 pmd:MissingOverride L327 The method 'equals(Object)' is missing an @Override annotation.
  • 🟡 pmd:AtLeastOneConstructor L331 Each class should declare at least one constructor
  • 🟡 pmd:MissingOverride L332 The method 'toString()' is missing an @Override annotation.
  • 🟡 pmd:AtLeastOneConstructor L336 Each class should declare at least one constructor
  • 🟡 pmd:OverrideBothEqualsAndHashcode L337 Ensure you override both equals() and hashCode()
  • 🟡 pmd:MissingOverride L337 The method 'equals(Object)' is missing an @Override annotation.
  • 🟡 pmd:AtLeastOneConstructor L343 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L344 Missing commented default access modifier on method 'bad()'
  • 🟡 pmd:LocalVariableCouldBeFinal L345 Local variable 'c' could be declared final
  • 🟡 pmd:TooFewBranchesForSwitch L346 A switch with less than three branches is inefficient, use a if statement instead.
  • 🟡 pmd:NonExhaustiveSwitch L346 Switch statements or expressions should be exhaustive, add a default case (or missing enum branches)
  • 🟡 pmd:CommentDefaultAccessModifier L350 Missing commented default access modifier on nested enum 'Color2'
  • 🟡 pmd:AtLeastOneConstructor L354 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L355 Missing commented default access modifier on method 'bad()'
  • 🟡 pmd:ExceptionAsFlowControl L358 Exception thrown at line 357 is caught in this block.
  • 🟡 pmd:PreserveStackTrace L359 Thrown exception does not preserve the stack trace of exception 'e' on all code paths
  • 🟡 pmd:AtLeastOneConstructor L365 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L366 Missing commented default access modifier on field 'i'
  • 🟡 pmd:PrimitiveWrapperInstantiation L366 Do not use new Integer(...), prefer Integer.valueOf(...)
  • 🟡 pmd:UnnecessaryBoxing L366 Unnecessary explicit boxing
  • 🟡 pmd:AtLeastOneConstructor L370 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L371 Missing commented default access modifier on method 'bad()'
  • 🟡 pmd:LocalVariableCouldBeFinal L372 Local variable 'x' could be declared final
  • 🟡 pmd:TooFewBranchesForSwitch L373 A switch with less than three branches is inefficient, use a if statement instead.
  • 🟡 pmd:DefaultLabelNotLastInSwitch L374 The default label should be the last label in a switch statement or expression
  • 🟡 pmd:AtLeastOneConstructor L381 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L382 Missing commented default access modifier on method 'bad(List)'
  • 🟡 pmd:MethodArgumentCouldBeFinal L382 Parameter 'l' is not assigned and could be declared final
  • 🟡 pmd:ForLoopCanBeForeach L383 This for loop can be replaced by a foreach loop
  • 🟡 pmd:AtLeastOneConstructor L390 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L391 Missing commented default access modifier on method 'bad(int)'
  • 🟡 pmd:AtLeastOneConstructor L397 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L398 Missing commented default access modifier on method 'bad()'
  • 🟡 pmd:UnusedLabel L399 Avoid unused labels such as 'label'.
  • 🟡 pmd:AtLeastOneConstructor L407 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L408 Missing commented default access modifier on method 'bad()'
  • 🟡 pmd:UnusedLocalVariable L409 Avoid unused local variables such as 'x'.
  • 🟡 pmd:AtLeastOneConstructor L415 Each class should declare at least one constructor
  • 🟡 pmd:UnusedPrivateField L416 Avoid unused private fields such as 'secret'.
  • 🟡 pmd:PublicMemberInNonPublicType L417 Public member 'm' declared in a non-public type
  • 🟡 pmd:AtLeastOneConstructor L422 Each class should declare at least one constructor
  • 🟡 pmd:UnusedPrivateMethod L423 Avoid unused private methods such as 'helper()'.
  • 🟡 pmd:PublicMemberInNonPublicType L425 Public member 'm' declared in a non-public type
  • 🟡 pmd:AtLeastOneConstructor L430 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L431 Missing commented default access modifier on method 'bad(List)'
  • 🟡 pmd:MethodArgumentCouldBeFinal L431 Parameter 'l' is not assigned and could be declared final
  • 🟡 pmd:EmptyControlStatement L432 Empty if statement
  • 🟡 pmd:UseCollectionIsEmpty L432 Substitute calls to size() == 0 (or size() != 0, size() > 0, size() < 1) with calls to isEmpty()
  • 🟡 pmd:AtLeastOneConstructor L438 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L439 Missing commented default access modifier on method 'bad()'
  • 🟡 pmd:LooseCoupling L440 Avoid using implementation types like 'HashSet'; use the interface instead
  • 🟡 pmd:UnusedLocalVariable L440 Avoid unused local variables such as 'set'.
  • 🟡 pmd:UseEnumCollections L440 This collection could be an EnumSet
  • 🟡 pmd:LooseCoupling L441 Avoid using implementation types like 'HashMap'; use the interface instead
  • 🟡 pmd:UnusedLocalVariable L441 Avoid unused local variables such as 'map'.
  • 🟡 pmd:UseEnumCollections L441 This collection could be an EnumMap
  • 🟡 pmd:CommentDefaultAccessModifier L443 Missing commented default access modifier on nested enum 'Color'
  • 🟡 pmd:AtLeastOneConstructor L457 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L460 Missing commented default access modifier on method 'debug(String, String)'
  • 🟡 pmd:MethodArgumentCouldBeFinal L460 Parameter 'param1' is not assigned and could be declared final
  • 🟡 pmd:MethodArgumentCouldBeFinal L460 Parameter 'param2' is not assigned and could be declared final
  • 🟡 pmd:LabeledStatement L471 Avoid using labeled statements such as 'lbl2'.
  • 🟡 pmd:AvoidLiteralsInIfCondition L472 Avoid using literals such as 3 in if statements
  • 🟡 pmd:UnusedLabel L476 Avoid unused labels such as 'lbl3'.
  • 🟡 pmd:AvoidLiteralsInIfCondition L477 Avoid using literals such as 4 in if statements
  • 🟡 pmd:AtLeastOneConstructor L487 Each class should declare at least one constructor
  • 🟡 pmd:ReplaceEnumerationWithIterator L487 Consider replacing this Enumeration with the newer java.util.Iterator
  • 🟡 pmd:RedundantFieldInitializer L488 Avoid using redundant field initializer for 'i'
  • 🟡 pmd:MissingOverride L490 The method 'hasMoreElements()' is missing an @Override annotation.
  • 🟡 pmd:MissingOverride L494 The method 'nextElement()' is missing an @Override annotation.
  • 🟡 pmd:AssignmentInOperand L495 Avoid assignment to i in operand
  • 🟡 pmd:AtLeastOneConstructor L500 Each class should declare at least one constructor
  • 🟡 pmd:AtLeastOneConstructor L506 Each class should declare at least one constructor
  • 🟡 pmd:UnusedPrivateMethod L507 Avoid unused private methods such as 'bar(String)'.
  • 🟡 pmd:UnusedFormalParameter L507 Avoid unused method parameters such as 'howdy'.
  • 🟡 pmd:AtLeastOneConstructor L513 Each class should declare at least one constructor
  • 🟡 pmd:NonStaticInitializer L514 Non-static initializers are confusing
  • 🟡 pmd:EmptyControlStatement L515 Empty do..while statement
  • 🟡 pmd:WhileLoopWithLiteralBoolean L517 The loop can be simplified.
  • 🟡 pmd:UnnecessaryWarningSuppression L531 Unnecessary PMD suppression comment
  • 🟡 pmd:AtLeastOneConstructor L532 Each class should declare at least one constructor
  • 🟡 pmd:AtLeastOneConstructor L548 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L549 Missing commented default access modifier on method 'm()'
  • 🟡 pmd:AvoidDollarSigns L554 Avoid using dollar signs in variable/method/class/interface names
  • 🟡 pmd:AtLeastOneConstructor L554 Each class should declare at least one constructor
  • 🟡 pmd:AtLeastOneConstructor L558 Each class should declare at least one constructor
  • 🟡 pmd:AvoidProtectedFieldInFinalClass L559 Avoid protected fields in a final class. Change to private or package access.
  • 🟡 pmd:AtLeastOneConstructor L563 Each class should declare at least one constructor
  • 🟡 pmd:AvoidProtectedMethodInFinalClassNotExtending L564 Avoid protected methods in a final class that doesnt extend anything other than Object. Change to private or package access.
  • 🟡 pmd:AtLeastOneConstructor L569 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L570 Missing commented default access modifier on method 'jni()'
  • 🟡 pmd:AtLeastOneConstructor L574 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L575 Missing commented default access modifier on field 'flag'
  • 🟡 pmd:CommentDefaultAccessModifier L576 Missing commented default access modifier on method 'getFlag()'
  • 🟡 pmd:AtLeastOneConstructor L582 Each class should declare at least one constructor
  • 🟡 pmd:AtLeastOneConstructor L586 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L587 Missing commented default access modifier on field 'x'
  • 🟡 pmd:CommentDefaultAccessModifier L588 Missing commented default access modifier on method 'm()'
  • 🟡 pmd:AtLeastOneConstructor L593 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L594 Missing commented default access modifier on method 'bad(boolean)'
  • 🟡 pmd:MethodArgumentCouldBeFinal L594 Parameter 'a' is not assigned and could be declared final
  • 🟡 pmd:ConfusingTernary L595 Avoid if (x != y) ..; else ..;
  • 🟡 pmd:SimplifyBooleanReturns L595 This if statement can be replaced by return {condition};
  • 🟡 pmd:OnlyOneReturn L596 A method should have only one exit point, and that should be the last statement in the method
  • 🟡 pmd:AtLeastOneConstructor L604 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L605 Missing commented default access modifier on method 'bad(boolean)'
  • 🟡 pmd:MethodArgumentCouldBeFinal L605 Parameter 'a' is not assigned and could be declared final
  • 🟡 pmd:ControlStatementBraces L607 This statement should have braces
  • 🟡 pmd:AtLeastOneConstructor L612 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L613 Missing commented default access modifier on method 'bad(int)'
  • 🟡 pmd:MethodArgumentCouldBeFinal L613 Parameter 'x' is not assigned and could be declared final
  • 🟡 pmd:EmptyControlStatement L614 Empty if statement
  • 🟡 pmd:AtLeastOneConstructor L620 Each class should declare at least one constructor
  • 🟡 pmd:AbstractClassWithoutAbstractMethod L620 This abstract class does not have any abstract methods
  • 🟡 pmd:CommentDefaultAccessModifier L621 Missing commented default access modifier on method 'empty()'
  • 🟡 pmd:AtLeastOneConstructor L626 Each class should declare at least one constructor
  • 🟡 pmd:AtLeastOneConstructor L630 Each class should declare at least one constructor
  • 🟡 pmd:UnusedPrivateField L631 Avoid unused private fields such as 'late'.
  • 🟡 pmd:CommentDefaultAccessModifier L632 Missing commented default access modifier on method 'method()'
  • 🟡 pmd:AtLeastOneConstructor L637 Each class should declare at least one constructor
  • 🟡 pmd:UnusedPrivateField L638 Avoid unused private fields such as 'bad_name'.
  • 🟡 pmd:AtLeastOneConstructor L642 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L643 Missing commented default access modifier on method 'doIt(int)'
  • 🟡 pmd:AtLeastOneConstructor L647 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L648 Missing commented default access modifier on method 'bad()'
  • 🟡 pmd:ForLoopShouldBeWhileLoop L650 This for loop could be simplified to a while loop
  • 🟡 pmd:AtLeastOneConstructor L657 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L658 Missing commented default access modifier on method 'bad(int)'
  • 🟡 pmd:AtLeastOneConstructor L663 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L664 Missing commented default access modifier on method 'bad()'
  • 🟡 pmd:UnusedLocalVariable L666 Avoid unused local variables such as 'x'.
  • 🟡 pmd:IdenticalCatchBranches L669 'catch' branch identical to 'ArithmeticException' branch
  • 🟡 pmd:AvoidCatchingGenericException L669 Avoid catching Exception in try-catch block
  • 🟡 pmd:AtLeastOneConstructor L676 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L677 Missing commented default access modifier on method 'bad()'
  • 🟡 pmd:UnusedLocalVariable L678 Avoid unused local variables such as 'f'.
  • 🟡 pmd:LambdaCanBeMethodReference L678 Lambda expression could be written as a method reference: String::length
  • 🟡 pmd:AtLeastOneConstructor L683 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L684 Missing commented default access modifier on method 'isReady(String)'
  • 🟡 pmd:MethodArgumentCouldBeFinal L684 Parameter 's' is not assigned and could be declared final
  • 🟡 pmd:AtLeastOneConstructor L690 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L691 Missing commented default access modifier on method 'bad()'
  • 🟡 pmd:LocalVariableCouldBeFinal L692 Local variable 'x' could be declared final
  • 🟡 pmd:AtLeastOneConstructor L698 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L699 Missing commented default access modifier on method 'bad()'
  • 🟡 pmd:LocalVariableCouldBeFinal L700 Local variable 'bad_var' could be declared final
  • 🟡 pmd:AtLeastOneConstructor L706 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L707 Missing commented default access modifier on method 'bad(int)'
  • 🟡 pmd:MethodArgumentCouldBeFinal L707 Parameter 'x' is not assigned and could be declared final
  • 🟡 pmd:AtLeastOneConstructor L713 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L714 Missing commented default access modifier on method 'BadMethod()'
  • 🟡 pmd:AtLeastOneConstructor L719 Each class should declare at least one constructor
  • 🟡 pmd:PublicMemberInNonPublicType L720 Public member 'm' declared in a non-public type
  • 🟡 pmd:UnusedPrivateField L722 Avoid unused private fields such as 'x'.
  • 🟡 pmd:FieldDeclarationsShouldBeAtStartOfClass L722 Fields should be declared at the top of the class, before any method declarations, constructors, initializers or inner classes.
  • 🟡 pmd:FinalFieldCouldBeStatic L722 The final field x could be made static
  • 🟡 pmd:AtLeastOneConstructor L726 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L727 Missing commented default access modifier on method 'bad(int)'
  • 🟡 pmd:MethodArgumentCouldBeFinal L727 Parameter 'x' is not assigned and could be declared final
  • 🟡 pmd:OnlyOneReturn L729 A method should have only one exit point, and that should be the last statement in the method
  • 🟡 pmd:AtLeastOneConstructor L736 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L737 Missing commented default access modifier on method 'bad()'
  • 🟡 pmd:LocalVariableCouldBeFinal L738 Local variable 'x' could be declared final
  • 🟡 pmd:AtLeastOneConstructor L746 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L747 Missing commented default access modifier on method 'm()'
  • 🟡 pmd:AtLeastOneConstructor L753 Each class should declare at least one constructor
  • 🟡 pmd:AtLeastOneConstructor L757 Each class should declare at least one constructor
  • 🟡 pmd:UnnecessaryAnnotationValueElement L758 Avoid the use of value in annotations when its the only element
  • 🟡 pmd:CommentDefaultAccessModifier L759 Missing commented default access modifier on method 'm()'
  • 🟡 pmd:AtLeastOneConstructor L764 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L765 Missing commented default access modifier on method 'm()'
  • 🟡 pmd:UnnecessaryBlock L766 This block isn't necessary.
  • 🟡 pmd:UnusedLocalVariable L767 Avoid unused local variables such as 'x'.
  • 🟡 pmd:AtLeastOneConstructor L773 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L774 Missing commented default access modifier on method 'm()'
  • 🟡 pmd:UnusedLocalVariable L775 Avoid unused local variables such as 'i'.
  • 🟡 pmd:PrimitiveWrapperInstantiation L775 Do not use new Integer(...), prefer Integer.valueOf(...)
  • 🟡 pmd:UnnecessaryBoxing L775 Unnecessary explicit boxing
  • 🟡 pmd:AtLeastOneConstructor L780 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L781 Missing commented default access modifier on method 'm()'
  • 🟡 pmd:LocalVariableCouldBeFinal L782 Local variable 'o' could be declared final
  • 🟡 pmd:UnusedLocalVariable L783 Avoid unused local variables such as 's'.
  • 🟡 pmd:UnnecessaryConstructor L789 Avoid unnecessary constructors - the compiler will generate these for you
  • 🟡 pmd:CommentDefaultAccessModifier L789 Missing commented default access modifier on constructor 'UnNeedCons()'
  • 🟡 pmd:AtLeastOneConstructor L794 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L795 Missing commented default access modifier on method 'm()'
  • 🟡 pmd:UnusedLocalVariable L796 Avoid unused local variables such as 's'.
  • 🟡 pmd:UnnecessaryModifier L806 Unnecessary modifiers 'public abstract' on method 'm': the method is declared in an interface type
  • 🟡 pmd:AtLeastOneConstructor L810 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L811 Missing commented default access modifier on method 'm()'
  • 🟡 pmd:UnnecessaryReturn L813 Unnecessary return statement
  • 🟡 pmd:AtLeastOneConstructor L818 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L819 Missing commented default access modifier on method 'm()'
  • 🟡 pmd:LocalVariableCouldBeFinal L820 Local variable 'x' could be declared final
  • 🟡 pmd:UnnecessarySemicolon L820 Unnecessary semicolon
  • 🟡 pmd:AtLeastOneConstructor L826 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L827 Missing commented default access modifier on field 'l'
  • 🟡 pmd:UseDiamondOperator L827 Explicit type arguments can be replaced by a diamond: new ArrayList<>()
  • 🟡 pmd:AtLeastOneConstructor L831 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L832 Missing commented default access modifier on method 'm()'
  • 🟡 pmd:LocalVariableCouldBeFinal L833 Local variable 'x' could be declared final
  • 🟡 pmd:UseExplicitTypes L833 Use Explicit Types
  • 🟡 pmd:AtLeastOneConstructor L839 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L840 Missing commented default access modifier on method 'm()'
  • 🟡 pmd:LocalVariableCouldBeFinal L841 Local variable 'x' could be declared final
  • 🟡 pmd:AtLeastOneConstructor L847 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L848 Missing commented default access modifier on field 'x'
  • 🟡 pmd:CommentDefaultAccessModifier L849 Missing commented default access modifier on method 'm()'
  • 🟡 pmd:LocalVariableCouldBeFinal L850 Local variable 'y' could be declared final
  • 🟡 pmd:AtLeastOneConstructor L856 Each class should declare at least one constructor
  • 🟡 pmd:UseShortArrayInitializer L857 Array initialization can be written shorter
  • 🟡 pmd:CommentDefaultAccessModifier L857 Missing commented default access modifier on field 'a'
  • 🟡 pmd:AtLeastOneConstructor L861 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L862 Missing commented default access modifier on field 'x'
  • 🟡 pmd:UseUnderscoresInNumericLiterals L862 Number 1000000 should separate every third digit with an underscore
  • 🟡 pmd:AtLeastOneConstructor L866 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L867 Missing commented default access modifier on method 'm()'
  • 🟡 pmd:LocalVariableCouldBeFinal L868 Local variable 'len' could be declared final
  • 🟡 pmd:AtLeastOneConstructor L874 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L875 Missing commented default access modifier on method 'm()'
  • 🟡 pmd:LocalVariableCouldBeFinal L876 Local variable 'x' could be declared final
  • 🟡 pmd:UnnecessaryConstructor L898 Avoid unnecessary constructors - the compiler will generate these for you
  • 🟡 pmd:CommentDefaultAccessModifier L898 Missing commented default access modifier on constructor 'ParentFix()'
  • 🟡 pmd:UnnecessaryConstructor L902 Avoid unnecessary constructors - the compiler will generate these for you
  • 🟡 pmd:CommentDefaultAccessModifier L902 Missing commented default access modifier on constructor 'ChildFix()'
  • 🟡 pmd:AtLeastOneConstructor L908 Each class should declare at least one constructor
  • 🟡 pmd:PublicMemberInNonPublicType L909 Public member 'getLength' declared in a non-public type
  • 🟡 pmd:MethodArgumentCouldBeFinal L909 Parameter 'strings' is not assigned and could be declared final
  • 🟡 pmd:PrematureDeclaration L910 Declaration of 'length' can be moved closer to its usages
  • 🟡 pmd:OnlyOneReturn L912 A method should have only one exit point, and that should be the last statement in the method
  • 🟡 pmd:LocalVariableCouldBeFinal L914 Local variable 'str' could be declared final
  • 🟡 pmd:AtLeastOneConstructor L922 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L923 Missing commented default access modifier on method 'm()'
  • 🟡 pmd:UnusedAssignment L924 The initializer for variable 'o' is never used (overwritten on line 925)
  • 🟡 pmd:UnnecessaryCast L925 Unnecessary cast (Object)
  • 🟡 pmd:AtLeastOneConstructor L935 Each class should declare at least one constructor
  • 🟡 pmd:AtLeastOneConstructor L939 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L940 Missing commented default access modifier on field 'otherFoo'
  • 🟡 pmd:UselessQualifiedThis L940 Useless qualified this usage in the same class.
  • 🟡 pmd:CommentDefaultAccessModifier L941 Missing commented default access modifier on method 'doSomething()'
  • 🟡 pmd:UselessQualifiedThis L942 Useless qualified this usage in the same class.
  • 🟡 pmd:AtLeastOneConstructor L948 Each class should declare at least one constructor
  • 🟡 pmd:PublicMemberInNonPublicType L949 Public member 'lengthSum' declared in a non-public type
  • 🟡 pmd:MethodArgumentCouldBeFinal L949 Parameter 'strings' is not assigned and could be declared final
  • 🟡 pmd:LocalVariableCouldBeFinal L955 Local variable 'str' could be declared final
  • 🟡 pmd:AtLeastOneConstructor L963 Each class should declare at least one constructor
  • 🟡 pmd:PublicMemberInNonPublicType L964 Public member 'compute' declared in a non-public type
  • 🟡 pmd:AtLeastOneConstructor L968 Each class should declare at least one constructor
  • 🟡 pmd:CommentDefaultAccessModifier L969 Missing commented default access modifier on field 'count'
  • 🟡 pmd:CommentDefaultAccessModifier L971 Missing commented default access modifier on method 'isEnabled()'
  • 🟡 pmd:CommentDefaultAccessModifier L975 Missing commented default access modifier on method 'getCount()'
  • 🟡 pmd:CommentDefaultAccessModifier L979 Missing commented default access modifier on method 'computeSomething()'
  • 🟡 pmd:AtLeastOneConstructor L995 Each class should declare at least one constructor
  • 🟡 pmd:LinguisticNaming L996 Linguistics Antipattern - The field 'isReady' indicates linguistically it is a boolean, but it is 'int'
  • 🟡 pmd:CommentDefaultAccessModifier L996 Missing commented default access modifier on field 'isReady'
  • 🟡 pmd:LinguisticNaming L998 Linguistics Antipattern - The method 'isValid' indicates linguistically it returns a boolean, but it returns 'int'
  • 🟡 pmd:CommentDefaultAccessModifier L998 Missing commented default access modifier on method 'isValid()'
  • 🟡 pmd:AtLeastOneConstructor L1004 Each class should declare at least one constructor
  • 🟡 pmd:PublicMemberInNonPublicType L1005 Public member 'invalid' declared in a non-public type
  • 🟡 pmd:UnnecessaryConstructor L1012 Avoid unnecessary constructors - the compiler will generate these for you
  • 🟡 pmd:CommentDefaultAccessModifier L1012 Missing commented default access modifier on constructor 'ParentRemain()'
  • 🟡 pmd:UnnecessaryConstructor L1016 Avoid unnecessary constructors - the compiler will generate these for you
  • 🟡 pmd:CallSuperInConstructor L1016 It is a good practice to call super() in a constructor
  • 🟡 pmd:CommentDefaultAccessModifier L1016 Missing commented default access modifier on constructor 'ChildRemain()'
  • 🟡 pmd:AtLeastOneConstructor L1022 Each class should declare at least one constructor
  • 🟡 pmd:PublicMemberInNonPublicType L1023 Public member 'lengthSum' declared in a non-public type
  • 🟡 pmd:MethodArgumentCouldBeFinal L1023 Parameter 'strings' is not assigned and could be declared final
  • 🟡 pmd:VariableDeclarationUsageDistance L1024 Distance between declaration of 'length' and its first usage is 11, current threshold is 7
  • 🟡 pmd:LocalVariableCouldBeFinal L1035 Local variable 'str' could be declared final
  • 🔵 pmd:UnnecessaryImport L14 Unused import 'java.nio.charset.StandardCharsets'
  • 🔵 pmd:UnnecessaryImport L17 Unused import 'java.util.Date'
  • 🔵 pmd:UnnecessaryImport L22 Unused import 'java.util.Iterator'
  • 🔵 pmd:UnnecessaryImport L30 Unused static import 'java.lang.Math.min'
  • 🔵 pmd:UnnecessaryImport L31 Unused static import 'java.lang.Math.abs'
  • 🔵 pmd:UnnecessaryImport L32 Unused static import 'java.lang.Math.sqrt'
  • 🔵 pmd:UnnecessaryImport L33 Unused static import 'java.lang.Math.pow'
  • 🔵 pmd:UnnecessaryImport L34 Unused static import 'java.lang.Math.floor'
  • 🔵 pmd:UnnecessaryImport L35 Unused static import 'java.lang.Math.ceil'
  • 🔵 pmd:UnnecessaryImport L36 Unused static import 'java.lang.Math.round'
  • 🔵 pmd:UnnecessaryImport L37 Unused static import 'java.lang.Math.random'
  • 🔵 pmd:UnnecessaryImport L38 Unused static import 'java.lang.Math.sin'
  • 🔵 pmd:UnnecessaryImport L39 Unused static import 'java.lang.Math.cos'
  • 🔵 pmd:UnnecessaryImport L40 Unused static import 'java.lang.Math.tan'
  • 🔵 pmd:UseVarargs L59 Consider using varargs for methods or constructors which take an array the last parameter.
  • 🔵 pmd:UseVarargs L187 Consider using varargs for methods or constructors which take an array the last parameter.
  • 🔵 pmd:OneDeclarationPerLine L206 Use one line for each declaration, it enhances code readability.
  • 🔵 pmd:UnnecessaryFullyQualifiedName L487 Unnecessary qualifier 'java.util': 'Enumeration' is already in scope because it is imported in this file
  • 🔵 pmd:BooleanGetMethodName L576 A getX() method which returns a boolean or Boolean should be named isX()
  • 🔵 pmd:ExtendsObject L626 No need to explicitly extend Object.
  • 🔵 pmd:TypeParameterNamingConventions L753 The type parameter name 'bad' doesn't match '[A-Z]'
  • 🔵 pmd:UnnecessaryFullyQualifiedName L796 Unnecessary qualifier 'java.lang': 'String' is already in scope because it is declared in java.lang
  • 🔵 pmd:UnnecessaryFullyQualifiedName L796 Unnecessary qualifier 'java.lang': 'String' is already in scope because it is declared in java.lang
  • 🔵 pmd:UselessParentheses L841 Useless parentheses around 1 + 2.
  • 🔵 pmd:UseVarargs L909 Consider using varargs for methods or constructors which take an array the last parameter.
  • 🔵 pmd:UnnecessaryInterfaceDeclaration L935 Unnecessary interface declaration 'com.demo.bpcs.IBase', already provided by 'com.demo.bpcs.IExt'.
  • 🔵 pmd:UseVarargs L949 Consider using varargs for methods or constructors which take an array the last parameter.
  • 🔵 pmd:UseVarargs L1023 Consider using varargs for methods or constructors which take an array the last parameter.

AI 审查 · 7 条建议

  • 🔴 [AI] [bug] null-statement-dereference L268 RsDemo 中 Statement 为 null 却直接调用 executeQuery,必然触发 NullPointerException L267 将 Statement 变量 st 初始化为 nullL268 立即调用 st.executeQuery("select 1"),在没有任何赋值的情况下必然抛出 NullPointerException。静态分析只报告了资源未关闭和 ResultSet 返回值未检查,但未识别这个必然的空指针。 建议: 先通过 Connection.createStatement() 正确初始化 Statement,或在调用前判空并处理;也可直接使用 try-with-resources 管理 Statement 与 ResultSet。
  • 🟡 [AI] [bug] incomplete-object-initialization L71 Hasher 构造函数吞掉 MessageDigest 初始化异常,对象处于不一致状态 Hasher 构造函数在 catch(Exception) 中仅记录日志,MessageDigest.getInstance("SHA-256") 失败时 digest 保持为 null。对象仍会被创建并返回给调用方,后续任何使用 digest 的操作都会触发 NullPointerException。应 fail-fast,让对象在构造失败时不可用。 建议: 将 digest 声明为 final,构造函数改为初始化失败时抛出 IllegalStateException(携带原始异常),或使用静态初始化块并在失败时抛出 ExceptionInInitializerError。
  • 🟡 [AI] [security] hardcoded-ip-address L93 NetConfig 中硬编码了 IP 地址,存在安全风险 L93 的 host 字段硬编码了内网 IP "192.168.1.1"。硬编码 IP 会使代码难以在不同环境部署,且易被攻击者直接定位内网地址;若该值被提交到源码仓库,可能成为信息泄露点。静态分析结果未包含 AvoidUsingHardCodedIP 规则。 建议: 将主机地址改为从配置、环境变量或系统属性读取,并在启动时校验格式。
  • 🟡 [AI] [bug] resource-leak-on-construction-failure L176 链式构造缓冲读取器时,若中间构造失败将泄漏底层 FileInputStream L176 使用 new BufferedReader(new InputStreamReader(new FileInputStream("h.txt"))) 链式构造资源。若 InputStreamReader 或 BufferedReader 的构造函数抛出异常,已经成功打开的 FileInputStream 不会被关闭,因为此时还没有引用指向它。静态分析报告了 CloseResource 和 UseTryWithResources,但未指出链式构造本身是泄漏点。 建议: 使用 Files.newBufferedReader(Paths.get("h.txt"), StandardCharsets.UTF_8) 一步创建,或先用独立变量创建 FileInputStream 并放入 try-with-resources。
  • 🟡 [AI] [bug] infinite-iteration L490 EnumerationImpl 的 hasMoreElements() 永远返回 true,造成无限迭代 EnumerationImpl 的 hasMoreElements() 恒为 true,而 nextElement() 每次使 i 自增并返回新字符串,导致枚举序列无限增长,最终 i 会溢出为负数。此外类声明使用了裸类型 java.util.Enumeration,未指定泛型参数,存在类型安全隐患。 建议: 为 hasMoreElements() 设置明确的终止条件(如 i < 10),并为 Enumeration 指定泛型参数(如 Enumeration),同时让 nextElement() 返回 String 类型。
  • 🔵 [AI] [style] redundant-local-variable L868 InlineVar 中局部变量 len 仅使用一次,可直接内联 L868 声明的 int len = 5 只在 L869 使用一次,没有复用价值,属于冗余局部变量,增加阅读负担。静态分析未对 InlineVar 报告 VariableCanBeInlined。 建议: 删除 len 变量,直接将字面量 5 传给 System.out.println。
  • 🔵 [AI] [design] misleading-getter L975 getCount() 返回 computeSomething() 而非 count 字段,getter 语义误导 L975 的 getCount() 方法名为获取 count 字段的 getter,实际却返回 computeSomething() 的计算结果(42)。调用方会误以为获取的是对象状态 count,但实际拿到的与字段无关,容易引入逻辑错误。静态分析仅报告了 L996/L998 的 LinguisticNaming,未覆盖此方法。 建议: 让 getCount() 返回 count 字段,或将方法重命名为 computeCount()/getComputedValue() 以准确表达语义。