blackdrag commented on code in PR #3381:
URL: https://github.com/apache/groovy/pull/3381#discussion_r4756159399
##########
subprojects/groovy-contracts/src/test/groovy/org/apache/groovy/contracts/tests/other/GenericTypeTests.groovy:
##########
@@ -126,7 +126,7 @@ class GenericTypeTests extends BaseTestClass {
@groovy.transform.CompileStatic
@Invariant({ property.size() >= 0 })
class A<T extends java.util.List> {
- T property = []
+ T property = (T) []
Review Comment:
I think this line is a good indicator that this change is a problem. In
Groovy `T property = []` is to be interpreted as `T property = (T) []` already.
If `T property = []` is not valid, then why is `(T) []`? And I mean compile and
runtime. Just because it is a explicit cast does not mean we should allow more
type transformations than normally. And yes, it should not matter that is no
actual type.
--
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]