[
https://issues.apache.org/jira/browse/GROOVY-11585?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King closed GROOVY-11585.
------------------------------
> instanceof with parameterized type
> ----------------------------------
>
> Key: GROOVY-11585
> URL: https://issues.apache.org/jira/browse/GROOVY-11585
> Project: Groovy
> Issue Type: Bug
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Major
> Fix For: 5.0.0-beta-1
>
>
> The {{instanceof}} operator allows parameterized types. However, the types
> are erased at runtime, so the check can be improper. For example:
> {code:groovy}
> def list = [1,2,3]
> if (list instanceof List<String>) {
> // yes List but not of String
> }
> {code}
> The java compiler says "Cannot perform instanceof check against parameterized
> type List<String>. Use the form List<?> instead since further generic type
> information will be erased at runtime."
--
This message was sent by Atlassian Jira
(v8.20.10#820010)