53 KiB
53 KiB
代码审查报告
文件: data\demo-pmd\src\com\demo\bpcs\BestPracticesCodeStyle.java
语言: java
耗时: 290.6s
分析工具: pmd
总计: 524 | 错误: 78 | 警告: 416 | 建议: 30
静态分析 · 517 个问题
- 🔴
pmd:SystemPrintlnL51 Usage of System.out/err - 🔴
pmd:ImplicitFunctionalInterfaceL109 Annotate this interface with @FunctionalInterface or with @SuppressWarnings("PMD.ImplicitFunctionalInterface") to clarify your intent. - 🔴
pmd:AvoidFileStreamL130 Avoid instantiating FileInputStream, FileOutputStream, FileReader, or FileWriter - 🔴
pmd:SystemPrintlnL158 Usage of System.out/err - 🔴
pmd:SystemPrintlnL159 Usage of System.out/err - 🔴
pmd:AvoidFileStreamL166 Avoid instantiating FileInputStream, FileOutputStream, FileReader, or FileWriter - 🔴
pmd:AvoidFileStreamL176 Avoid instantiating FileInputStream, FileOutputStream, FileReader, or FileWriter - 🔴
pmd:AvoidThrowingRawExceptionTypesL240 Avoid throwing raw exception type RuntimeException. - 🔴
pmd:AvoidReassigningParametersL259 Avoid reassigning parameters such as 'x' - 🔴
pmd:AvoidThrowingRawExceptionTypesL359 Avoid throwing raw exception type RuntimeException. - 🔴
pmd:SystemPrintlnL384 Usage of System.out/err - 🔴
pmd:SystemPrintlnL392 Usage of System.out/err - 🔴
pmd:SystemPrintlnL401 Usage of System.out/err - 🔴
pmd:SystemPrintlnL410 Usage of System.out/err - 🔴
pmd:SystemPrintlnL448 Usage of System.out/err - 🔴
pmd:FieldNamingConventionsL458 The constant name 'log' doesn't match '[A-Z][A-Z_0-9]*' - 🔴
pmd:GuardLogStatementL461 Logger calls should be surrounded by log level guards. - 🔴
pmd:SystemPrintlnL480 Usage of System.out/err - 🔴
pmd:SystemPrintlnL508 Usage of System.out/err - 🔴
pmd:SystemPrintlnL523 Usage of System.out/err - 🔴
pmd:SystemPrintlnL539 Usage of System.out/err - 🔴
pmd:ClassNamingConventionsL554 The class name 'Bad$Name' doesn't match '[A-Z][a-zA-Z0-9]*' - 🔴
pmd:ClassNamingConventionsL582 The class name 'badClassName' doesn't match '[A-Z][a-zA-Z0-9]*' - 🔴
pmd:SystemPrintlnL607 Usage of System.out/err - 🔴
pmd:EmptyMethodInAbstractClassShouldBeAbstractL621 An empty method in an abstract class should be abstract instead - 🔴
pmd:FieldNamingConventionsL638 The field name 'bad_name' doesn't match '[a-z][a-zA-Z0-9]*' - 🔴
pmd:FinalParameterInAbstractMethodL643 Final parameter in abstract method - 🔴
pmd:FormalParameterNamingConventionsL658 The method parameter name 'bad_param' doesn't match '[a-z][a-zA-Z0-9]*' - 🔴
pmd:SystemPrintlnL668 Usage of System.out/err - 🔴
pmd:SystemPrintlnL670 Usage of System.out/err - 🔴
pmd:SystemPrintlnL693 Usage of System.out/err - 🔴
pmd:LocalVariableNamingConventionsL700 The local variable name 'bad_var' doesn't match '[a-z][a-zA-Z0-9]*' - 🔴
pmd:SystemPrintlnL701 Usage of System.out/err - 🔴
pmd:SystemPrintlnL708 Usage of System.out/err - 🔴
pmd:MethodNamingConventionsL714 The instance method name 'BadMethod' doesn't match '[a-z][a-zA-Z0-9]*' - 🔴
pmd:ModifierOrderL720 Missorted modifiersstatic public. - 🔴
pmd:ModifierOrderL722 Missorted modifiersfinal private. - 🔴
pmd:SystemPrintlnL739 Usage of System.out/err - 🔴
pmd:SystemPrintlnL740 Usage of System.out/err - 🔴
pmd:SystemPrintlnL741 Usage of System.out/err - 🔴
pmd:StringInstantiationL796 Avoid instantiating String objects; this is usually unnecessary. - 🔴
pmd:ImplicitFunctionalInterfaceL805 Annotate this interface with @FunctionalInterface or with @SuppressWarnings("PMD.ImplicitFunctionalInterface") to clarify your intent. - 🔴
pmd:SystemPrintlnL812 Usage of System.out/err - 🔴
pmd:SystemPrintlnL821 Usage of System.out/err - 🔴
pmd:SystemPrintlnL834 Usage of System.out/err - 🔴
pmd:SystemPrintlnL842 Usage of System.out/err - 🔴
pmd:SystemPrintlnL851 Usage of System.out/err - 🔴
pmd:SystemPrintlnL869 Usage of System.out/err - 🔴
pmd:SystemPrintlnL877 Usage of System.out/err - 🔴
pmd:SystemPrintlnL878 Usage of System.out/err - 🔴
pmd:SystemPrintlnL879 Usage of System.out/err - 🔴
pmd:SystemPrintlnL880 Usage of System.out/err - 🔴
pmd:SystemPrintlnL881 Usage of System.out/err - 🔴
pmd:SystemPrintlnL882 Usage of System.out/err - 🔴
pmd:SystemPrintlnL888 Usage of System.out/err - 🔴
pmd:SystemPrintlnL926 Usage of System.out/err - 🔴
pmd:SystemPrintlnL943 Usage of System.out/err - 🔴
pmd:SystemPrintlnL951 Usage of System.out/err - 🔴
pmd:SystemPrintlnL952 Usage of System.out/err - 🔴
pmd:SystemPrintlnL953 Usage of System.out/err - 🔴
pmd:SystemPrintlnL954 Usage of System.out/err - 🔴
pmd:SystemPrintlnL958 Usage of System.out/err - 🔴
pmd:SystemPrintlnL986 Usage of System.out/err - 🔴
pmd:AvoidUsingNativeCodeL1006 The use of native code is not recommended. - 🔴
pmd:SystemPrintlnL1025 Usage of System.out/err - 🔴
pmd:SystemPrintlnL1026 Usage of System.out/err - 🔴
pmd:SystemPrintlnL1027 Usage of System.out/err - 🔴
pmd:SystemPrintlnL1028 Usage of System.out/err - 🔴
pmd:SystemPrintlnL1029 Usage of System.out/err - 🔴
pmd:SystemPrintlnL1030 Usage of System.out/err - 🔴
pmd:SystemPrintlnL1031 Usage of System.out/err - 🔴
pmd:SystemPrintlnL1032 Usage of System.out/err - 🔴
pmd:SystemPrintlnL1033 Usage of System.out/err - 🔴
pmd:SystemPrintlnL1034 Usage of System.out/err - 🔴
pmd:SystemPrintlnL1038 Usage of System.out/err - 🔴
pmd:SystemPrintlnL1044 Usage of System.out/err - 🔴
pmd:SystemPrintlnL1053 Usage of System.out/err - 🟡
pmd:TooManyStaticImportsL29 Too many static imports may lead to messy code - 🟡
pmd:AtLeastOneConstructorL48 Each class should declare at least one constructor - 🟡
pmd:AbstractClassWithoutAbstractMethodL48 This abstract class does not have any abstract methods - 🟡
pmd:PublicMemberInNonPublicTypeL50 Public member 'start' declared in a non-public type - 🟡
pmd:CommentDefaultAccessModifierL59 Missing commented default access modifier on constructor 'DataProcessor(String[])' - 🟡
pmd:MethodArgumentCouldBeFinalL59 Parameter 'input' is not assigned and could be declared final - 🟡
pmd:ArrayIsStoredDirectlyL60 The user-supplied array 'input' is stored directly. - 🟡
pmd:PublicMemberInNonPublicTypeL63 Public member 'getItems' declared in a non-public type - 🟡
pmd:MethodReturnsInternalArrayL64 Returning 'items' may expose an internal array. - 🟡
pmd:AvoidMessageDigestFieldL71 You shouldnt declare field of MessageDigest type, because unsynchronized access could cause problems - 🟡
pmd:UnusedPrivateFieldL71 Avoid unused private fields such as 'digest'. - 🟡
pmd:CommentDefaultAccessModifierL73 Missing commented default access modifier on constructor 'Hasher()' - 🟡
pmd:AvoidCatchingGenericExceptionL76 Avoid catching Exception in try-catch block - 🟡
pmd:AtLeastOneConstructorL83 Each class should declare at least one constructor - 🟡
pmd:AvoidStringBufferFieldL84 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:ImmutableFieldL84 Field 'sb' may be declared final - 🟡
pmd:CommentDefaultAccessModifierL86 Missing commented default access modifier on method 'add(String)' - 🟡
pmd:MethodArgumentCouldBeFinalL86 Parameter 's' is not assigned and could be declared final - 🟡
pmd:AtLeastOneConstructorL92 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL93 Missing commented default access modifier on field 'host' - 🟡
pmd:ConstantsInInterfaceL98 Using constants in interfaces is a bad practice. - 🟡
pmd:AtLeastOneConstructorL102 Each class should declare at least one constructor - 🟡
pmd:UseConcurrentHashMapL103 If you run in Java5 or newer and have concurrent access, you should use the ConcurrentHashMap implementation - 🟡
pmd:CommentDefaultAccessModifierL103 Missing commented default access modifier on field 'map' - 🟡
pmd:UseDiamondOperatorL103 Explicit type arguments can be replaced by a diamond:new HashMap<>() - 🟡
pmd:DoubleBraceInitializationL103 Double-brace initialization should be avoided - 🟡
pmd:AtLeastOneConstructorL114 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL115 Missing commented default access modifier on method 'outer()' - 🟡
pmd:AvoidLiteralsInIfConditionL119 Avoid using literals such as 2 in if statements - 🟡
pmd:AtLeastOneConstructorL128 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL129 Missing commented default access modifier on method 'read()' - 🟡
pmd:CloseResourceL130 Ensure that resources like this FileInputStream object are closed after use - 🟡
pmd:LocalVariableCouldBeFinalL130 Local variable 'fis' could be declared final - 🟡
pmd:CloseResourceL131 Ensure that resources like this InputStreamReader object are closed after use - 🟡
pmd:LocalVariableCouldBeFinalL131 Local variable 'isr' could be declared final - 🟡
pmd:RelianceOnDefaultCharsetL131 Specify a character set instead of relying on the default charset - 🟡
pmd:CloseResourceL132 Ensure that resources like this BufferedReader object are closed after use - 🟡
pmd:LocalVariableCouldBeFinalL132 Local variable 'br' could be declared final - 🟡
pmd:AtLeastOneConstructorL138 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL139 Missing commented default access modifier on method 'list()' - 🟡
pmd:LooseCouplingL140 Avoid using implementation types like 'Hashtable'; use the interface instead - 🟡
pmd:ReplaceHashtableWithMapL140 Consider replacing this Hashtable with the newer java.util.Map - 🟡
pmd:LocalVariableCouldBeFinalL140 Local variable 'h' could be declared final - 🟡
pmd:ReplaceHashtableWithMapL140 Consider replacing this Hashtable with the newer java.util.Map - 🟡
pmd:UnusedLocalVariableL141 Avoid unused local variables such as 'e'. - 🟡
pmd:AtLeastOneConstructorL146 Each class should declare at least one constructor - 🟡
pmd:LooseCouplingL147 Avoid using implementation types like 'Hashtable'; use the interface instead - 🟡
pmd:ReplaceHashtableWithMapL147 Consider replacing this Hashtable with the newer java.util.Map - 🟡
pmd:CommentDefaultAccessModifierL147 Missing commented default access modifier on field 'table' - 🟡
pmd:ReplaceHashtableWithMapL147 Consider replacing this Hashtable with the newer java.util.Map - 🟡
pmd:AtLeastOneConstructorL151 Each class should declare at least one constructor - 🟡
pmd:LooseCouplingL152 Avoid using implementation types like 'Vector'; use the interface instead - 🟡
pmd:ReplaceVectorWithListL152 Consider replacing this Vector with the newer java.util.List - 🟡
pmd:CommentDefaultAccessModifierL152 Missing commented default access modifier on field 'v' - 🟡
pmd:ReplaceVectorWithListL152 Consider replacing this Vector with the newer java.util.List - 🟡
pmd:UseArrayListInsteadOfVectorL152 Use ArrayList instead of Vector - 🟡
pmd:AtLeastOneConstructorL156 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL157 Missing commented default access modifier on method 'log()' - 🟡
pmd:AtLeastOneConstructorL164 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL165 Missing commented default access modifier on method 'doIt()' - 🟡
pmd:CloseResourceL166 Ensure that resources like this FileInputStream object are closed after use - 🟡
pmd:LocalVariableCouldBeFinalL166 Local variable 'fis' could be declared final - 🟡
pmd:CloseResourceL167 Ensure that resources like this InputStreamReader object are closed after use - 🟡
pmd:LocalVariableCouldBeFinalL167 Local variable 'isr' could be declared final - 🟡
pmd:UseStandardCharsetsL167 Please use StandardCharsets constants - 🟡
pmd:CloseResourceL168 Ensure that resources like this BufferedReader object are closed after use - 🟡
pmd:LocalVariableCouldBeFinalL168 Local variable 'br' could be declared final - 🟡
pmd:AtLeastOneConstructorL174 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL175 Missing commented default access modifier on method 'read()' - 🟡
pmd:LocalVariableCouldBeFinalL176 Local variable 'br' could be declared final - 🟡
pmd:RelianceOnDefaultCharsetL176 Specify a character set instead of relying on the default charset - 🟡
pmd:UseTryWithResourcesL177 Consider using a try-with-resources statement instead of explicitly closing the resource - 🟡
pmd:AtLeastOneConstructorL186 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL187 Missing commented default access modifier on method 'accept(String[])' - 🟡
pmd:AtLeastOneConstructorL193 Each class should declare at least one constructor - 🟡
pmd:RedundantFieldInitializerL194 Avoid using redundant field initializer for 'i' - 🟡
pmd:CommentDefaultAccessModifierL194 Missing commented default access modifier on field 'i' - 🟡
pmd:CommentDefaultAccessModifierL195 Missing commented default access modifier on method 'loop()' - 🟡
pmd:AssignmentInOperandL197 Avoid assignment to i in operand - 🟡
pmd:AvoidLiteralsInIfConditionL197 Avoid using literals such as 5 in if statements - 🟡
pmd:AtLeastOneConstructorL205 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL206 Missing commented default access modifier on field 'a' - 🟡
pmd:AtLeastOneConstructorL210 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL211 Missing commented default access modifier on method 'call()' - 🟡
pmd:UnnecessaryVarargsArrayCreationL212 Unnecessary explicit array creation for varargs method call - 🟡
pmd:CommentDefaultAccessModifierL214 Missing commented default access modifier on method 'accept2(String[])' - 🟡
pmd:AtLeastOneConstructorL220 Each class should declare at least one constructor - 🟡
pmd:PublicMemberInNonPublicTypeL221 Public member 'm' declared in a non-public type - 🟡
pmd:AtLeastOneConstructorL226 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL227 Missing commented default access modifier on method 'bad()' - 🟡
pmd:UnusedLocalVariableL229 Avoid unused local variables such as 'x'. - 🟡
pmd:AvoidPrintStackTraceL231 Avoid printStackTrace(); use a logger call instead. - 🟡
pmd:AtLeastOneConstructorL237 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL238 Missing commented default access modifier on method 'bad()' - 🟡
pmd:ExceptionAsFlowControlL241 Exception thrown at line 240 is caught in this block. - 🟡
pmd:AvoidCatchingGenericExceptionL241 Avoid catching RuntimeException in try-catch block - 🟡
pmd:UnusedAssignmentL241 The initial value of exception parameter 'e' is never used (overwritten on line 242) - 🟡
pmd:AvoidReassigningCatchVariablesL242 Avoid reassigning caught exception 'e' - 🟡
pmd:UnusedAssignmentL242 The value assigned to variable 'e' is never used - 🟡
pmd:AtLeastOneConstructorL248 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL249 Missing commented default access modifier on method 'bad()' - 🟡
pmd:AvoidReassigningLoopVariablesL251 Avoid reassigning the loop control variable 'i' - 🟡
pmd:AtLeastOneConstructorL257 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL258 Missing commented default access modifier on method 'bad(int)' - 🟡
pmd:UnusedAssignmentL258 The initial value of parameter 'x' is never used (overwritten on line 259) - 🟡
pmd:UnusedAssignmentL259 The value assigned to variable 'x' is never used - 🟡
pmd:AtLeastOneConstructorL264 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL265 Missing commented default access modifier on method 'bad()' - 🟡
pmd:CloseResourceL267 Ensure that resources like this Statement object are closed after use - 🟡
pmd:LocalVariableCouldBeFinalL267 Local variable 'st' could be declared final - 🟡
pmd:CloseResourceL268 Ensure that resources like this ResultSet object are closed after use - 🟡
pmd:LocalVariableCouldBeFinalL268 Local variable 'rs' could be declared final - 🟡
pmd:CheckResultSetL269 Always check the return of one of the navigation method (next,previous,first,last) of a ResultSet. - 🟡
pmd:EmptyCatchBlockL270 Avoid empty catch blocks - 🟡
pmd:AvoidCatchingGenericExceptionL270 Avoid catching Exception in try-catch block - 🟡
pmd:AtLeastOneConstructorL276 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL277 Missing commented default access modifier on method 'bad()' - 🟡
pmd:LocalVariableCouldBeFinalL278 Local variable 'c' could be declared final - 🟡
pmd:EmptyControlStatementL279 Empty if statement - 🟡
pmd:EnumComparisonL279 Enums should be compared using == - 🟡
pmd:CommentDefaultAccessModifierL282 Missing commented default access modifier on nested enum 'Color' - 🟡
pmd:AtLeastOneConstructorL286 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL287 Missing commented default access modifier on method 'bad()' - 🟡
pmd:LocalVariableCouldBeFinalL288 Local variable 'c' could be declared final - 🟡
pmd:ExhaustiveSwitchHasDefaultL289 The switch block is exhaustive even without the default case - 🟡
pmd:CommentDefaultAccessModifierL295 Missing commented default access modifier on nested enum 'Color' - 🟡
pmd:AtLeastOneConstructorL299 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL300 Missing commented default access modifier on method 'bad()' - 🟡
pmd:EmptyControlStatementL301 Empty for statement - 🟡
pmd:ForLoopVariableCountL301 Too many control variables in the for statement - 🟡
pmd:UnusedAssignmentL301 The updated value of variable 'j' is never used - 🟡
pmd:AtLeastOneConstructorL307 Each class should declare at least one constructor - 🟡
pmd:AvoidFieldNameMatchingMethodNameL308 Field LOG has the same name as a method - 🟡
pmd:CommentDefaultAccessModifierL309 Missing commented default access modifier on method 'log(String)' - 🟡
pmd:MethodArgumentCouldBeFinalL309 Parameter 'msg' is not assigned and could be declared final - 🟡
pmd:AtLeastOneConstructorL315 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL316 Missing commented default access modifier on method 'bad(String)' - 🟡
pmd:MethodArgumentCouldBeFinalL316 Parameter 's' is not assigned and could be declared final - 🟡
pmd:EmptyControlStatementL317 Empty if statement - 🟡
pmd:LiteralsFirstInComparisonsL317 Position literals first in String comparisons - 🟡
pmd:AtLeastOneConstructorL323 Each class should declare at least one constructor - 🟡
pmd:MissingOverrideL324 The method 'toString()' is missing an @Override annotation. - 🟡
pmd:OverrideBothEqualsAndHashcodeL327 Ensure you override both equals() and hashCode() - 🟡
pmd:MissingOverrideL327 The method 'equals(Object)' is missing an @Override annotation. - 🟡
pmd:AtLeastOneConstructorL331 Each class should declare at least one constructor - 🟡
pmd:MissingOverrideL332 The method 'toString()' is missing an @Override annotation. - 🟡
pmd:AtLeastOneConstructorL336 Each class should declare at least one constructor - 🟡
pmd:OverrideBothEqualsAndHashcodeL337 Ensure you override both equals() and hashCode() - 🟡
pmd:MissingOverrideL337 The method 'equals(Object)' is missing an @Override annotation. - 🟡
pmd:AtLeastOneConstructorL343 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL344 Missing commented default access modifier on method 'bad()' - 🟡
pmd:LocalVariableCouldBeFinalL345 Local variable 'c' could be declared final - 🟡
pmd:TooFewBranchesForSwitchL346 A switch with less than three branches is inefficient, use a if statement instead. - 🟡
pmd:NonExhaustiveSwitchL346 Switch statements or expressions should be exhaustive, add a default case (or missing enum branches) - 🟡
pmd:CommentDefaultAccessModifierL350 Missing commented default access modifier on nested enum 'Color2' - 🟡
pmd:AtLeastOneConstructorL354 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL355 Missing commented default access modifier on method 'bad()' - 🟡
pmd:ExceptionAsFlowControlL358 Exception thrown at line 357 is caught in this block. - 🟡
pmd:PreserveStackTraceL359 Thrown exception does not preserve the stack trace of exception 'e' on all code paths - 🟡
pmd:AtLeastOneConstructorL365 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL366 Missing commented default access modifier on field 'i' - 🟡
pmd:PrimitiveWrapperInstantiationL366 Do not usenew Integer(...), preferInteger.valueOf(...) - 🟡
pmd:UnnecessaryBoxingL366 Unnecessary explicit boxing - 🟡
pmd:AtLeastOneConstructorL370 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL371 Missing commented default access modifier on method 'bad()' - 🟡
pmd:LocalVariableCouldBeFinalL372 Local variable 'x' could be declared final - 🟡
pmd:TooFewBranchesForSwitchL373 A switch with less than three branches is inefficient, use a if statement instead. - 🟡
pmd:DefaultLabelNotLastInSwitchL374 The default label should be the last label in a switch statement or expression - 🟡
pmd:AtLeastOneConstructorL381 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL382 Missing commented default access modifier on method 'bad(List)' - 🟡
pmd:MethodArgumentCouldBeFinalL382 Parameter 'l' is not assigned and could be declared final - 🟡
pmd:ForLoopCanBeForeachL383 This for loop can be replaced by a foreach loop - 🟡
pmd:AtLeastOneConstructorL390 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL391 Missing commented default access modifier on method 'bad(int)' - 🟡
pmd:AtLeastOneConstructorL397 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL398 Missing commented default access modifier on method 'bad()' - 🟡
pmd:UnusedLabelL399 Avoid unused labels such as 'label'. - 🟡
pmd:AtLeastOneConstructorL407 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL408 Missing commented default access modifier on method 'bad()' - 🟡
pmd:UnusedLocalVariableL409 Avoid unused local variables such as 'x'. - 🟡
pmd:AtLeastOneConstructorL415 Each class should declare at least one constructor - 🟡
pmd:UnusedPrivateFieldL416 Avoid unused private fields such as 'secret'. - 🟡
pmd:PublicMemberInNonPublicTypeL417 Public member 'm' declared in a non-public type - 🟡
pmd:AtLeastOneConstructorL422 Each class should declare at least one constructor - 🟡
pmd:UnusedPrivateMethodL423 Avoid unused private methods such as 'helper()'. - 🟡
pmd:PublicMemberInNonPublicTypeL425 Public member 'm' declared in a non-public type - 🟡
pmd:AtLeastOneConstructorL430 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL431 Missing commented default access modifier on method 'bad(List)' - 🟡
pmd:MethodArgumentCouldBeFinalL431 Parameter 'l' is not assigned and could be declared final - 🟡
pmd:EmptyControlStatementL432 Empty if statement - 🟡
pmd:UseCollectionIsEmptyL432 Substitute calls to size() == 0 (or size() != 0, size() > 0, size() < 1) with calls to isEmpty() - 🟡
pmd:AtLeastOneConstructorL438 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL439 Missing commented default access modifier on method 'bad()' - 🟡
pmd:LooseCouplingL440 Avoid using implementation types like 'HashSet'; use the interface instead - 🟡
pmd:UnusedLocalVariableL440 Avoid unused local variables such as 'set'. - 🟡
pmd:UseEnumCollectionsL440 This collection could be an EnumSet - 🟡
pmd:LooseCouplingL441 Avoid using implementation types like 'HashMap'; use the interface instead - 🟡
pmd:UnusedLocalVariableL441 Avoid unused local variables such as 'map'. - 🟡
pmd:UseEnumCollectionsL441 This collection could be an EnumMap - 🟡
pmd:CommentDefaultAccessModifierL443 Missing commented default access modifier on nested enum 'Color' - 🟡
pmd:AtLeastOneConstructorL457 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL460 Missing commented default access modifier on method 'debug(String, String)' - 🟡
pmd:MethodArgumentCouldBeFinalL460 Parameter 'param1' is not assigned and could be declared final - 🟡
pmd:MethodArgumentCouldBeFinalL460 Parameter 'param2' is not assigned and could be declared final - 🟡
pmd:LabeledStatementL471 Avoid using labeled statements such as 'lbl2'. - 🟡
pmd:AvoidLiteralsInIfConditionL472 Avoid using literals such as 3 in if statements - 🟡
pmd:UnusedLabelL476 Avoid unused labels such as 'lbl3'. - 🟡
pmd:AvoidLiteralsInIfConditionL477 Avoid using literals such as 4 in if statements - 🟡
pmd:AtLeastOneConstructorL487 Each class should declare at least one constructor - 🟡
pmd:ReplaceEnumerationWithIteratorL487 Consider replacing this Enumeration with the newer java.util.Iterator - 🟡
pmd:RedundantFieldInitializerL488 Avoid using redundant field initializer for 'i' - 🟡
pmd:MissingOverrideL490 The method 'hasMoreElements()' is missing an @Override annotation. - 🟡
pmd:MissingOverrideL494 The method 'nextElement()' is missing an @Override annotation. - 🟡
pmd:AssignmentInOperandL495 Avoid assignment to i in operand - 🟡
pmd:AtLeastOneConstructorL500 Each class should declare at least one constructor - 🟡
pmd:AtLeastOneConstructorL506 Each class should declare at least one constructor - 🟡
pmd:UnusedPrivateMethodL507 Avoid unused private methods such as 'bar(String)'. - 🟡
pmd:UnusedFormalParameterL507 Avoid unused method parameters such as 'howdy'. - 🟡
pmd:AtLeastOneConstructorL513 Each class should declare at least one constructor - 🟡
pmd:NonStaticInitializerL514 Non-static initializers are confusing - 🟡
pmd:EmptyControlStatementL515 Empty do..while statement - 🟡
pmd:WhileLoopWithLiteralBooleanL517 The loop can be simplified. - 🟡
pmd:UnnecessaryWarningSuppressionL531 Unnecessary PMD suppression comment - 🟡
pmd:AtLeastOneConstructorL532 Each class should declare at least one constructor - 🟡
pmd:AtLeastOneConstructorL548 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL549 Missing commented default access modifier on method 'm()' - 🟡
pmd:AvoidDollarSignsL554 Avoid using dollar signs in variable/method/class/interface names - 🟡
pmd:AtLeastOneConstructorL554 Each class should declare at least one constructor - 🟡
pmd:AtLeastOneConstructorL558 Each class should declare at least one constructor - 🟡
pmd:AvoidProtectedFieldInFinalClassL559 Avoid protected fields in a final class. Change to private or package access. - 🟡
pmd:AtLeastOneConstructorL563 Each class should declare at least one constructor - 🟡
pmd:AvoidProtectedMethodInFinalClassNotExtendingL564 Avoid protected methods in a final class that doesnt extend anything other than Object. Change to private or package access. - 🟡
pmd:AtLeastOneConstructorL569 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL570 Missing commented default access modifier on method 'jni()' - 🟡
pmd:AtLeastOneConstructorL574 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL575 Missing commented default access modifier on field 'flag' - 🟡
pmd:CommentDefaultAccessModifierL576 Missing commented default access modifier on method 'getFlag()' - 🟡
pmd:AtLeastOneConstructorL582 Each class should declare at least one constructor - 🟡
pmd:AtLeastOneConstructorL586 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL587 Missing commented default access modifier on field 'x' - 🟡
pmd:CommentDefaultAccessModifierL588 Missing commented default access modifier on method 'm()' - 🟡
pmd:AtLeastOneConstructorL593 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL594 Missing commented default access modifier on method 'bad(boolean)' - 🟡
pmd:MethodArgumentCouldBeFinalL594 Parameter 'a' is not assigned and could be declared final - 🟡
pmd:ConfusingTernaryL595 Avoid if (x != y) ..; else ..; - 🟡
pmd:SimplifyBooleanReturnsL595 This if statement can be replaced byreturn {condition}; - 🟡
pmd:OnlyOneReturnL596 A method should have only one exit point, and that should be the last statement in the method - 🟡
pmd:AtLeastOneConstructorL604 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL605 Missing commented default access modifier on method 'bad(boolean)' - 🟡
pmd:MethodArgumentCouldBeFinalL605 Parameter 'a' is not assigned and could be declared final - 🟡
pmd:ControlStatementBracesL607 This statement should have braces - 🟡
pmd:AtLeastOneConstructorL612 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL613 Missing commented default access modifier on method 'bad(int)' - 🟡
pmd:MethodArgumentCouldBeFinalL613 Parameter 'x' is not assigned and could be declared final - 🟡
pmd:EmptyControlStatementL614 Empty if statement - 🟡
pmd:AtLeastOneConstructorL620 Each class should declare at least one constructor - 🟡
pmd:AbstractClassWithoutAbstractMethodL620 This abstract class does not have any abstract methods - 🟡
pmd:CommentDefaultAccessModifierL621 Missing commented default access modifier on method 'empty()' - 🟡
pmd:AtLeastOneConstructorL626 Each class should declare at least one constructor - 🟡
pmd:AtLeastOneConstructorL630 Each class should declare at least one constructor - 🟡
pmd:UnusedPrivateFieldL631 Avoid unused private fields such as 'late'. - 🟡
pmd:CommentDefaultAccessModifierL632 Missing commented default access modifier on method 'method()' - 🟡
pmd:AtLeastOneConstructorL637 Each class should declare at least one constructor - 🟡
pmd:UnusedPrivateFieldL638 Avoid unused private fields such as 'bad_name'. - 🟡
pmd:AtLeastOneConstructorL642 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL643 Missing commented default access modifier on method 'doIt(int)' - 🟡
pmd:AtLeastOneConstructorL647 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL648 Missing commented default access modifier on method 'bad()' - 🟡
pmd:ForLoopShouldBeWhileLoopL650 This for loop could be simplified to a while loop - 🟡
pmd:AtLeastOneConstructorL657 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL658 Missing commented default access modifier on method 'bad(int)' - 🟡
pmd:AtLeastOneConstructorL663 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL664 Missing commented default access modifier on method 'bad()' - 🟡
pmd:UnusedLocalVariableL666 Avoid unused local variables such as 'x'. - 🟡
pmd:IdenticalCatchBranchesL669 'catch' branch identical to 'ArithmeticException' branch - 🟡
pmd:AvoidCatchingGenericExceptionL669 Avoid catching Exception in try-catch block - 🟡
pmd:AtLeastOneConstructorL676 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL677 Missing commented default access modifier on method 'bad()' - 🟡
pmd:UnusedLocalVariableL678 Avoid unused local variables such as 'f'. - 🟡
pmd:LambdaCanBeMethodReferenceL678 Lambda expression could be written as a method reference:String::length - 🟡
pmd:AtLeastOneConstructorL683 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL684 Missing commented default access modifier on method 'isReady(String)' - 🟡
pmd:MethodArgumentCouldBeFinalL684 Parameter 's' is not assigned and could be declared final - 🟡
pmd:AtLeastOneConstructorL690 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL691 Missing commented default access modifier on method 'bad()' - 🟡
pmd:LocalVariableCouldBeFinalL692 Local variable 'x' could be declared final - 🟡
pmd:AtLeastOneConstructorL698 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL699 Missing commented default access modifier on method 'bad()' - 🟡
pmd:LocalVariableCouldBeFinalL700 Local variable 'bad_var' could be declared final - 🟡
pmd:AtLeastOneConstructorL706 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL707 Missing commented default access modifier on method 'bad(int)' - 🟡
pmd:MethodArgumentCouldBeFinalL707 Parameter 'x' is not assigned and could be declared final - 🟡
pmd:AtLeastOneConstructorL713 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL714 Missing commented default access modifier on method 'BadMethod()' - 🟡
pmd:AtLeastOneConstructorL719 Each class should declare at least one constructor - 🟡
pmd:PublicMemberInNonPublicTypeL720 Public member 'm' declared in a non-public type - 🟡
pmd:UnusedPrivateFieldL722 Avoid unused private fields such as 'x'. - 🟡
pmd:FieldDeclarationsShouldBeAtStartOfClassL722 Fields should be declared at the top of the class, before any method declarations, constructors, initializers or inner classes. - 🟡
pmd:FinalFieldCouldBeStaticL722 The final field x could be made static - 🟡
pmd:AtLeastOneConstructorL726 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL727 Missing commented default access modifier on method 'bad(int)' - 🟡
pmd:MethodArgumentCouldBeFinalL727 Parameter 'x' is not assigned and could be declared final - 🟡
pmd:OnlyOneReturnL729 A method should have only one exit point, and that should be the last statement in the method - 🟡
pmd:AtLeastOneConstructorL736 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL737 Missing commented default access modifier on method 'bad()' - 🟡
pmd:LocalVariableCouldBeFinalL738 Local variable 'x' could be declared final - 🟡
pmd:AtLeastOneConstructorL746 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL747 Missing commented default access modifier on method 'm()' - 🟡
pmd:AtLeastOneConstructorL753 Each class should declare at least one constructor - 🟡
pmd:AtLeastOneConstructorL757 Each class should declare at least one constructor - 🟡
pmd:UnnecessaryAnnotationValueElementL758 Avoid the use of value in annotations when its the only element - 🟡
pmd:CommentDefaultAccessModifierL759 Missing commented default access modifier on method 'm()' - 🟡
pmd:AtLeastOneConstructorL764 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL765 Missing commented default access modifier on method 'm()' - 🟡
pmd:UnnecessaryBlockL766 This block isn't necessary. - 🟡
pmd:UnusedLocalVariableL767 Avoid unused local variables such as 'x'. - 🟡
pmd:AtLeastOneConstructorL773 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL774 Missing commented default access modifier on method 'm()' - 🟡
pmd:UnusedLocalVariableL775 Avoid unused local variables such as 'i'. - 🟡
pmd:PrimitiveWrapperInstantiationL775 Do not usenew Integer(...), preferInteger.valueOf(...) - 🟡
pmd:UnnecessaryBoxingL775 Unnecessary explicit boxing - 🟡
pmd:AtLeastOneConstructorL780 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL781 Missing commented default access modifier on method 'm()' - 🟡
pmd:LocalVariableCouldBeFinalL782 Local variable 'o' could be declared final - 🟡
pmd:UnusedLocalVariableL783 Avoid unused local variables such as 's'. - 🟡
pmd:UnnecessaryConstructorL789 Avoid unnecessary constructors - the compiler will generate these for you - 🟡
pmd:CommentDefaultAccessModifierL789 Missing commented default access modifier on constructor 'UnNeedCons()' - 🟡
pmd:AtLeastOneConstructorL794 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL795 Missing commented default access modifier on method 'm()' - 🟡
pmd:UnusedLocalVariableL796 Avoid unused local variables such as 's'. - 🟡
pmd:UnnecessaryModifierL806 Unnecessary modifiers 'public abstract' on method 'm': the method is declared in an interface type - 🟡
pmd:AtLeastOneConstructorL810 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL811 Missing commented default access modifier on method 'm()' - 🟡
pmd:UnnecessaryReturnL813 Unnecessary return statement - 🟡
pmd:AtLeastOneConstructorL818 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL819 Missing commented default access modifier on method 'm()' - 🟡
pmd:LocalVariableCouldBeFinalL820 Local variable 'x' could be declared final - 🟡
pmd:UnnecessarySemicolonL820 Unnecessary semicolon - 🟡
pmd:AtLeastOneConstructorL826 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL827 Missing commented default access modifier on field 'l' - 🟡
pmd:UseDiamondOperatorL827 Explicit type arguments can be replaced by a diamond:new ArrayList<>() - 🟡
pmd:AtLeastOneConstructorL831 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL832 Missing commented default access modifier on method 'm()' - 🟡
pmd:LocalVariableCouldBeFinalL833 Local variable 'x' could be declared final - 🟡
pmd:UseExplicitTypesL833 Use Explicit Types - 🟡
pmd:AtLeastOneConstructorL839 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL840 Missing commented default access modifier on method 'm()' - 🟡
pmd:LocalVariableCouldBeFinalL841 Local variable 'x' could be declared final - 🟡
pmd:AtLeastOneConstructorL847 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL848 Missing commented default access modifier on field 'x' - 🟡
pmd:CommentDefaultAccessModifierL849 Missing commented default access modifier on method 'm()' - 🟡
pmd:LocalVariableCouldBeFinalL850 Local variable 'y' could be declared final - 🟡
pmd:AtLeastOneConstructorL856 Each class should declare at least one constructor - 🟡
pmd:UseShortArrayInitializerL857 Array initialization can be written shorter - 🟡
pmd:CommentDefaultAccessModifierL857 Missing commented default access modifier on field 'a' - 🟡
pmd:AtLeastOneConstructorL861 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL862 Missing commented default access modifier on field 'x' - 🟡
pmd:UseUnderscoresInNumericLiteralsL862 Number 1000000 should separate every third digit with an underscore - 🟡
pmd:AtLeastOneConstructorL866 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL867 Missing commented default access modifier on method 'm()' - 🟡
pmd:LocalVariableCouldBeFinalL868 Local variable 'len' could be declared final - 🟡
pmd:AtLeastOneConstructorL874 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL875 Missing commented default access modifier on method 'm()' - 🟡
pmd:LocalVariableCouldBeFinalL876 Local variable 'x' could be declared final - 🟡
pmd:UnnecessaryConstructorL898 Avoid unnecessary constructors - the compiler will generate these for you - 🟡
pmd:CommentDefaultAccessModifierL898 Missing commented default access modifier on constructor 'ParentFix()' - 🟡
pmd:UnnecessaryConstructorL902 Avoid unnecessary constructors - the compiler will generate these for you - 🟡
pmd:CommentDefaultAccessModifierL902 Missing commented default access modifier on constructor 'ChildFix()' - 🟡
pmd:AtLeastOneConstructorL908 Each class should declare at least one constructor - 🟡
pmd:PublicMemberInNonPublicTypeL909 Public member 'getLength' declared in a non-public type - 🟡
pmd:MethodArgumentCouldBeFinalL909 Parameter 'strings' is not assigned and could be declared final - 🟡
pmd:PrematureDeclarationL910 Declaration of 'length' can be moved closer to its usages - 🟡
pmd:OnlyOneReturnL912 A method should have only one exit point, and that should be the last statement in the method - 🟡
pmd:LocalVariableCouldBeFinalL914 Local variable 'str' could be declared final - 🟡
pmd:AtLeastOneConstructorL922 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL923 Missing commented default access modifier on method 'm()' - 🟡
pmd:UnusedAssignmentL924 The initializer for variable 'o' is never used (overwritten on line 925) - 🟡
pmd:UnnecessaryCastL925 Unnecessary cast (Object) - 🟡
pmd:AtLeastOneConstructorL935 Each class should declare at least one constructor - 🟡
pmd:AtLeastOneConstructorL939 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL940 Missing commented default access modifier on field 'otherFoo' - 🟡
pmd:UselessQualifiedThisL940 Useless qualified this usage in the same class. - 🟡
pmd:CommentDefaultAccessModifierL941 Missing commented default access modifier on method 'doSomething()' - 🟡
pmd:UselessQualifiedThisL942 Useless qualified this usage in the same class. - 🟡
pmd:AtLeastOneConstructorL948 Each class should declare at least one constructor - 🟡
pmd:PublicMemberInNonPublicTypeL949 Public member 'lengthSum' declared in a non-public type - 🟡
pmd:MethodArgumentCouldBeFinalL949 Parameter 'strings' is not assigned and could be declared final - 🟡
pmd:LocalVariableCouldBeFinalL955 Local variable 'str' could be declared final - 🟡
pmd:AtLeastOneConstructorL963 Each class should declare at least one constructor - 🟡
pmd:PublicMemberInNonPublicTypeL964 Public member 'compute' declared in a non-public type - 🟡
pmd:AtLeastOneConstructorL968 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL969 Missing commented default access modifier on field 'count' - 🟡
pmd:CommentDefaultAccessModifierL971 Missing commented default access modifier on method 'isEnabled()' - 🟡
pmd:CommentDefaultAccessModifierL975 Missing commented default access modifier on method 'getCount()' - 🟡
pmd:CommentDefaultAccessModifierL979 Missing commented default access modifier on method 'computeSomething()' - 🟡
pmd:AtLeastOneConstructorL995 Each class should declare at least one constructor - 🟡
pmd:LinguisticNamingL996 Linguistics Antipattern - The field 'isReady' indicates linguistically it is a boolean, but it is 'int' - 🟡
pmd:CommentDefaultAccessModifierL996 Missing commented default access modifier on field 'isReady' - 🟡
pmd:LinguisticNamingL998 Linguistics Antipattern - The method 'isValid' indicates linguistically it returns a boolean, but it returns 'int' - 🟡
pmd:CommentDefaultAccessModifierL998 Missing commented default access modifier on method 'isValid()' - 🟡
pmd:AtLeastOneConstructorL1004 Each class should declare at least one constructor - 🟡
pmd:PublicMemberInNonPublicTypeL1005 Public member 'invalid' declared in a non-public type - 🟡
pmd:UnnecessaryConstructorL1012 Avoid unnecessary constructors - the compiler will generate these for you - 🟡
pmd:CommentDefaultAccessModifierL1012 Missing commented default access modifier on constructor 'ParentRemain()' - 🟡
pmd:UnnecessaryConstructorL1016 Avoid unnecessary constructors - the compiler will generate these for you - 🟡
pmd:CallSuperInConstructorL1016 It is a good practice to call super() in a constructor - 🟡
pmd:CommentDefaultAccessModifierL1016 Missing commented default access modifier on constructor 'ChildRemain()' - 🟡
pmd:AtLeastOneConstructorL1022 Each class should declare at least one constructor - 🟡
pmd:PublicMemberInNonPublicTypeL1023 Public member 'lengthSum' declared in a non-public type - 🟡
pmd:MethodArgumentCouldBeFinalL1023 Parameter 'strings' is not assigned and could be declared final - 🟡
pmd:VariableDeclarationUsageDistanceL1024 Distance between declaration of 'length' and its first usage is 11, current threshold is 7 - 🟡
pmd:LocalVariableCouldBeFinalL1035 Local variable 'str' could be declared final - 🔵
pmd:UnnecessaryImportL14 Unused import 'java.nio.charset.StandardCharsets' - 🔵
pmd:UnnecessaryImportL17 Unused import 'java.util.Date' - 🔵
pmd:UnnecessaryImportL22 Unused import 'java.util.Iterator' - 🔵
pmd:UnnecessaryImportL30 Unused static import 'java.lang.Math.min' - 🔵
pmd:UnnecessaryImportL31 Unused static import 'java.lang.Math.abs' - 🔵
pmd:UnnecessaryImportL32 Unused static import 'java.lang.Math.sqrt' - 🔵
pmd:UnnecessaryImportL33 Unused static import 'java.lang.Math.pow' - 🔵
pmd:UnnecessaryImportL34 Unused static import 'java.lang.Math.floor' - 🔵
pmd:UnnecessaryImportL35 Unused static import 'java.lang.Math.ceil' - 🔵
pmd:UnnecessaryImportL36 Unused static import 'java.lang.Math.round' - 🔵
pmd:UnnecessaryImportL37 Unused static import 'java.lang.Math.random' - 🔵
pmd:UnnecessaryImportL38 Unused static import 'java.lang.Math.sin' - 🔵
pmd:UnnecessaryImportL39 Unused static import 'java.lang.Math.cos' - 🔵
pmd:UnnecessaryImportL40 Unused static import 'java.lang.Math.tan' - 🔵
pmd:UseVarargsL59 Consider using varargs for methods or constructors which take an array the last parameter. - 🔵
pmd:UseVarargsL187 Consider using varargs for methods or constructors which take an array the last parameter. - 🔵
pmd:OneDeclarationPerLineL206 Use one line for each declaration, it enhances code readability. - 🔵
pmd:UnnecessaryFullyQualifiedNameL487 Unnecessary qualifier 'java.util': 'Enumeration' is already in scope because it is imported in this file - 🔵
pmd:BooleanGetMethodNameL576 A getX() method which returns a boolean or Boolean should be named isX() - 🔵
pmd:ExtendsObjectL626 No need to explicitly extend Object. - 🔵
pmd:TypeParameterNamingConventionsL753 The type parameter name 'bad' doesn't match '[A-Z]' - 🔵
pmd:UnnecessaryFullyQualifiedNameL796 Unnecessary qualifier 'java.lang': 'String' is already in scope because it is declared in java.lang - 🔵
pmd:UnnecessaryFullyQualifiedNameL796 Unnecessary qualifier 'java.lang': 'String' is already in scope because it is declared in java.lang - 🔵
pmd:UselessParenthesesL841 Useless parentheses around1 + 2. - 🔵
pmd:UseVarargsL909 Consider using varargs for methods or constructors which take an array the last parameter. - 🔵
pmd:UnnecessaryInterfaceDeclarationL935 Unnecessary interface declaration 'com.demo.bpcs.IBase', already provided by 'com.demo.bpcs.IExt'. - 🔵
pmd:UseVarargsL949 Consider using varargs for methods or constructors which take an array the last parameter. - 🔵
pmd:UseVarargsL1023 Consider using varargs for methods or constructors which take an array the last parameter.
AI 审查 · 7 条建议
- 🔴 [AI] [bug]
null-statement-dereferenceL268 RsDemo 中 Statement 为 null 却直接调用 executeQuery,必然触发 NullPointerException L267 将 Statement 变量 st 初始化为 null,L268 立即调用 st.executeQuery("select 1"),在没有任何赋值的情况下必然抛出 NullPointerException。静态分析只报告了资源未关闭和 ResultSet 返回值未检查,但未识别这个必然的空指针。 建议: 先通过 Connection.createStatement() 正确初始化 Statement,或在调用前判空并处理;也可直接使用 try-with-resources 管理 Statement 与 ResultSet。 - 🟡 [AI] [bug]
incomplete-object-initializationL71 Hasher 构造函数吞掉 MessageDigest 初始化异常,对象处于不一致状态 Hasher 构造函数在 catch(Exception) 中仅记录日志,MessageDigest.getInstance("SHA-256") 失败时 digest 保持为 null。对象仍会被创建并返回给调用方,后续任何使用 digest 的操作都会触发 NullPointerException。应 fail-fast,让对象在构造失败时不可用。 建议: 将 digest 声明为 final,构造函数改为初始化失败时抛出 IllegalStateException(携带原始异常),或使用静态初始化块并在失败时抛出 ExceptionInInitializerError。 - 🟡 [AI] [security]
hardcoded-ip-addressL93 NetConfig 中硬编码了 IP 地址,存在安全风险 L93 的 host 字段硬编码了内网 IP "192.168.1.1"。硬编码 IP 会使代码难以在不同环境部署,且易被攻击者直接定位内网地址;若该值被提交到源码仓库,可能成为信息泄露点。静态分析结果未包含 AvoidUsingHardCodedIP 规则。 建议: 将主机地址改为从配置、环境变量或系统属性读取,并在启动时校验格式。 - 🟡 [AI] [bug]
resource-leak-on-construction-failureL176 链式构造缓冲读取器时,若中间构造失败将泄漏底层 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-iterationL490 EnumerationImpl 的 hasMoreElements() 永远返回 true,造成无限迭代 EnumerationImpl 的 hasMoreElements() 恒为 true,而 nextElement() 每次使 i 自增并返回新字符串,导致枚举序列无限增长,最终 i 会溢出为负数。此外类声明使用了裸类型 java.util.Enumeration,未指定泛型参数,存在类型安全隐患。 建议: 为 hasMoreElements() 设置明确的终止条件(如 i < 10),并为 Enumeration 指定泛型参数(如 Enumeration),同时让 nextElement() 返回 String 类型。 - 🔵 [AI] [style]
redundant-local-variableL868 InlineVar 中局部变量 len 仅使用一次,可直接内联 L868 声明的 int len = 5 只在 L869 使用一次,没有复用价值,属于冗余局部变量,增加阅读负担。静态分析未对 InlineVar 报告 VariableCanBeInlined。 建议: 删除 len 变量,直接将字面量 5 传给 System.out.println。 - 🔵 [AI] [design]
misleading-getterL975 getCount() 返回 computeSomething() 而非 count 字段,getter 语义误导 L975 的 getCount() 方法名为获取 count 字段的 getter,实际却返回 computeSomething() 的计算结果(42)。调用方会误以为获取的是对象状态 count,但实际拿到的与字段无关,容易引入逻辑错误。静态分析仅报告了 L996/L998 的 LinguisticNaming,未覆盖此方法。 建议: 让 getCount() 返回 count 字段,或将方法重命名为 computeCount()/getComputedValue() 以准确表达语义。