Skip to content

add migration cleanup from junit 4 to junit 5 #645

add migration cleanup from junit 4 to junit 5

add migration cleanup from junit 4 to junit 5 #645

Triggered via pull request November 1, 2024 12:39
Status Success
Total duration 46s
Artifacts 1

pmd.yml

on: pull_request
pmd-code-scan
36s
pmd-code-scan
Fit to window
Zoom out
Zoom in

Annotations

20 errors and 10 warnings
Return an empty collection rather than null.: sandbox_cleanup_application/src/org/sandbox/jdt/core/cleanupapp/CodeCleanupApplication.java#L273
For any method that returns an collection (such as an array, Collection or Map), it is better to return an empty one rather than a null reference. This removes the need for null checking all results and avoids inadvertent NullPointerExceptions. See Effective Java, 3rd Edition, Item 54: Return empty collections or arrays instead of null ReturnEmptyCollectionRatherThanNull (Priority: 1, Ruleset: Error Prone) https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_errorprone.html#returnemptycollectionratherthannull
Return an empty collection rather than null.: sandbox_cleanup_application/src/org/sandbox/jdt/core/cleanupapp/CodeCleanupApplication.java#L281
For any method that returns an collection (such as an array, Collection or Map), it is better to return an empty one rather than a null reference. This removes the need for null checking all results and avoids inadvertent NullPointerExceptions. See Effective Java, 3rd Edition, Item 54: Return empty collections or arrays instead of null ReturnEmptyCollectionRatherThanNull (Priority: 1, Ruleset: Error Prone) https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_errorprone.html#returnemptycollectionratherthannull
Return an empty collection rather than null.: sandbox_cleanup_application/src/org/sandbox/jdt/core/cleanupapp/CodeCleanupApplication.java#L285
For any method that returns an collection (such as an array, Collection or Map), it is better to return an empty one rather than a null reference. This removes the need for null checking all results and avoids inadvertent NullPointerExceptions. See Effective Java, 3rd Edition, Item 54: Return empty collections or arrays instead of null ReturnEmptyCollectionRatherThanNull (Priority: 1, Ruleset: Error Prone) https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_errorprone.html#returnemptycollectionratherthannull
Return an empty collection rather than null.: sandbox_cleanup_application/src/org/sandbox/jdt/core/cleanupapp/CodeCleanupApplication.java#L323
For any method that returns an collection (such as an array, Collection or Map), it is better to return an empty one rather than a null reference. This removes the need for null checking all results and avoids inadvertent NullPointerExceptions. See Effective Java, 3rd Edition, Item 54: Return empty collections or arrays instead of null ReturnEmptyCollectionRatherThanNull (Priority: 1, Ruleset: Error Prone) https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_errorprone.html#returnemptycollectionratherthannull
The method parameter name 'callee_end' doesn't match '[a-z][a-zA-Z0-9]*': sandbox_common/src/org/sandbox/jdt/internal/common/ASTProcessor.java#L54
Configurable naming conventions for formal parameters of methods and lambdas. This rule reports formal parameters which do not match the regex that applies to their specific kind (e.g. lambda parameter, or final formal parameter). Each regex can be configured through properties. By default this rule uses the standard Java naming convention (Camel case). FormalParameterNamingConventions (Priority: 1, Ruleset: Code Style) https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_codestyle.html#formalparameternamingconventions
The final local variable name 'explicit_encoding' doesn't match '[a-z][a-zA-Z0-9]*': sandbox_encoding_quickfix/src/org/sandbox/jdt/internal/ui/preferences/cleanup/SandboxCodeTabPage.java#L48
Configurable naming conventions for local variable declarations and other locally-scoped variables. This rule reports variable declarations which do not match the regex that applies to their specific kind (e.g. final variable, or catch-clause parameter). Each regex can be configured through properties. By default this rule uses the standard Java naming convention (Camel case). LocalVariableNamingConventions (Priority: 1, Ruleset: Code Style) https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_codestyle.html#localvariablenamingconventions
This class has only private constructors and may be final: sandbox_extra_search/src/org/sandbox/jdt/internal/ui/search/Messages.java#L5
Reports classes that may be made final because they cannot be extended from outside their compilation unit anyway. This is because all their constructors are private, so a subclass could not call the super constructor. ClassWithOnlyPrivateConstructorsShouldBeFinal (Priority: 1, Ruleset: Design) https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_design.html#classwithonlyprivateconstructorsshouldbefinal
Return an empty collection rather than null.: sandbox_functional_converter/src/org/sandbox/jdt/internal/corext/fix/helper/PreconditionsChecker.java#L104
For any method that returns an collection (such as an array, Collection or Map), it is better to return an empty one rather than a null reference. This removes the need for null checking all results and avoids inadvertent NullPointerExceptions. See Effective Java, 3rd Edition, Item 54: Return empty collections or arrays instead of null ReturnEmptyCollectionRatherThanNull (Priority: 1, Ruleset: Error Prone) https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_errorprone.html#returnemptycollectionratherthannull
Return an empty collection rather than null.: sandbox_functional_converter/src/org/sandbox/jdt/internal/corext/fix/helper/PreconditionsChecker.java#L109
For any method that returns an collection (such as an array, Collection or Map), it is better to return an empty one rather than a null reference. This removes the need for null checking all results and avoids inadvertent NullPointerExceptions. See Effective Java, 3rd Edition, Item 54: Return empty collections or arrays instead of null ReturnEmptyCollectionRatherThanNull (Priority: 1, Ruleset: Error Prone) https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_errorprone.html#returnemptycollectionratherthannull
Return an empty collection rather than null.: sandbox_functional_converter/src/org/sandbox/jdt/internal/corext/fix/helper/ProspectiveOperation.java#L209
For any method that returns an collection (such as an array, Collection or Map), it is better to return an empty one rather than a null reference. This removes the need for null checking all results and avoids inadvertent NullPointerExceptions. See Effective Java, 3rd Edition, Item 54: Return empty collections or arrays instead of null ReturnEmptyCollectionRatherThanNull (Priority: 1, Ruleset: Error Prone) https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_errorprone.html#returnemptycollectionratherthannull
JUnitMigrationCleanUpTest.testJUnitCleanupTwoFilesb: sandbox_junit_cleanup_test/src/org/eclipse/jdt/ui/tests/quickfix/Java8/JUnitMigrationCleanUpTest.java#L992
expected: <package test; import org.junit.jupiter.api.extension.AfterEachCallback; import org.junit.jupiter.api.extension.BeforeEachCallback; import org.junit.jupiter.api.extension.ExtensionContext; /** * */ public class MyExternalResource implements BeforeEachCallback, AfterEachCallback { @OverRide public void beforeEach(ExtensionContext context) { int i=4; } @OverRide public void afterEach(ExtensionContext context) { } public start(){ } } > but was: <package test; import org.junit.rules.ExternalResource; /** * */ public class MyExternalResource extends ExternalResource { @OverRide protected void before() throws Throwable { int i=4; } @OverRide protected void after() { } public start(){ } } >
JUnitMigrationCleanUpTest.testJUnitCleanupParametrized(JUnitCleanupCases)[3] StaticImportCase: sandbox_junit_cleanup_test/src/org/eclipse/jdt/ui/tests/quickfix/Java8/JUnitMigrationCleanUpTest.java#L806
expected: <package test; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; /** * */ @suite @SelectClasses({ MyTest.class }) public class MyTest { /** * @throws java.lang.Exception */ @BeforeAll public static void setUpBeforeClass() throws Exception { } /** * @throws java.lang.Exception */ @afterall public static void tearDownAfterClass() throws Exception { } /** * @throws java.lang.Exception */ @beforeeach public void setUp() throws Exception { } /** * @throws java.lang.Exception */ @AfterEach public void tearDown() throws Exception { } @disabled @test public void test() { fail("Not yet implemented"); } @disabled("not implemented") @test public void test2() { fail("Not yet implemented"); } @test public void test3() { assertEquals("expected", "actual"); } @test public void test4() { assertEquals("expected", "actual", "failuremessage"); int result=5; assertEquals(5, result); // expected = 5, actual = result assertNotEquals(5,result, "failuremessage"); // expected = 5, actual = result assertTrue(false,"failuremessage"); assertFalse(false,"failuremessage"); assertTrue(false); assertFalse(false); } } > but was: <package test; import static org.junit.jupiter.api.Assertions.*; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Suite; /** * */ @RunWith(Suite.class) @Suite.SuiteClasses({ MyTest.class }) public class MyTest { /** * @throws java.lang.Exception */ @BeforeClass public static void setUpBeforeClass() throws Exception { } /** * @throws java.lang.Exception */ @afterclass public static void tearDownAfterClass() throws Exception { } /** * @throws java.lang.Exception */ @before public void setUp() throws Exception { } /** * @throws java.lang.Exception */ @after public void tearDown() throws Exception { } @ignore @test public void test() { fail("Not yet implemented"); } @ignore("not implemented") @test public void test2() { fail("Not yet implemented"); } @test public void test3() { assertEquals("expected", "actual"); } @test public void test4() { assertEquals("failuremessage", "expected", "actual"); int result=5; assertEquals(5, result); // expected = 5, actual = result assertNotEquals("failuremessage",5, result); // expected = 5, actual = result assertTrue("failuremessage",false); assertFalse("failuremessage",false); assertTrue(false); assertFalse(false); } } >
JUnitMigrationCleanUpTest.testJUnitCleanupParametrized(JUnitCleanupCases)[4] StaticExplicitImportCase: sandbox_junit_cleanup_test/src/org/eclipse/jdt/ui/tests/quickfix/Java8/JUnitMigrationCleanUpTest.java#L806
expected: <package test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; /** * */ @suite @SelectClasses({ MyTest.class }) public class MyTest { /** * @throws java.lang.Exception */ @BeforeAll public static void setUpBeforeClass() throws Exception { } /** * @throws java.lang.Exception */ @afterall public static void tearDownAfterClass() throws Exception { } /** * @throws java.lang.Exception */ @beforeeach public void setUp() throws Exception { } /** * @throws java.lang.Exception */ @AfterEach public void tearDown() throws Exception { } @disabled @test public void test() { fail("Not yet implemented"); } @disabled("not implemented") @test public void test2() { fail("Not yet implemented"); } @test public void test3() { assertEquals("expected", "actual"); } @test public void test4() { assertEquals("expected", "actual", "failuremessage"); int result=5; assertEquals(5, result); // expected = 5, actual = result assertNotEquals(5,result, "failuremessage"); // expected = 5, actual = result assertTrue(false,"failuremessage"); assertFalse(false,"failuremessage"); assertTrue(false); assertFalse(false); } } > but was: <package test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Suite; /** * */ @RunWith(Suite.class) @Suite.SuiteClasses({ MyTest.class }) public class MyTest { /** * @throws java.lang.Exception */ @BeforeClass public static void setUpBeforeClass() throws Exception { } /** * @throws java.lang.Exception */ @afterclass public static void tearDownAfterClass() throws Exception { } /** * @throws java.lang.Exception */ @before public void setUp() throws Exception { } /** * @throws java.lang.Exception */ @after public void tearDown() throws Exception { } @ignore @test public void test() { fail("Not yet implemented"); } @ignore("not implemented") @test public void test2() { fail("Not yet implemented"); } @test public void test3() { assertEquals("expected", "actual"); } @test public void test4() { assertEquals("failuremessage", "expected", "actual"); int result=5; assertEquals(5, result); // expected = 5, actual = result assertNotEquals("failuremessage",5, result); // expected = 5, actual = result assertTrue("failuremessage",false); assertFalse("failuremessage",false); assertTrue(false); assertFalse(false); } } >
JUnitMigrationCleanUpTest.testJUnitCleanupParametrized(JUnitCleanupCases)[5] RuleAnonymousExternalResource: sandbox_junit_cleanup_test/src/org/eclipse/jdt/ui/tests/quickfix/Java8/JUnitMigrationCleanUpTest.java#L806
expected: <package test; import org.junit.Rule; import org.junit.jupiter.api.Test; import org.junit.rules.ExternalResource; /** * */ public class MyTest { @rule public ExternalResource er= new ExternalResource() { @OverRide protected void before() throws Throwable { }; @OverRide protected void after() { }; }; @test public void test3() { } } > but was: <package test; import org.junit.Test; import org.junit.Rule; import org.junit.rules.ExternalResource; /** * */ public class MyTest { @rule public ExternalResource er= new ExternalResource() { @OverRide protected void before() throws Throwable { }; @OverRide protected void after() { }; }; @test public void test3() { } } >
JUnitMigrationCleanUpTest.testJUnitCleanupParametrized(JUnitCleanupCases)[6] RuleNestedExternalResource: sandbox_junit_cleanup_test/src/org/eclipse/jdt/ui/tests/quickfix/Java8/JUnitMigrationCleanUpTest.java#L806
expected: <package test; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.AfterEachCallback; import org.junit.jupiter.api.extension.BeforeEachCallback; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.RegisterExtension; /** * */ public class MyTest { final class MyExternalResource implements BeforeEachCallback, AfterEachCallback { @OverRide public void beforeEach(ExtensionContext context) { super.beforeEach(context); int i=4; } @OverRide public void afterEach(ExtensionContext context) { super.afterEach(context); } } @RegisterExtension public ExternalResource er= new MyExternalResource(); @test public void test3() { } } > but was: <package test; import org.junit.Test; import org.junit.Rule; import org.junit.rules.ExternalResource; /** * */ public class MyTest { final class MyExternalResource extends ExternalResource { @OverRide protected void before() throws Throwable { super.before(); int i=4; } @OverRide protected void after() { super.after(); } } @rule public ExternalResource er= new MyExternalResource(); @test public void test3() { } } >
JUnitMigrationCleanUpTest.testJUnitCleanupParametrized(JUnitCleanupCases)[7] TestnameRule: sandbox_junit_cleanup_test/src/org/eclipse/jdt/ui/tests/quickfix/Java8/JUnitMigrationCleanUpTest.java#L806
expected: <package test; import java.io.File; import java.io.IOException; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInfo; import org.junit.jupiter.api.io.TempDir; /** * */ public class MyTest { @tempdir Path tempFolder; private String testName; @beforeeach void init(TestInfo testInfo) { this.testName = testInfo.getDisplayName(); } private static final String SRC= "src"; @test public void test3() throws IOException{ System.out.println("Test name: " + testName); File newFile = tempFolder.resolve("myfile.txt").toFile(); } } > but was: <package test; import java.io.File; import java.io.IOException; import org.junit.Test; import org.junit.Rule; import org.junit.rules.TestName; import org.junit.rules.TemporaryFolder; /** * */ public class MyTest { private static final String SRC= "src"; @rule public TemporaryFolder tempFolder = new TemporaryFolder(); @rule public TestName tn = new TestName(); @test public void test3() throws IOException{ System.out.println("Test name: " + tn.getMethodName()); File newFile = tempFolder.newFile("myfile.txt"); } } >
JUnitMigrationCleanUpTest.testJUnitCleanupdonttouch(NOJUnitCleanupCases)[1] NOCase: sandbox_junit_cleanup_test/src/org/eclipse/jdt/ui/tests/quickfix/Java8/JUnitMigrationCleanUpTest.java#L853
MyTest.java has compilation problems: The import org cannot be resolved The import org cannot be resolved Test cannot be resolved to a type The method assertEquals(String, String) is undefined for the type MyTest
JUnitMigrationCleanUpTest.testJUnitCleanupTwoFiles: sandbox_junit_cleanup_test/src/org/eclipse/jdt/ui/tests/quickfix/Java8/JUnitMigrationCleanUpTest.java#L905
expected: <package test; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; import test.MyExternalResource; /** * */ public class MyTest { @RegisterExtension public MyExternalResource er= new MyExternalResource(); @before public void genericbefore(){ er.start(); } @test public void test3() { } } package test; import org.junit.jupiter.api.extension.AfterEachCallback; import org.junit.jupiter.api.extension.BeforeEachCallback; import org.junit.jupiter.api.extension.ExtensionContext; /** * */ public class MyExternalResource implements BeforeEachCallback, AfterEachCallback { @OverRide public void beforeEach(ExtensionContext context) { int i=4; } @OverRide public void afterEach(ExtensionContext context) { } public start(){ } } > but was: <package test; import org.junit.Test; import org.junit.Rule; import test.MyExternalResource; /** * */ public class MyTest { @rule public MyExternalResource er= new MyExternalResource(); @before public void genericbefore(){ er.start(); } @test public void test3() { } } package test; import org.junit.rules.ExternalResource; /** * */ public class MyExternalResource extends ExternalResource { @OverRide protected void before() throws Throwable { int i=4; } @OverRide protected void after() { } public start(){ } } >
JUnitMigrationCleanUpTest.testJUnitCleanupThreeFiles: sandbox_junit_cleanup_test/src/org/eclipse/jdt/ui/tests/quickfix/Java8/JUnitMigrationCleanUpTest.java#L1085
expected: <package test; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; import test.MyExternalResource; public class MyTest { @RegisterExtension public MyExternalResource er= new MyExternalResource(); @test public void test3() { } } package test; import org.junit.jupiter.api.extension.ExtensionContext; import test.MyExternalResource2; public class MyExternalResource extends MyExternalResource2 { @OverRide public void beforeEach(ExtensionContext context) { super.beforeEach(context); int i=4; } @OverRide public void afterEach(ExtensionContext context) { } } package test; import org.junit.jupiter.api.extension.AfterEachCallback; import org.junit.jupiter.api.extension.BeforeEachCallback; import org.junit.jupiter.api.extension.ExtensionContext; public class MyExternalResource2 implements BeforeEachCallback, AfterEachCallback { @OverRide public void beforeEach(ExtensionContext context) { super.beforeEach(context); int i=4; } @OverRide public void afterEach(ExtensionContext context) { } } > but was: <package test; import org.junit.Test; import org.junit.Rule; import test.MyExternalResource; public class MyTest { @rule public MyExternalResource er= new MyExternalResource(); @test public void test3() { } } package test; import test.MyExternalResource2; public class MyExternalResource extends MyExternalResource2 { @OverRide protected void before() throws Throwable { super.before(); int i=4; } @OverRide protected void after() { } } package test; import org.junit.rules.ExternalResource; public class MyExternalResource2 extends ExternalResource { @OverRide protected void before() throws Throwable { super.before(); int i=4; } @OverRide protected void after() { } } >
The default label should be the last label in a switch statement or expression: sandbox_cleanup_application/src/org/sandbox/jdt/core/cleanupapp/CodeCleanupApplication.java#L216
By convention, the default label should be the last label in a switch statement or switch expression. Note: This rule has been renamed from "DefaultLabelNotLastInSwitchStmt" with PMD 7.7.0. DefaultLabelNotLastInSwitch (Priority: 3, Ruleset: Best Practices) https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#defaultlabelnotlastinswitch
Avoid using implementation types like 'LinkedHashMap'; use the interface instead: sandbox_common/src/org/sandbox/jdt/internal/common/ASTProcessor.java#L68
Excessive coupling to implementation types (e.g., `HashSet`) limits your ability to use alternate implementations in the future as requirements change. Whenever available, declare variables and parameters using a more general type (e.g, `Set`). This rule reports uses of concrete collection types. User-defined types that should be treated the same as interfaces can be configured with the property `allowedTypes`. LooseCoupling (Priority: 3, Ruleset: Best Practices) https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#loosecoupling
Avoid using implementation types like 'LinkedList'; use the interface instead: sandbox_common/src/org/sandbox/jdt/internal/common/ASTProcessor.java#L74
Excessive coupling to implementation types (e.g., `HashSet`) limits your ability to use alternate implementations in the future as requirements change. Whenever available, declare variables and parameters using a more general type (e.g, `Set`). This rule reports uses of concrete collection types. User-defined types that should be treated the same as interfaces can be configured with the property `allowedTypes`. LooseCoupling (Priority: 3, Ruleset: Best Practices) https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#loosecoupling
Unused import 'org.eclipse.jdt.core.dom.*': sandbox_common/src/org/sandbox/jdt/internal/common/HelperVisitor.java#L25
Reports import statements that can be removed. They are either unused, duplicated, or the members they import are already implicitly in scope, because they're in java.lang, or the current package. If some imports cannot be resolved, for instance because you run PMD with an incomplete auxiliary classpath, some imports may be conservatively marked as used even if they're not to avoid false positives. UnnecessaryImport (Priority: 4, Ruleset: Code Style) https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_codestyle.html#unnecessaryimport
Avoid using implementation types like 'EnumSet'; use the interface instead: sandbox_common/src/org/sandbox/jdt/internal/common/HelperVisitor.java#L3472
Excessive coupling to implementation types (e.g., `HashSet`) limits your ability to use alternate implementations in the future as requirements change. Whenever available, declare variables and parameters using a more general type (e.g, `Set`). This rule reports uses of concrete collection types. User-defined types that should be treated the same as interfaces can be configured with the property `allowedTypes`. LooseCoupling (Priority: 3, Ruleset: Best Practices) https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#loosecoupling
Avoid using implementation types like 'EnumSet'; use the interface instead: sandbox_common/src/org/sandbox/jdt/internal/common/HelperVisitor.java#L3492
Excessive coupling to implementation types (e.g., `HashSet`) limits your ability to use alternate implementations in the future as requirements change. Whenever available, declare variables and parameters using a more general type (e.g, `Set`). This rule reports uses of concrete collection types. User-defined types that should be treated the same as interfaces can be configured with the property `allowedTypes`. LooseCoupling (Priority: 3, Ruleset: Best Practices) https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#loosecoupling
Avoid using implementation types like 'EnumSet'; use the interface instead: sandbox_common/src/org/sandbox/jdt/internal/common/HelperVisitor.java#L3512
Excessive coupling to implementation types (e.g., `HashSet`) limits your ability to use alternate implementations in the future as requirements change. Whenever available, declare variables and parameters using a more general type (e.g, `Set`). This rule reports uses of concrete collection types. User-defined types that should be treated the same as interfaces can be configured with the property `allowedTypes`. LooseCoupling (Priority: 3, Ruleset: Best Practices) https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#loosecoupling
Unused import 'org.eclipse.jdt.core.dom.*': sandbox_common/src/org/sandbox/jdt/internal/common/LambdaASTVisitor.java#L20
Reports import statements that can be removed. They are either unused, duplicated, or the members they import are already implicitly in scope, because they're in java.lang, or the current package. If some imports cannot be resolved, for instance because you run PMD with an incomplete auxiliary classpath, some imports may be conservatively marked as used even if they're not to avoid false positives. UnnecessaryImport (Priority: 4, Ruleset: Code Style) https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_codestyle.html#unnecessaryimport
This if statement can be replaced by `return !{condition} && {thenBranch};`: sandbox_common/src/org/sandbox/jdt/internal/common/LambdaASTVisitor.java#L55
Avoid unnecessary if-then-else statements when returning a boolean. The result of the conditional test can be returned instead. SimplifyBooleanReturns (Priority: 3, Ruleset: Design) https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_design.html#simplifybooleanreturns
Useless parentheses.: sandbox_common/src/org/sandbox/jdt/internal/common/LambdaASTVisitor.java#L56
Parenthesized expressions are used to override the default operator precedence rules. Parentheses whose removal would not change the relative nesting of operators are unnecessary, because they don't change the semantics of the enclosing expression. Some parentheses that strictly speaking are unnecessary, may still be considered useful for readability. This rule allows to ignore violations on two kinds of unnecessary parentheses: - "Clarifying" parentheses, which separate operators of difference precedence. While unnecessary, they make precedence rules explicit, which may be useful for rarely used operators. For example: ```java (a + b) & c // is equivalent to `a + b & c`, but probably clearer ``` Unset the property `ignoreClarifying` to report them. - "Balancing" parentheses, which are unnecessary but visually balance out another pair of parentheses around an equality operator. For example, those two expressions are equivalent: ```java (a == null) != (b == null) a == null != (b == null) ``` The parentheses on the right are required, and the parentheses on the left are just more visually pleasing. Unset the property `ignoreBalancing` to report them. UselessParentheses (Priority: 4, Ruleset: Code Style) https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_codestyle.html#uselessparentheses

Artifacts

Produced during runtime
Name Size
PMD Report Expired
17.8 KB