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/02/23 23:25:00 UTC

[jira] [Commented] (GROOVY-9950) Strange ClassCastException when calling ToString in CompileStatic

    [ https://issues.apache.org/jira/browse/GROOVY-9950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17289427#comment-17289427 ] 

Eric Milles commented on GROOVY-9950:
-------------------------------------

Can you provide an example script that recreates the problem?

> Strange ClassCastException when calling ToString in CompileStatic
> -----------------------------------------------------------------
>
>                 Key: GROOVY-9950
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9950
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-jdk
>    Affects Versions: 3.0.7
>            Reporter: Marcel Wagner
>            Priority: Major
>
> I have a class extending a base class implementing a toString() method. Making the code CompileStatic I get a ClassCassException. Without CompileStatic all is fine.
> String test = myClazz.toString() I get the ClassCastException with myClazz could not be cast to String. Debugging is also strange, I can't get to the base class implementation of toString.
> Interrestingly, the implizit call of toString() is functioning:
> String test = myClazz  All is fine. Debugging also, the toString method is called
>  
> There seems a bug in CompileStatic. Something is scrambled.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)