diff --git a/.config/pmd/java/ruleset.xml b/.config/pmd/java/ruleset.xml index 02a037f..ebdbd83 100644 --- a/.config/pmd/java/ruleset.xml +++ b/.config/pmd/java/ruleset.xml @@ -218,6 +218,71 @@ + + + Using a `@PostConstruct` method is usually only done when field injection is used and initialization needs to be performed after that. + + It's better to do this directly in the constructor with constructor injection, so that all logic will be encapsulated there. + This also makes using the bean in environments where JavaEE is not present - for example in tests - a lot easier, as forgetting to call the `@PostConstruct` method is no longer possible. + + 3 + + + + + + + + + + + + `@PreDestroy` should be replaced by implementing `AutoCloseable` and overwriting the `close` method instead. + + This also makes using the bean in environments where JavaEE is not present - for example in tests - a lot easier, as forgetting to call the `@PreDestroy` method is no much more difficult. + + 3 + + + + + + + + + + + + Trying to manually manage threads usually gets quickly out of control and may result in various problems like uncontrollable spawning of threads. + Threads can also not be cancelled properly. + + Use managed Thread services like `ExecutorService` and `CompletableFuture` instead. + + 3 + + + + + + + + + - + \ No newline at end of file diff --git a/pom.xml b/pom.xml index a8cc3e6..675ccf7 100644 --- a/pom.xml +++ b/pom.xml @@ -44,7 +44,7 @@ com.puppycrawl.tools checkstyle - 11.0.0 + 11.0.1 diff --git a/selenium-elements/pom.xml b/selenium-elements/pom.xml index 634d34d..6ffd9b1 100644 --- a/selenium-elements/pom.xml +++ b/selenium-elements/pom.xml @@ -291,7 +291,7 @@ com.puppycrawl.tools checkstyle - 11.0.0 + 11.0.1