Skip to content

add migration cleanup from junit 4 to junit 5 #611

add migration cleanup from junit 4 to junit 5

add migration cleanup from junit 4 to junit 5 #611

Triggered via pull request October 23, 2024 17:17
Status Success
Total duration 42s
Artifacts 1

pmd.yml

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

Annotations

18 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.6.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.6.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.6.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.6.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.6.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.6.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.6.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.6.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.6.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.6.0/pmd_rules_java_errorprone.html#returnemptycollectionratherthannull
Java8CleanUpTest.testJUnitCleanupParametrized(JUnitCleanupCases)[1] PositiveCase: sandbox_functional_converter_test/src/org/sandbox/jdt/ui/tests/quickfix/Java8CleanUpTest.java#L734
expected: <package test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; 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() { Assertions.fail("Not yet implemented"); } @disabled("not implemented") @test public void test2() { Assertions.fail("Not yet implemented"); } @test public void test3() { Assertions.assertEquals("expected", "actual"); } @test public void test4() { Assertions.assertEquals("expected", "actual", "failuremessage"); int result=5; Assertions.assertEquals(5, result); // expected = 5, actual = result Assertions.assertNotEquals(5,result, "failuremessage"); // expected = 5, actual = result Assertions.assertTrue(false,"failuremessage"); Assertions.assertFalse(false,"failuremessage"); Assertions.assertTrue(false); Assertions.assertFalse(false); } } > but was: <package test; 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.jupiter.api.Assertions; 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() { Assertions.fail("Not yet implemented"); } @ignore("not implemented") @test public void test2() { Assertions.fail("Not yet implemented"); } @test public void test3() { Assertions.assertEquals("expected", "actual"); } @test public void test4() { Assertions.assertEquals("expected", "actual", "failuremessage"); int result=5; Assertions.assertEquals(5, result); // expected = 5, actual = result Assertions.assertNotEquals(5,result, "failuremessage"); // expected = 5, actual = result Assertions.assertTrue(false,"failuremessage"); Assertions.assertFalse(false,"failuremessage"); Assertions.assertTrue(false); Assertions.assertFalse(false); } } >
Java8CleanUpTest.testJUnitCleanupParametrized(JUnitCleanupCases)[2] StaticImportCase: sandbox_functional_converter_test/src/org/sandbox/jdt/ui/tests/quickfix/Java8CleanUpTest.java#L734
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("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); } } >
Java8CleanUpTest.testJUnitCleanupParametrized(JUnitCleanupCases)[3] StaticExplicitImportCase: sandbox_functional_converter_test/src/org/sandbox/jdt/ui/tests/quickfix/Java8CleanUpTest.java#L734
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("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); } } >
Java8CleanUpTest.testJUnitCleanupParametrized(JUnitCleanupCases)[4] RuleAnonymousExternalResource: sandbox_functional_converter_test/src/org/sandbox/jdt/ui/tests/quickfix/Java8CleanUpTest.java#L734
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() { } } >
Java8CleanUpTest.testJUnitCleanupParametrized(JUnitCleanupCases)[5] RuleNestedExternalResource: sandbox_functional_converter_test/src/org/sandbox/jdt/ui/tests/quickfix/Java8CleanUpTest.java#L734
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.ExtendWith; import org.junit.jupiter.api.extension.ExtensionContext; /** * */ @ExtendWith(MyExternalResource.class) public class MyTest { final class MyExternalResource implements BeforeEachCallback, AfterEachCallback { @OverRide protected void beforeEach(ExtensionContext context) throws Throwable { int i=4; } @OverRide protected void afterEach(ExtensionContext context) { } } @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 { int i=4; } @OverRide protected void after() { } } @rule public ExternalResource er= new MyExternalResource(); @test public void test3() { } } >
Java8CleanUpTest.testJUnitCleanupParametrized(JUnitCleanupCases)[6] TestnameRule: sandbox_functional_converter_test/src/org/sandbox/jdt/ui/tests/quickfix/Java8CleanUpTest.java#L734
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"); } } >
Java8CleanUpTest.testJUnitCleanupTwoFiles: sandbox_functional_converter_test/src/org/sandbox/jdt/ui/tests/quickfix/Java8CleanUpTest.java#L818
expected: <package test; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; /** * */ @ExtendWith(MyExternalResource.class) public class MyTest { @test public void test3() { } } package test; import org.junit.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 protected void beforeEach(ExtensionContext context) throws Throwable { int i=4; } @OverRide protected void afterEach(ExtensionContext context) { } } > 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 MyExternalResource(); @test public void test3() { } } package test; import org.junit.Test; import org.junit.Rule; import org.junit.rules.ExternalResource; /** * */ public class MyExternalResource extends ExternalResource { @OverRide protected void before() throws Throwable { int i=4; } @OverRide protected void after() { } } >
Java8CleanUpTest.testJUnitCleanupThreeFiles: sandbox_functional_converter_test/src/org/sandbox/jdt/ui/tests/quickfix/Java8CleanUpTest.java#L913
expected: <package test; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import test.MyExternalResource; @ExtendWith(MyExternalResource.class) public class MyTest { @test public void test3() { } } package test; import org.junit.jupiter.api.extension.ExtensionContext; import test.MyExternalResource2; public class MyExternalResource extends MyExternalResource2 { @OverRide protected void beforeEach(ExtensionContext context) throws Throwable { int i=4; } @OverRide protected 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 protected void beforeEach(ExtensionContext context) throws Throwable { int i=4; } @OverRide protected void afterEach(ExtensionContext context) { } } > but was: <package test; import org.junit.Test; import org.junit.Rule; import org.junit.rules.ExternalResource; import test.MyExternalResource; public class MyTest { @rule public ExternalResource er= new MyExternalResource(); @test public void test3() { } } package test; import test.MyExternalResource2; public class MyExternalResource extends MyExternalResource2 { @OverRide protected void before() throws Throwable { 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 { int i=4; } @OverRide protected void after() { } } >
The default label should be the last label in a switch statement: 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. DefaultLabelNotLastInSwitchStmt (Priority: 3, Ruleset: Best Practices) https://docs.pmd-code.org/pmd-doc-7.6.0/pmd_rules_java_bestpractices.html#defaultlabelnotlastinswitchstmt
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.6.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.6.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.6.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#L3454
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.6.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#L3474
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.6.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#L3494
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.6.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.6.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.6.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.6.0/pmd_rules_java_codestyle.html#uselessparentheses

Artifacts

Produced during runtime
Name Size
PMD Report Expired
17.5 KB