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/03/30 15:11:00 UTC

[jira] [Resolved] (GROOVY-7989) VerifyError when calling protected method #clone()

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

Eric Milles resolved GROOVY-7989.
---------------------------------
    Resolution: Fixed

> VerifyError when calling protected method #clone()
> --------------------------------------------------
>
>                 Key: GROOVY-7989
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7989
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 2.4.5, 2.4.7
>         Environment: Ubuntu Precise
> x86_64 arch
> Java 1.8.0_91
>            Reporter: Nick Stokoe
>            Assignee: Eric Milles
>            Priority: Major
>
> Running this demo code reproduces the error:
> {code}
> import groovy.transform.CompileStatic
> @CompileStatic
> class Foo {
> 	static {
>         List list = []
>         list.clone()
> 	}
> }
> {code}
> This works when @CompileStatic is off, but when it is on, the compiler throws. It seems suspiciously low level - yes, Map#clone is protected and therefore inaccessible in this context, but obviously one would want something more user-friendly than this, not least because it doesn't indicate *where* the error is, so finding it can be tricky:
> {code}
> Caught: java.lang.VerifyError: (class: Foo, method: <clinit> signature: ()V) Bad access to protected data
> java.lang.VerifyError: (class: Foo, method: <clinit> signature: ()V) Bad access to protected data
> {code}



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