question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Java 16 incompatibility due to usage of internal APIs

See original GitHub issue

The 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:

  1. Install any version of OpenJDK 16 (I’m using Liberica by Bell Soft)
  2. 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:closed
  • Created 2 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
aahlenstcommented, May 6, 2021

Works great, thanks!

0reactions
yury-scommented, May 6, 2021

@aahlenst The fix is now available in 1.11.0-SNAPSHOT, can you give it a try?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found