You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Basil Peace (Jira)" <ji...@apache.org> on 2021/02/26 09:05:00 UTC

[jira] [Commented] (GROOVY-9955) IllegalAccessError exception is raised when accessing inherited static field

    [ https://issues.apache.org/jira/browse/GROOVY-9955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17291495#comment-17291495 ] 

Basil Peace commented on GROOVY-9955:
-------------------------------------

The same problem with static methods

> IllegalAccessError exception is raised when accessing inherited static field
> ----------------------------------------------------------------------------
>
>                 Key: GROOVY-9955
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9955
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 2.5.14, 3.0.7
>            Reporter: Basil Peace
>            Priority: Major
>
> The same problem as in related issue but with static fields.
> a/b/PackageScopedParent.java:
> {code:java}
> package a.b;
> class PackageScopedParent {
>   public static final String TEST = "test";
> }
> {code}
> a/b/PublicChildren.java:
> {code:java}
> package a.b;
> public class PublicChildren extends PackageScopedParent {
> }
> {code}
> c/Usage.groovy:
> {code:java}
> package c
> import a.b.PublicChildren
> import groovy.transform.CompileStatic
> @CompileStatic
> class Usage {
>   static void main(String[] args) {
>     println PublicChildren.TEST
>   }
> }
> {code}
> error:
> {noformat}
> java.lang.IllegalAccessError: failed to access class a.b.PackageScopedParent from class c.Usage (a.b.PackageScopedParent and c.Usage are in unnamed module of loader 'app')
>   at c.Usage.main(Usage.groovy:9){noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)