[ 
https://issues.apache.org/jira/browse/GROOVY-10845?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles updated GROOVY-10845:
---------------------------------
    Description: 
Consider the following:
{code:groovy}
@groovy.transform.TypeChecked
enum E {
  FOO; // no error for missing argument
  E(String s) {
  }
}
{code}

Enum constant field {{FOO}} is initialized by static method call 
{{$INIT("FOO",0)}} which accepts {{Object[]}} as it argument(s).  Thus no error 
is produced for the example but it fails at runtime.

  was:
Consider the following:
{code:groovy}
@groovy.transform.TypeChecked
enum E {
  FOO; // no error for missing argument
  E(String s) {
  }
}
{code}

Enum constant {{FOO}} is initialized by static method call {{$INIT("FOO",0)}} 
which accepts {{Object[]}} as it argument(s).  Thus no error is produced for 
the example but it fails at runtime.


> Add type checking for enum constant constructor call
> ----------------------------------------------------
>
>                 Key: GROOVY-10845
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10845
>             Project: Groovy
>          Issue Type: Improvement
>          Components: Static Type Checker
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Minor
>
> Consider the following:
> {code:groovy}
> @groovy.transform.TypeChecked
> enum E {
>   FOO; // no error for missing argument
>   E(String s) {
>   }
> }
> {code}
> Enum constant field {{FOO}} is initialized by static method call 
> {{$INIT("FOO",0)}} which accepts {{Object[]}} as it argument(s).  Thus no 
> error is produced for the example but it fails at runtime.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to