Copilot commented on code in PR #2642:
URL: https://github.com/apache/groovy/pull/2642#discussion_r3489775209
##########
src/main/java/groovy/transform/OperatorRename.java:
##########
@@ -152,6 +152,28 @@
* @return the replacement method name
*/
String compareTo() default Undefined.STRING;
+ /**
+ * Returns the replacement method name for the {@code in} membership
operator
+ * (whose default method is {@code isIn}). Defaults to {@link
Undefined#STRING},
+ * meaning no rename. The receiver is the right operand (the container), so
+ * {@code a in b} dispatches to {@code b.name(a)}. Setting this to {@code
'isCase'}
+ * restores the pre-GROOVY-9848 value-based membership for maps and char
sequences
+ * within the annotated scope.
+ *
Review Comment:
The new `@OperatorRename(isIn=...)` Javadoc suggests setting `isIn='isCase'`
restores legacy semantics, but it doesn’t mention that `!in` will keep using
the default behavior unless `isNotIn` is also set. That omission can easily
lead to inconsistent `in` vs `!in` semantics within the annotated scope.
--
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]