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

Paul King closed GROOVY-6656.
-----------------------------
    Resolution: Duplicate

> Add compiler error when Object.clone method is called in CompileStatic mode. 
> Currently causes VerifyError "Bad access to protected data" at runtime
> ---------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-6656
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6656
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 2.2.2, 2.3.0, 2.4.0-rc-1
>            Reporter: Lari Hotari
>
> The compiler should issue an error when Object.clone method is called in 
> CompileStatic mode.
> This currently causes VerifyError "Bad access to protected data" at runtime 
> which doesn't really point out the problem.
> Here's a code example that demonstrates the problem:
> {code}
> @groovy.transform.CompileStatic 
> class Person {
>     String name 
>     
>     public Object clone() {
>         new Person(name: name)
>     }
> }
> @groovy.transform.CompileStatic 
> Person cloneIt(Object param) {
>     (Person)param.clone()
> }
> cloneIt(new Person(name:'Lari')).name
> {code}
> this fails with error at class loading time (at runtime):
> {code}
> java.lang.VerifyError: (class: ConsoleScript21, method: cloneIt signature: 
> (Ljava/lang/Object;)LPerson;) Bad access to protected data
> {code}
> I believe that the expected behaviour would be to fail with compiler error at 
> compile time.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to