[
https://issues.apache.org/jira/browse/GROOVY-10359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17862590#comment-17862590
]
Eric Milles commented on GROOVY-10359:
--------------------------------------
I'll have to dig up the spec on this as I'm seeing mixed results.
{code:groovy}
@TypeChecked test(char ch) {
Character c = ch
BigInteger b = ch
Integer i = ch
Number n = ch
}
{code}
> STC misses type error when involving a variable with a char a declared type
> ---------------------------------------------------------------------------
>
> Key: GROOVY-10359
> URL: https://issues.apache.org/jira/browse/GROOVY-10359
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: Thodoris Sotiropoulos
> Assignee: Eric Milles
> Priority: Minor
>
> I have the following program
> {code:java}
> class Test {
> public static void main(String[] args) {
> char f = (Integer) null;
> }
> }
> {code}
> h3. Actual behaviour
> groovyc compiles this program
> h3. Expected behaviour.
> groovyc should have rejected this program with an error of the form:
> {code}
> error: incompatible types: Integer cannot be converted to char
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)