I have a new test failure on JDK19, see the error below

Maybe it is only a matter of updating Mockito or to change some
command line arguments.


Any volunteers on fixing this problem ?

Enrico



org.mockito.exceptions.base.MockitoException:

Mockito cannot mock this class: class java.net.InetAddress.

Mockito can only mock non-private & non-final classes.
If you're not sure why you're getting this error, please report to the
mailing list.


Java               : 19
JVM vendor name    : Oracle Corporation
JVM vendor version : 19-ea+22-1598
JVM name           : OpenJDK 64-Bit Server VM
JVM version        : 19-ea+22-1598
JVM info           : mixed mode, sharing
OS name            : Linux
OS version         : 4.15.0-169-generic


Underlying exception : java.lang.IllegalStateException: Error invoking
java.lang.invoke.MethodHandles$Lookup#defineClass
at 
org.apache.zookeeper.test.StaticHostProviderTest.testReResolvingSingle(StaticHostProviderTest.java:707)
Caused by: java.lang.IllegalStateException: Error invoking
java.lang.invoke.MethodHandles$Lookup#defineClass
at 
net.bytebuddy.dynamic.loading.ClassInjector$UsingLookup$Dispatcher$ForJava9CapableVm.defineClass(ClassInjector.java:1777)
at 
net.bytebuddy.dynamic.loading.ClassInjector$UsingLookup.injectRaw(ClassInjector.java:1543)
at 
net.bytebuddy.dynamic.loading.ClassInjector$AbstractBase.inject(ClassInjector.java:110)
at 
net.bytebuddy.dynamic.loading.ClassLoadingStrategy$UsingLookup.load(ClassLoadingStrategy.java:492)
at 
net.bytebuddy.dynamic.TypeResolutionStrategy$Passive.initialize(TypeResolutionStrategy.java:100)
at 
net.bytebuddy.dynamic.DynamicType$Default$Unloaded.load(DynamicType.java:6292)
at 
org.mockito.internal.creation.bytebuddy.SubclassBytecodeGenerator.mockClass(SubclassBytecodeGenerator.java:200)
at 
org.mockito.internal.creation.bytebuddy.TypeCachingBytecodeGenerator$1.call(TypeCachingBytecodeGenerator.java:46)
at 
org.mockito.internal.creation.bytebuddy.TypeCachingBytecodeGenerator$1.call(TypeCachingBytecodeGenerator.java:43)
at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:153)
at net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:366)
at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:175)
at net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:377)
at 
org.mockito.internal.creation.bytebuddy.TypeCachingBytecodeGenerator.mockClass(TypeCachingBytecodeGenerator.java:36)
at 
org.mockito.internal.creation.bytebuddy.SubclassByteBuddyMockMaker.createMockType(SubclassByteBuddyMockMaker.java:77)
at 
org.mockito.internal.creation.bytebuddy.SubclassByteBuddyMockMaker.createMock(SubclassByteBuddyMockMaker.java:43)
at 
org.mockito.internal.creation.bytebuddy.ByteBuddyMockMaker.createMock(ByteBuddyMockMaker.java:29)
at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:53)
at org.mockito.internal.MockitoCore.mock(MockitoCore.java:61)
at org.mockito.Mockito.mock(Mockito.java:1949)
at org.mockito.Mockito.mock(Mockito.java:1860)
... 1 more
Caused by: java.lang.IncompatibleClassChangeError: class
org.mockito.codegen.InetAddress$MockitoMock$1392414753 cannot inherit
from sealed class java.net.InetAddress
at java.base/java.lang.ClassLoader.defineClass0(Native Method)
at java.base/java.lang.System$2.defineClass(System.java:2369)
at 
java.base/java.lang.invoke.MethodHandles$Lookup$ClassDefiner.defineClass(MethodHandles.java:2444)
at 
java.base/java.lang.invoke.MethodHandles$Lookup$ClassDefiner.defineClass(MethodHandles.java:2421)
at 
java.base/java.lang.invoke.MethodHandles$Lookup.defineClass(MethodHandles.java:1846)
at 
net.bytebuddy.dynamic.loading.ClassInjector$UsingLookup$Dispatcher$ForJava9CapableVm.defineClass(ClassInjector.java:1773)
... 21 more

