You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Pankraz76 (via GitHub)" <gi...@apache.org> on 2025/05/21 19:24:44 UTC
[PR] EmptyControlStatement: `CheckThreadSafetyMojo` [maven]
Pankraz76 opened a new pull request, #2370:
URL: https://github.com/apache/maven/pull/2370
- https://github.com/apache/maven/pull/2365
- https://github.com/apache/maven/pull/2366
- https://github.com/apache/maven/pull/2364
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] EmptyControlStatement: `CheckThreadSafetyMojo` [maven]
Posted by "desruisseaux (via GitHub)" <gi...@apache.org>.
desruisseaux commented on code in PR #2370:
URL: https://github.com/apache/maven/pull/2370#discussion_r2101193161
##########
its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/CheckThreadSafetyMojo.java:
##########
@@ -95,7 +95,11 @@ public void run() {
getLog().info("[MAVEN-CORE-IT-LOG] Thread " + this + " uses " + tccl);
Thread.currentThread().setContextClassLoader(tccl);
while (go.isEmpty()) {
- // wait for start
Review Comment:
I have not checked the context. But maybe `java.util.concurrent.CountDownLatch` could be used instead of that loop.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore: `CheckThreadSafetyMojo` PMD-Rule: `EmptyControlStatement` [maven]
Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo commented on code in PR #2370:
URL: https://github.com/apache/maven/pull/2370#discussion_r2102744708
##########
its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/CheckThreadSafetyMojo.java:
##########
@@ -95,7 +95,11 @@ public void run() {
getLog().info("[MAVEN-CORE-IT-LOG] Thread " + this + " uses " + tccl);
Thread.currentThread().setContextClassLoader(tccl);
while (go.isEmpty()) {
- // wait for start
+ try {
+ Thread.sleep(100); // wait for the start
+ } catch (InterruptedException e) {
Review Comment:
No, don't throw a raw RuntimeException. probably just continue here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore: `CheckThreadSafetyMojo` PMD-Rule: `EmptyControlStatement` [maven]
Posted by "Pankraz76 (via GitHub)" <gi...@apache.org>.
Pankraz76 commented on code in PR #2370:
URL: https://github.com/apache/maven/pull/2370#discussion_r2103945912
##########
its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/CheckThreadSafetyMojo.java:
##########
@@ -95,7 +95,11 @@ public void run() {
getLog().info("[MAVEN-CORE-IT-LOG] Thread " + this + " uses " + tccl);
Thread.currentThread().setContextClassLoader(tccl);
while (go.isEmpty()) {
- // wait for start
Review Comment:
> CountDownLatch
thanks for ideation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: debounce `while(true)` in `CheckThreadSafetyMojo` PMD-Rule: `EmptyControlStatement` [maven]
Posted by "Pankraz76 (via GitHub)" <gi...@apache.org>.
Pankraz76 commented on code in PR #2370:
URL: https://github.com/apache/maven/pull/2370#discussion_r2124732837
##########
its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/CheckThreadSafetyMojo.java:
##########
@@ -95,7 +95,10 @@ public void run() {
getLog().info("[MAVEN-CORE-IT-LOG] Thread " + this + " uses " + tccl);
Thread.currentThread().setContextClassLoader(tccl);
while (go.isEmpty()) {
- // wait for start
+ try {
+ Thread.sleep(100); // wait for the start
Review Comment:
```suggestion
MILLISECONDS.sleep(100); // wait for the start
```
https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/TimeUnit.html#sleep-long-
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: debounce `while(true)` in `CheckThreadSafetyMojo` PMD-Rule: `EmptyControlStatement` [maven]
Posted by "Pankraz76 (via GitHub)" <gi...@apache.org>.
Pankraz76 commented on code in PR #2370:
URL: https://github.com/apache/maven/pull/2370#discussion_r2104388936
##########
its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/CheckThreadSafetyMojo.java:
##########
@@ -95,7 +95,10 @@ public void run() {
getLog().info("[MAVEN-CORE-IT-LOG] Thread " + this + " uses " + tccl);
Thread.currentThread().setContextClassLoader(tccl);
while (go.isEmpty()) {
- // wait for start
+ try {
+ Thread.sleep(100); // wait for the start
+ } catch (InterruptedException ignored) {
Review Comment:
ah sorry i meant you mean the general task, assuming there is/must be an switch for that, as its the common way to do so.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore: `CheckThreadSafetyMojo` PMD-Rule: `EmptyControlStatement` [maven]
Posted by "Pankraz76 (via GitHub)" <gi...@apache.org>.
Pankraz76 commented on code in PR #2370:
URL: https://github.com/apache/maven/pull/2370#discussion_r2103939271
##########
its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/CheckThreadSafetyMojo.java:
##########
@@ -95,7 +95,11 @@ public void run() {
getLog().info("[MAVEN-CORE-IT-LOG] Thread " + this + " uses " + tccl);
Thread.currentThread().setContextClassLoader(tccl);
while (go.isEmpty()) {
- // wait for start
+ try {
+ Thread.sleep(100); // wait for the start
+ } catch (InterruptedException e) {
Review Comment:
ide finding: `'continue' is unnecessary as the last statement in a loop `
<img width="1156" alt="image" src="https://github.com/user-attachments/assets/6d50f67a-58f7-4ce2-88f9-887ba6b37c80" />
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore: `CheckThreadSafetyMojo` PMD-Rule: `EmptyControlStatement` [maven]
Posted by "Pankraz76 (via GitHub)" <gi...@apache.org>.
Pankraz76 commented on code in PR #2370:
URL: https://github.com/apache/maven/pull/2370#discussion_r2103950410
##########
its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/CheckThreadSafetyMojo.java:
##########
@@ -95,7 +95,11 @@ public void run() {
getLog().info("[MAVEN-CORE-IT-LOG] Thread " + this + " uses " + tccl);
Thread.currentThread().setContextClassLoader(tccl);
while (go.isEmpty()) {
- // wait for start
Review Comment:
https://github.com/apache/maven/pull/2381
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: debounce `while(true)` in `CheckThreadSafetyMojo` PMD-Rule: `EmptyControlStatement` [maven]
Posted by "Pankraz76 (via GitHub)" <gi...@apache.org>.
Pankraz76 commented on code in PR #2370:
URL: https://github.com/apache/maven/pull/2370#discussion_r2104394597
##########
its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/CheckThreadSafetyMojo.java:
##########
@@ -95,7 +95,10 @@ public void run() {
getLog().info("[MAVEN-CORE-IT-LOG] Thread " + this + " uses " + tccl);
Thread.currentThread().setContextClassLoader(tccl);
while (go.isEmpty()) {
- // wait for start
+ try {
+ Thread.sleep(100); // wait for the start
+ } catch (InterruptedException ignored) {
Review Comment:
> Empty blocks are illegal wrt checkstyle.
if this is true then this whole PR would not be possible as the root cause is https://pmd.github.io/pmd/pmd_rules_java_codestyle.html#emptycontrolstatement.
<img width="931" alt="image" src="https://github.com/user-attachments/assets/15f00c9e-34ff-4120-8fd4-d9477e90356c" />
[INFO] BUILD SUCCESS
<img width="682" alt="image" src="https://github.com/user-attachments/assets/4e4e9dcd-6856-48e9-ae7c-e6f13b50c160" />
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] EmptyControlStatement: `CheckThreadSafetyMojo` [maven]
Posted by "Pankraz76 (via GitHub)" <gi...@apache.org>.
Pankraz76 commented on code in PR #2370:
URL: https://github.com/apache/maven/pull/2370#discussion_r2101165484
##########
its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/CheckThreadSafetyMojo.java:
##########
@@ -95,7 +95,11 @@ public void run() {
getLog().info("[MAVEN-CORE-IT-LOG] Thread " + this + " uses " + tccl);
Thread.currentThread().setContextClassLoader(tccl);
while (go.isEmpty()) {
- // wait for start
Review Comment:
no need for debounce?
potentially `while(true)` cloud max out CPU.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: debounce `while(true)` in `CheckThreadSafetyMojo` PMD-Rule: `EmptyControlStatement` [maven]
Posted by "Pankraz76 (via GitHub)" <gi...@apache.org>.
Pankraz76 commented on code in PR #2370:
URL: https://github.com/apache/maven/pull/2370#discussion_r2104384665
##########
its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/CheckThreadSafetyMojo.java:
##########
@@ -95,7 +95,10 @@ public void run() {
getLog().info("[MAVEN-CORE-IT-LOG] Thread " + this + " uses " + tccl);
Thread.currentThread().setContextClassLoader(tccl);
while (go.isEmpty()) {
- // wait for start
+ try {
+ Thread.sleep(100); // wait for the start
+ } catch (InterruptedException ignored) {
Review Comment:
yes this rules must be absent or bug. As we have this several times i assume its misconfigured.
- https://checkstyle.sourceforge.io/checks/blocks/emptyblock.html
- https://github.com/apache/maven-shared-resources/blob/bad8df9df24313a66dd5968194b631305ac499dd/src/main/resources/config/maven_checks_nocodestyle.xml#L106
- so its a bug. Again one reason to chain the tools.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: debounce `while(true)` in `CheckThreadSafetyMojo` PMD-Rule: `EmptyControlStatement` [maven]
Posted by "Pankraz76 (via GitHub)" <gi...@apache.org>.
Pankraz76 commented on PR #2370:
URL: https://github.com/apache/maven/pull/2370#issuecomment-2943502176
- https://github.com/apache/maven/pull/2381
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: debounce `while(true)` in `CheckThreadSafetyMojo` PMD-Rule: `EmptyControlStatement` [maven]
Posted by "Pankraz76 (via GitHub)" <gi...@apache.org>.
Pankraz76 closed pull request #2370: fix: debounce `while(true)` in `CheckThreadSafetyMojo` PMD-Rule: `EmptyControlStatement`
URL: https://github.com/apache/maven/pull/2370
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: debounce `while(true)` in `CheckThreadSafetyMojo` PMD-Rule: `EmptyControlStatement` [maven]
Posted by "Pankraz76 (via GitHub)" <gi...@apache.org>.
Pankraz76 commented on code in PR #2370:
URL: https://github.com/apache/maven/pull/2370#discussion_r2104384665
##########
its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/CheckThreadSafetyMojo.java:
##########
@@ -95,7 +95,10 @@ public void run() {
getLog().info("[MAVEN-CORE-IT-LOG] Thread " + this + " uses " + tccl);
Thread.currentThread().setContextClassLoader(tccl);
while (go.isEmpty()) {
- // wait for start
+ try {
+ Thread.sleep(100); // wait for the start
+ } catch (InterruptedException ignored) {
Review Comment:
yes this rules must be absent or bug. As we have this several times i assume its misconfigured.
- https://checkstyle.sourceforge.io/checks/blocks/emptyblock.html
- https://github.com/apache/maven-shared-resources/blob/bad8df9df24313a66dd5968194b631305ac499dd/src/main/resources/config/maven_checks_nocodestyle.xml#L106
- so its a bug. Again one reason to chain the tools.
- im gonna give but report but dont have time for give 8 templated @romani
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: debounce `while(true)` in `CheckThreadSafetyMojo` PMD-Rule: `EmptyControlStatement` [maven]
Posted by "Pankraz76 (via GitHub)" <gi...@apache.org>.
Pankraz76 commented on code in PR #2370:
URL: https://github.com/apache/maven/pull/2370#discussion_r2104394597
##########
its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/CheckThreadSafetyMojo.java:
##########
@@ -95,7 +95,10 @@ public void run() {
getLog().info("[MAVEN-CORE-IT-LOG] Thread " + this + " uses " + tccl);
Thread.currentThread().setContextClassLoader(tccl);
while (go.isEmpty()) {
- // wait for start
+ try {
+ Thread.sleep(100); // wait for the start
+ } catch (InterruptedException ignored) {
Review Comment:
> Empty blocks are illegal wrt checkstyle.
if this is true then this whole PR would not be possible as the root cause is https://pmd.github.io/pmd/pmd_rules_java_codestyle.html#emptycontrolstatement.
![Uploading image.png…]()
[INFO] BUILD SUCCESS
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: debounce `while(true)` in `CheckThreadSafetyMojo` PMD-Rule: `EmptyControlStatement` [maven]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on code in PR #2370:
URL: https://github.com/apache/maven/pull/2370#discussion_r2104342663
##########
its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/CheckThreadSafetyMojo.java:
##########
@@ -95,7 +95,10 @@ public void run() {
getLog().info("[MAVEN-CORE-IT-LOG] Thread " + this + " uses " + tccl);
Thread.currentThread().setContextClassLoader(tccl);
while (go.isEmpty()) {
- // wait for start
+ try {
+ Thread.sleep(100); // wait for the start
+ } catch (InterruptedException ignored) {
Review Comment:
Empty blocks are illegal wrt checkstyle.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org