Copilot commented on code in PR #2324:
URL: https://github.com/apache/groovy/pull/2324#discussion_r2463960413


##########
src/main/java/groovy/util/concurrent/async/AsyncHelper.java:
##########
@@ -0,0 +1,96 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package groovy.util.concurrent.async;
+
+import org.apache.groovy.util.SystemUtil;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.function.Supplier;
+
+/**
+ * Helper class for async/await operations
+ *
+ * @since 6.0.0
+ */
+public class AsyncHelper {

Review Comment:
   The system property 'groovy.async.parallelism' is not documented. Consider 
adding a comment explaining its purpose and valid values.
   ```suggestion
   public class AsyncHelper {
       /**
        * The system property "groovy.async.parallelism" controls the 
parallelism level
        * (number of threads) used for the async thread pool. Valid values are 
positive integers.
        * If not set, the default is (number of available processors + 1).
        * Setting this value too high may lead to resource exhaustion; too low 
may reduce concurrency.
        */
   ```



##########
src/main/java/groovy/util/concurrent/async/AsyncHelper.java:
##########
@@ -0,0 +1,96 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package groovy.util.concurrent.async;
+
+import org.apache.groovy.util.SystemUtil;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.function.Supplier;
+
+/**
+ * Helper class for async/await operations
+ *
+ * @since 6.0.0
+ */
+public class AsyncHelper {
+    private static final int PARALLELISM = 
SystemUtil.getIntegerSafe("groovy.async.parallelism", 
Runtime.getRuntime().availableProcessors() + 1);
+    private static final Executor DEFAULT_EXECUTOR;
+    private static int seq;

Review Comment:
   The static field `seq` is accessed from multiple threads without 
synchronization in the thread factory. Use AtomicInteger instead to prevent 
race conditions.



##########
src/antlr/GroovyLexer.g4:
##########
@@ -485,6 +487,7 @@ VOLATILE      : 'volatile';
 WHILE         : 'while';
 YIELD         : 'yield';
 
+

Review Comment:
   [nitpick] Extra blank line added at line 490. Remove this unnecessary 
whitespace to maintain consistent formatting.
   ```suggestion
   
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to