[575] junit-native does not support org.junit.rules.ExpectedException.#576
[575] junit-native does not support org.junit.rules.ExpectedException.#576tzezula wants to merge 3 commits intograalvm:masterfrom
Conversation
common/junit-platform-native/src/main/java/org/graalvm/junit/platform/JUnitPlatformFeature.java
Outdated
Show resolved
Hide resolved
| } | ||
| }; | ||
| if (typeSafeMatcher != null) { | ||
| access.registerSubtypeReachabilityHandler(registerMatcherForReflection, typeSafeMatcher); |
There was a problem hiding this comment.
How do we guarantee this does not affect user code by registering their classes?
There was a problem hiding this comment.
@vjovanov: Good question. I believe it's acceptable to register even the user classes. This is because subclasses of org.hamcrest.TypeSafeMatcher and org.hamcrest.TypeSafeDiagnosingMatcher that utilize the default constructor rely on Class.getDeclaredMethods() to function properly. You can refer to TypeSafeMatcher#TypeSafeMatcher(), which indirectly invokes ReflectiveTypeFinder#findExpectedType(). Ideally, we would only mark the matchesSafely method for getDeclaredMethods, but unfortunately, this is not possible.
f5f1c11 to
01c5970
Compare
|
@fniephaus I've added the test |
|
The content of this PR will be included together with main JUnit refactoring PR (here) to avoid additional (rebase and refactoring) work on this PR. Once we merge that PR, we can close this one |
|
Implemented here: #693 |
Fixies issue #575 by registering all used subclasses of
TypeSafeMatcherandTypeSafeDiagnosingMatcherfor reflective access to all declared methods.