[
https://issues.apache.org/jira/browse/GROOVY-11758?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18021528#comment-18021528
]
ASF GitHub Bot commented on GROOVY-11758:
-----------------------------------------
eric-milles opened a new pull request, #2301:
URL: https://github.com/apache/groovy/pull/2301
Given:
```java
interface A {
Object getFoo();
}
class B {
protected final Object getFoo() { return null; }
}
class C extends B implements A {
}
```
The eclipse java compiler says: The inherited method `B.getFoo()` cannot
hide the public abstract method in `A`
> IllegalAssessError: trait property and protected/package-private super access
> method
> ------------------------------------------------------------------------------------
>
> Key: GROOVY-11758
> URL: https://issues.apache.org/jira/browse/GROOVY-11758
> Project: Groovy
> Issue Type: Bug
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Major
>
> Consider the following:
> {code:groovy}
> trait A {
> final long id = 123L
> }
> class B {
> protected final long getId() { 456L }
> }
> class C extends B implements A {
> }
> def c = new C()
> assert c.id == '456L'
> assert c.getId() == '456L'
> {code}
> The property expression "c.id" throws an IllegalAccessError at run time.
> https://github.com/apache/groovy/blob/39ced53e046cf2f5cad4ac8babc3ee4995642b07/src/test/groovy/org/codehaus/groovy/transform/traitx/TraitASTTransformationTest.groovy#L443
--
This message was sent by Atlassian Jira
(v8.20.10#820010)