Daniel Huss created GROOVY-8053:
-----------------------------------

             Summary: Groovyc: anonymous class in static method cannot access 
its fields without "this"
                 Key: GROOVY-8053
                 URL: https://issues.apache.org/jira/browse/GROOVY-8053
             Project: Groovy
          Issue Type: Bug
    Affects Versions: 2.4.8
         Environment: JAVA_VERSION="1.8.0_111"
OS_NAME="Windows"
OS_VERSION="5.2"
OS_ARCH="amd64"
            Reporter: Daniel Huss


{code}
import groovy.transform.CompileStatic

@CompileStatic // also happens without it
final class TestCase {

    static thisShouldCompile() {

        Object o = new Object() {

            int inaccessible

            @Override
            int hashCode() {
                inaccessible++ // succeeds when qualified with "this"
                return super.hashCode()
            }
        }
    }

    static void main( String... args ) {
        thisShouldCompile()
        System.out.println( "Success" )
    }
}
{code}

Could be related to GROOVY-7020



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

Reply via email to