JDK 18 has reached its release candidate phase and will GA on 22 March. We should add CI for it to verify compatibility.
Comment From: wilkinsona
Mockito's Answers.CALLS_REAL_METHODS
doesn't work with JDK 18 when the real method is a default method on an interface that's being mocked. It fails like this:
org.mockito.exceptions.base.MockitoException:
Cannot call abstract real method on java object!
Calling real methods is only possible when mocking non abstract method.
//correct example:
when(mockOfConcreteClass.nonAbstractMethod()).thenCallRealMethod();
at org.springframework.boot.context.properties.source.AliasedConfigurationPropertySourceTests.containsDescendantOfWhenSourceReturnsUnknownShouldReturnUnknown(AliasedConfigurationPropertySourceTests.java:62)
…
The problem only occurs in the 2.5.x branch where we're using Mockito 3.9.0. It doesn't occur in 2.6.x where we've upgraded to Mockito 4.0.0.