You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/05/26 22:23:00 UTC
[jira] [Resolved] (GROOVY-9994) Type checking of array initializer
expressions
[ https://issues.apache.org/jira/browse/GROOVY-9994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles resolved GROOVY-9994.
---------------------------------
Fix Version/s: 4.0.0-beta-1
Resolution: Fixed
> Type checking of array initializer expressions
> ----------------------------------------------
>
> Key: GROOVY-9994
> URL: https://issues.apache.org/jira/browse/GROOVY-9994
> Project: Groovy
> Issue Type: Bug
> Reporter: Thodoris Sotiropoulos
> Assignee: Eric Milles
> Priority: Major
> Fix For: 4.0.0-beta-1
>
>
> This is a follow up of https://issues.apache.org/jira/browse/GROOVY-9985
> After the bug fix of the above GROOVY-9985, STC indeed catches the type error in the following program
> {code:java}
> public class Main {
> public static void main(String[] args) {
> Integer[] arr = new Integer[] {"fd" 1}; // compile-time error here
> Integer y = arr[0];
> }
> }
> {code}
> However, STC still is not able to catch type errors like the following
> {code:java}
> public class Main {
> public static void main(String[] args) {
> Integer[] arr = new Integer[] {new Object(), 1}; // STC misses the error here
> Integer y = arr[0]; // ClassCastException at runtime
> }
>
> }
> {code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)