groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paul <pl.grue...@gmail.com>
Subject Omitting parentheses on .size() ?
Date Sat, 01 Aug 2020 00:49:54 GMT
Hi all,

(on latest groovy 3.0.5 and OpenJDK 14) omitting the empty parentheses to the .size() call
works, but throws an illegal reflective access warning:

```
groovy:000> [1,2,3].size
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.ReflectionUtils (file:/home/paul/.sdkman/candidates/groovy/3.0.5/lib/groovy-3.0.5.jar)
to field java.util.ArrayList.size
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.ReflectionUtils
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access
operations
WARNING: All illegal access operations will be denied in a future release
===> 3
```

Curiously, the size() method seems to be the only parameter-less method where I can
omit the empty parentheses – all others throw a MissingPropertyException (as expected).

What is the desired behaviour, and why is it even working (albeit with warnings) with .size
?


best
paul
-- 
typed with Neo 2 -- an ergonomically optimized keyboard layout
for German, English, programming, and science
❤ http://neo-layout.org
❤ https://useplaintext.email
❤ YY-MM-DD dates (ISO 8601/RFC 3339)
� UTF-8 encoding

Mime
View raw message