Commit 3fcc714
committed
[Java.Interop] Verify JniPeerMembers managedPeerType parameter.
Commit b754516 fixed an issue wherein the JniPeerMembers
managedPeerType parameter didn't match the type declaring the
JniPeerMembers parameter (which would result in "broken"
JniPeerMembers.InstanceMethods.Call*Method() behavior as the
virtual-vs.-nonvirtual type check would fail), and asks:
> (I wonder if there's a way to check/assert for this...)
Yes, there is a way: use JavaVM.GetJniTypeInfoForType() and see if
JniTypeInfo.JniTypeName matches the jniPeerType value.
Add a Debug.Assert() to ensure that this is true.
Note: Why Debug.Assert() and not ArgumentException? Because I only
want to have this extra checking occur in Debug builds, not Release
builds. This may be a mistake...especially since Debug.Assert() only
logs to TestOutput-<AssembyName>.txt, and doesn't throw an exception
or abort the process, and now that I look for the assert messages I
see a great many of them in the log file...1 parent b754516 commit 3fcc714
1 file changed
+8
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
17 | 25 | | |
18 | 26 | | |
19 | 27 | | |
| |||
0 commit comments