vendredi 15 avril 2016

Incorrect output with getGenericReturnType on Java 8

I get a strange result for a specific reflection call using Java 8 (JDK 1.8.0_71) and Mockito (version 2.0.44-beta).

Calling the following:

BDDMockito.class.getMethod("given", Object.class).getGenericReturnType().getTypeName()

gives this erroneous result:

org.mockito.BDDMockito.org.mockito.BDDMockito$BDDMyOngoingStubbing<T>

This does not look right (the package does not exist), and I have not seen this problem with other Java classes or with other methods of BDDMockito. I think the result should be:

org.mockito.BDDMockito$BDDMyOngoingStubbing<T>

Is there an explanation for the result I got? Is this a known issue or should I report it to Oracle?





Aucun commentaire:

Enregistrer un commentaire