Nick Stokoe created GROOVY-7989:
-----------------------------------

             Summary: 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.7, 2.4.5
         Environment: Ubuntu Precise
x86_64 arch
Java 1.8.0_91
            Reporter: Nick Stokoe


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
(v6.3.4#6332)

Reply via email to