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


##########
src/main/java/groovy/transform/stc/ClassTag.java:
##########
@@ -0,0 +1,87 @@
+/*
+ *  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.transform.stc;
+
+import org.apache.groovy.lang.annotation.Incubating;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Parameter annotation marking a {@code Class} parameter as 
<em>compiler-supplied</em> under
+ * static compilation. On the JVM, a method that needs the runtime type of a 
generic type
+ * parameter cannot recover it (erasure), so the API must take an explicit 
{@code Class<T>}
+ * token. That token is redundant with a type the compiler already knows 
&mdash; the receiver's
+ * type argument. {@code @ClassTag} removes the redundancy.
+ * <p>
+ * Under {@code @CompileStatic} / {@code @TypeChecked}, when a call would 
otherwise be missing the
+ * trailing {@code Class} argument(s), the type checker may select an overload 
whose remaining
+ * parameters are all {@code @ClassTag Class<X>} and synthesise the {@code 
X.class} argument(s)
+ * from the receiver's matching type argument(s), rewriting the call. Each 
{@code @ClassTag}
+ * parameter is filled at its declared position; the caller's supplied 
arguments map to the
+ * remaining (non-tag) parameters in order.

Review Comment:
   In the `@ClassTag` Javadoc, “missing the trailing Class argument(s)” is 
misleading because injection can also fill `@ClassTag` parameters that aren’t 
trailing (it inserts tokens at declared positions). Reword this to avoid 
implying the tokens must be at the end of the parameter list.
   
   This issue also appears on line 57 of the same file.



-- 
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