Java 16 incompatibility due to usage of internal APIs
See original GitHub issueThe README promises that “Playwright requires Java 8 or newer”. This does not include Java 16, however. With JEP 396, further APIs were encapsulated that are being used by Playwright. As a result, running the test suite with Java 16 fails. Examples:
[ERROR] com.microsoft.playwright.TestScreencast.shouldExposeVideoPath(Path) Time elapsed: 0.096 s <<< ERROR!
java.lang.reflect.InaccessibleObjectException: Unable to make field private final sun.nio.fs.UnixFileSystem sun.nio.fs.UnixPath.fs accessible: module java.base does not "opens sun.nio.fs" to unnamed module @152f2773
at com.microsoft.playwright.TestScreencast.shouldExposeVideoPath(TestScreencast.java:30)
...
[ERROR] com.microsoft.playwright.TestBrowserContextAddCookies.shouldRoundtripCookie Time elapsed: 0.103 s <<< ERROR!
java.lang.reflect.InaccessibleObjectException: Unable to make private java.util.Collections$EmptyList() accessible: module java.base does not "opens java.util" to unnamed module @152f2773
at com.microsoft.playwright.TestBrowserContextAddCookies.shouldRoundtripCookie(TestBrowserContextAddCookies.java:53)
Steps to reproduce:
- Install any version of OpenJDK 16 (I’m using Liberica by Bell Soft)
- Run
mvn test
I know about workarounds like --add-opens
. But it would be great if Playwright worked without them. Because the OpenJDK team plans to enable further restrictions in the future, it might make sense to test against the newest JDK as part of each CI run.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Removed APIs - Java - Oracle Help Center
Run jdeprscan --release 16 -l --for-removal to get the list of APIs that are marked for removal in ... The Java team is...
Read more >maven - Lombok's access to jdk.compiler's internal packages ...
Lombok is accessing an internal JDK API with reflection, ... For me the issue was java version used by maven. while installing maven, ......
Read more >Transition from Java 8 to Java 11 - Azure - Microsoft Learn
Potential issues include removed API, deprecated packages, use of internal API, changes to class loaders, and changes to garbage collection. In ...
Read more >JDK 16: The new features in Java 16 | InfoWorld
Highlights of the latest upgrade of standard Java include primitive classes, sealed classes, records, a vector API, and ports for Windows on ...
Read more >The arrival of java 16!
misc.Unsafe . Code successfully compiled with earlier releases that accesses internal APIs of the JDK may no longer work by default. This change ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Works great, thanks!
@aahlenst The fix is now available in 1.11.0-SNAPSHOT, can you give it a try?