[
https://issues.apache.org/jira/browse/GROOVY-11664?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17953905#comment-17953905
]
ASF GitHub Bot commented on GROOVY-11664:
-----------------------------------------
Copilot commented on code in PR #2230:
URL: https://github.com/apache/groovy/pull/2230#discussion_r2106163477
##########
src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java:
##########
@@ -1537,6 +1537,14 @@ &&
isUsingGenericsOrIsArrayUsingGenerics(type.getComponentType())) {
}
return true; // incompatible
}
+ if (!fixedPlaceHolders.contains(entry.getKey())
+ && !resolved.isPlaceholder() && !resolved.isWildcard()
+ && !candidate.isPlaceholder() && !candidate.isWildcard()) {
Review Comment:
[nitpick] The boolean expression is quite long and complex; consider
extracting it into a well-named predicate method to improve readability.
```suggestion
if (shouldUpdateResolvedGenerics(fixedPlaceHolders,
entry.getKey(), resolved, candidate)) {
```
> STC: method call with class literals
> ------------------------------------
>
> Key: GROOVY-11664
> URL: https://issues.apache.org/jira/browse/GROOVY-11664
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Minor
>
> Consider the following:
> {code:groovy}
> class A {}
> class B extends A {}
> class C extends B {}
> @groovy.transform.TypeChecked test() {
> def list = Arrays.asList(A.class, B.class, C.class)
> }
> test()
> {code}
> This fails with "Cannot call <T> java.util.Arrays#asList(T[]) with arguments
> [java.lang.Class<A>, java.lang.Class<B>, java.lang.Class<C>]"
--
This message was sent by Atlassian Jira
(v8.20.10#820010)