Please provide the following information:
Due to type inference methodToInvoke.getReturnType() will return Object.class when using lambdas, resulting in an InvocationException where the delegate returns an Object that is an instance of the targetReturnType. ie:
java.lang.IllegalArgumentException: Value of type java.util.HashMap incompatible with return type java.util.Map of MyClassr#doSomething()
Please provide the following information:
Version of JMockit that was used: 1.45
Description of the problem:
Due to type inference
methodToInvoke.getReturnType()will returnObject.classwhen using lambdas, resulting in anInvocationExceptionwhere the delegate returns an Object that is an instance of the targetReturnType. ie:The problem can be reproduced by JMockit project members.
For that, include an example test (perhaps accompanied by a Maven/Gradle build script) which
can be executed without changes and reproduces the failure.
The issue does not fall outside the scope of the project (for example, attempting to use JMockit
APIs from Groovy or Scala code, or with an Android runtime).
The JDK where the problem occurs is a final release, not a development build.