Il giorno lun 13 giu 2022 alle ore 15:42 David Delabassee
<david.delabas...@oracle.com> ha scritto:
>
> Greetings!
>
> JDK 19 has now entered Rampdown Phase One (RDP1) [1], which means that
> the main-line has been forked into a dedicated JDK 19 stabilization
> repository. At this point, the overall JDK 19 feature set is frozen and
> no additional JEPs will be targeted to JDK 19. The stabilization
> repository is open for select bug fixes and, with approval, late
> low-risk enhancements per the JDK Release Process [2]. Any change pushed
> to the main line is now bound for JDK 20, unless it is explicitly
> back-ported to JDK 19.
>
> The next few weeks should be leveraged to try to identify and resolve as
> many issues as possible, i.e. before JDK 19 enters the Release
> Candidates phase. Moreover, we encourage you to test your project with
> the `enable-preview` flag as described in this Quality Outreach Heads-up
> [3], and even if you don't intend to use Virtual Threads in the near future.
>
> [1] https://mail.openjdk.java.net/pipermail/jdk-dev/2022-June/006735.html
> [2] https://openjdk.java.net/jeps/3
> [3] https://inside.java/2022/05/16/quality-heads-up/
>
>
> ## Heads-up - openjdk.java.net ➜ openjdk.org DNS transition
>
> The OpenJDK infrastructure is moving from the old openjdk.java.net
> subdomain to the openjdk.org top-level domain. This will affect all
> active subdomains (i.e., bugs, cr, db, git, hg, mail, and wiki) and the
> old hostnames (*.openjdk.java.net) will now act as aliases for the new
> names. No actions are required as this transition should be transparent
> and is mostly done. It should be mentioned that https://jdk.java.net/ is
> not changing.
>
> More infirmation can be found in the original proposal
> https://mail.openjdk.java.net/pipermail/discuss/2022-May/006089.html
>
>
> ## JDK 19 Early-Access builds
>
> JDK 19 Early-Access builds 26 are now available [4], and are provided
> under the GNU General Public License v2, with the Classpath Exception.
> The Release Notes are available here [5]. Given that JDK 19 is now in
> RDP1, the initial JDK 20 Early-Access builds are now also available [6].
>
> [4] https://jdk.java.net/19/
> [5] https://jdk.java.net/19/release-notes
> [6] https://jdk.java.net/20/
>
>
> ### JEPs integrated to JDK 19:
> - JEP 405: Record Patterns (Preview)
> - JEP 422: Linux/RISC-V Port
> - JEP 424: Foreign Function & Memory API (Preview)
> - JEP 425: Virtual Threads (Preview)
> - JEP 426: Vector API (Fourth Incubator)
> - JEP 427: Pattern Matching for switch (Third Preview)
> - JEP 428: Structured Concurrency (Incubator)
>
> ### Recent changes that may be of interest:
>
> Build 26:
> - JDK-8284199: Implementation of Structured Concurrency (Incubator)
> - JDK-8282662: Use List.of() factory method to reduce memory consumption
> - JDK-8284780: Need methods to create pre-sized HashSet and LinkedHashSet
> - JDK-8250950: Allow per-user and system wide configuration of a
> jpackaged app
> - JDK-8236569: -Xss not multiple of 4K does not work for the main thread
> on macOS
> - JDK-4511638: Double.toString(double) sometimes produces incorrect results
> - JDK-8287714: Improve handling of JAVA_ARGS
> - JDK-8286850: [macos] Add support for signing user provided app image
> - JDK-8287425: Remove unnecessary register push for MacroAssembler::check_k…
> - JDK-8283694: Improve bit manipulation and boolean to integer conversion o…
> - JDK-8287522: StringConcatFactory: Add in prependers and mixers in batches
>
> Build 25:
> - JDK-8284960: Integration of JEP 426: Vector API (Fourth Incubator)
> - JDK-8287244: Add bound check in indexed memory access var handle
> - JDK-8287292: Improve TransformKey to pack more kinds of transforms effici…
> - JDK-8287003: InputStreamReader::read() can return zero despite writing a …
> - JDK-8287064: Modernize ProxyGenerator.PrimitiveTypeInfo
>
> Build 24:
> - JDK-8286908: ECDSA signature should not return parameters
> - JDK-8261768: SelfDestructTimer should accept seconds
> - JDK-8286304: Removal of diagnostic flag GCParallelVerificationEnabled
> - JDK-8267038: Update IANA Language Subtag Registry to Version 2022-03-02
> - JDK-8285517: System.getenv() returns unexpected value if environment vari…
> - JDK-8285513: JFR: Add more static support for event classes
> - JDK-8287024: G1: Improve the API boundary between HeapRegionRemSet and G1…
> - JDK-8287139: aarch64 intrinsic for unsignedMultiplyHigh
>
> Build 23:
> - JDK-8282191: Implementation of Foreign Function & Memory API (Preview)
> - JDK-8286090: Add RC2/RC4 to jdk.security.legacyAlgorithms
> - JDK-8282080: Lambda deserialization fails for Object method references
> on interfaces
> - JDK-6782021: It is not possible to read local computer certificates
> with the SunMSCAPI provider
> - JDK-8282191: Implementation of Foreign Function & Memory API (Preview)
> - JDK-8284194: Allow empty subject fields in keytool
> - JDK-8209137: Add ability to bind to specific local address to HTTP client
> - JDK-8286841: Add BigDecimal.TWO
> - JDK-8287139: aarch64 intrinsic for unsignedMultiplyHigh
> - JDK-8282160: JShell circularly-required classes cannot be defined
> - JDK-8282280: Update Xerces to Version 2.12.2
>
>
> ## Topics of Interest
>
> * Replacing Finalizers with Cleaners
> https://inside.java/2022/05/25/clean-cleaner/
>
> * Testing Clean Cleaner Cleanup
> https://inside.java/2022/05/27/testing-clean-cleaner-cleanup/
>
> * Improved JFR Ergonomics
> https://egahlin.github.io/2022/05/31/improved-ergonomics.html
>
> * Java 19 Virtual Threads - JEP Café
> https://inside.java/2022/06/08/jepcafe11/
>
> * Deconstructing Records in Pattern Matching - Inside Java Newscast
> https://inside.java/2022/06/02/insidejava-newscast-026/
>
> * Concurrent Thread-stack Processing in the Z Garbage Collector
> https://inside.java/2022/05/31/zgc-concurrent-thread-stack-processing/
>
>
> As usual, let us know if you find any issues while testing your
> project(s) on the latest JDK early-access builds. Thanks for your support!
>
> --David
>
>
>

Reply via email to