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

Eric Milles updated GROOVY-4497:
--------------------------------
    Language: groovy

> IllegalAccessError when accessing base class property with 
> "super.propertyName"
> -------------------------------------------------------------------------------
>
>                 Key: GROOVY-4497
>                 URL: https://issues.apache.org/jira/browse/GROOVY-4497
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 1.7.5
>            Reporter: Peter Niederwieser
>            Assignee: Roshan Dawrani
>            Priority: Major
>             Fix For: 1.7.6, 1.8-beta-3
>
>
> The following code...
> {code}
> class Base {
>   def x = 1   
> }
> class Derived extends Base {
>   def x = 2 
>   
>   def foo() { println super.x }
> }
> new Derived().foo()
> {code}
> ...produces the exception shown below. Problem goes away if base class 
> declares a field rather than a property, or when derived class uses 
> "super.getX()".
> {noformat}
> java.lang.IllegalAccessError: tried to access field Base.x from class Derived
>       at Derived.foo(ConsoleScript6:8)
>       at Derived$foo.call(Unknown Source)
>       at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
>       at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
>       at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
>       at ConsoleScript6.run(ConsoleScript6:11)
>       at 
> groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:264)
>       at groovy.lang.GroovyShell.run(GroovyShell.java:513)
>       at groovy.lang.GroovyShell.run(GroovyShell.java:170)
>       at groovy.lang.GroovyShell$run$0.call(Unknown Source)
>       at groovy.ui.Console$_runScriptImpl_closure16.doCall(Console.groovy:890)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:597)
>       at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88)
>       at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
>       at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:273)
>       at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
>       at 
> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
>       at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149)
>       at groovy.ui.Console$_runScriptImpl_closure16.doCall(Console.groovy)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:597)
>       at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88)
>       at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
>       at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:273)
>       at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
>       at groovy.lang.Closure.call(Closure.java:276)
>       at groovy.lang.Closure.call(Closure.java:271)
>       at groovy.lang.Closure.run(Closure.java:354)
>       at java.lang.Thread.run(Thread.java:680)
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to