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

Eric Milles updated GROOVY-11830:
---------------------------------
    Description: 
Consider the following:
{code:groovy}
trait A {
  abstract  def m()
}
class B {
  protected def m() { 'b' }
}
class C extends B implements A {
}
print new C().m() // IllegalAccessError
{code}

The trait {{A}} could also be an interface.  It specs out a public method.  
When a super class provides a protected or package-private method (when in same 
package as extending class), there is no compiler error/warning or public 
bridge method created to prevent an {{IllegalAccessError}} at runtime.

If the super class method is private, there is no compiler error and the result 
is an {{AbstractMethodError}} at runtime.

  was:
Consider the following:
{code:groovy}
trait A {
  abstract  def m()
}
class B {
  protected def m() { 'b' }
}
class C extends B implements A {
}
print new C().m() // IllegalAccessError
{code}

The trait {{A}} could also be an interface.  It specs out a public method.  
When a super class provides a protected or package-private method (when in same 
package as extending class), there is no compiler error/warning or public 
bridge method created to prevent an {{IllegalAccessError}} at runtime.


> IllegalAccessError: interface method and protected super class method
> ---------------------------------------------------------------------
>
>                 Key: GROOVY-11830
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11830
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 3.0.25, 4.0.29, 5.0.3
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>
> Consider the following:
> {code:groovy}
> trait A {
>   abstract  def m()
> }
> class B {
>   protected def m() { 'b' }
> }
> class C extends B implements A {
> }
> print new C().m() // IllegalAccessError
> {code}
> The trait {{A}} could also be an interface.  It specs out a public method.  
> When a super class provides a protected or package-private method (when in 
> same package as extending class), there is no compiler error/warning or 
> public bridge method created to prevent an {{IllegalAccessError}} at runtime.
> If the super class method is private, there is no compiler error and the 
> result is an {{AbstractMethodError}} at runtime.



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

Reply via email to