java.lang.IllegalAccessError for non-static final fields in components/pages

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

java.lang.IllegalAccessError for non-static final fields in components/pages

Ben Weidig
Hi,

we're in the process of upgrading multiple projects to 5.5 with Java 11 and
ran into some issues with Plastic proxies.

java.lang.IllegalAccessError: Update to non-static final field
my.package.name.Component.fieldName attempted from a different method
(initializeInstance) than the initializer method <init>


The problem appears to be the lazy initialization of fields. Other
projects, like Spock, ran into the same issue:


http://groovy.329449.n5.nabble.com/2-5-3-breaks-Spock-delayed-spock-initializeFields-for-final-fields-td5754016.html


If I understand it correctly the root issue is
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8157181,
which got fixed, making final initialization outside of <init> no
longer possible.


It's not a deal-breaker for us, only a few components were affected.
Just wanted to let you know about it, or at least ask if anyone else
ran into the same issue, and how they dealt with it.


Haven't found an issue in the tracker, should I create one?


Best regards,

Ben
Reply | Threaded
Open this post in threaded view
|

Re: java.lang.IllegalAccessError for non-static final fields in components/pages

Thiago H de Paula Figueiredo
Hello!

Interesting problem. Thanks for raising it. I'm no aware of any tickets
about it, so please go ahead and create one.

On Mon, Jun 8, 2020 at 8:25 AM Ben Weidig <[hidden email]> wrote:

> Hi,
>
> we're in the process of upgrading multiple projects to 5.5 with Java 11 and
> ran into some issues with Plastic proxies.
>
> java.lang.IllegalAccessError: Update to non-static final field
> my.package.name.Component.fieldName attempted from a different method
> (initializeInstance) than the initializer method <init>
>
>
> The problem appears to be the lazy initialization of fields. Other
> projects, like Spock, ran into the same issue:
>
>
>
> http://groovy.329449.n5.nabble.com/2-5-3-breaks-Spock-delayed-spock-initializeFields-for-final-fields-td5754016.html
>
>
> If I understand it correctly the root issue is
> https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8157181,
> which got fixed, making final initialization outside of <init> no
> longer possible.
>
>
> It's not a deal-breaker for us, only a few components were affected.
> Just wanted to let you know about it, or at least ask if anyone else
> ran into the same issue, and how they dealt with it.
>
>
> Haven't found an issue in the tracker, should I create one?
>
>
> Best regards,
>
> Ben
>


--
Thiago