You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Mark Struberg (Jira)" <ji...@apache.org> on 2021/03/14 11:15:00 UTC

[jira] [Commented] (OWB-1375) improve support for Java 9++ hacks

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

Mark Struberg commented on OWB-1375:
------------------------------------

There is so many subtle changes in different Java versions that I really found no good solution to work around it yet.
In e.g. Java14 a few subtle changes got made to MethodHandles privateAccess handling again.

So probably the most practical way is really to tell people to add an {{--add-exports java.base/jdk.internal.misc=ALL-UNNAMED}} as Romain already mentioned.

I'd go on and add this as an automatically activated profile. Wdyt?
{noformat}
      <profiles>
+        <profile>
+            <id>java16-hacks</id>
+            <activation>
+                <jdk>16</jdk>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <configuration>
+                            <argLine>--add-exports java.base/jdk.internal.misc=ALL-UNNAMED</argLine>
+                        </configuration>
+
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
{noformat}

> improve support for Java 9++ hacks
> ----------------------------------
>
>                 Key: OWB-1375
>                 URL: https://issues.apache.org/jira/browse/OWB-1375
>             Project: OpenWebBeans
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 2.0.21
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Major
>             Fix For: 2.0.22
>
>
> With Java > 11 sun.misc.Unsafe defineClass finally got removed and setAccessible(true) for java.* classes is not allowed anymore.
> There is a solution via ClassLoaderProxyService as DefiningClassService (see OWB-1325) but this has the downside that package scoped methods are not accessible. A call to a package scope method of a NormalScope proxy thus cannot see the method in the proxy class and thus coerces to the empty original parent class. As this instance is not initialised all values are empty, resulting in NPE and zero values etc.



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