assertj: Incompatibility with JDK 18-ea
Summary
AssertJ fails on JDK 18-ea when using SoftAssertion.assertThat(...)
with a class compile for JDK 18.
Failures (1):
JUnit Jupiter:EngineTestKitAllEventsDemo:verifyAllJupiterEvents()
MethodSource [className = 'example.testkit.EngineTestKitAllEventsDemo', methodName = 'verifyAllJupiterEvents', methodParameterTypes = '']
=> java.lang.IllegalArgumentException: Could not create type
org.assertj.core@3.20.2/org.assertj.core.internal.bytebuddy.TypeCache.findOrInsert(TypeCache.java:155)
org.assertj.core@3.20.2/org.assertj.core.internal.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:366)
org.assertj.core@3.20.2/org.assertj.core.api.SoftProxies.createSoftAssertionProxyClass(SoftProxies.java:128)
org.assertj.core@3.20.2/org.assertj.core.api.SoftProxies.createSoftAssertionProxy(SoftProxies.java:114)
org.assertj.core@3.20.2/org.assertj.core.api.AbstractSoftAssertions.proxy(AbstractSoftAssertions.java:48)
[...]
Caused by: java.lang.IllegalStateException: No code generation strategy available
org.assertj.core@3.20.2/org.assertj.core.api.ClassLoadingStrategyFactory.classLoadingStrategy(ClassLoadingStrategyFactory.java:67)
org.assertj.core@3.20.2/org.assertj.core.api.SoftProxies.generateProxyClass(SoftProxies.java:172)
org.assertj.core@3.20.2/org.assertj.core.api.SoftProxies.lambda$createSoftAssertionProxyClass$0(SoftProxies.java:129)
org.assertj.core@3.20.2/org.assertj.core.internal.bytebuddy.TypeCache.findOrInsert(TypeCache.java:153)
[...]
I tried setting the net.bytebuddy.experimental
system property to true
but that didn’t help either.
Upgrading the shaded Byte Buddy should help: https://github.com/raphw/byte-buddy/blob/master/release-notes.md
Example
Please let me know if this is really needed in this case.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 21 (15 by maintainers)
Byte Buddy expects the net.bytebuddy.utility package to be exported what is not the case for your shaded module. I now added a mechanism to let Byte Buddy discover this deviation and adjust the module graph dynamically to fit the assumed constraint. Could you build Byte Buddy from master and try against that latest version?