Discussion:
[Ikvm-developers] map.xml body vs alternateBody vs nonVirtualAlternateBody
Steve Hannah
2016-09-08 16:31:36 UTC
Permalink
I have a question about the map.xml syntax. What is the difference between
<body>, <alternateBody>. and <nonVirtualAlternateBody>. Some methods (e.g.
toString()) include all three. Under what circumstance is each used?

Best regards

Steve
Jeroen Frijters
2016-09-09 08:55:49 UTC
Permalink
Hi Steve,

The normal one is <body>. The other two are only used for remapped types (Object, String and Throwable).

They have to the do the weird shape of the type system. E.g. on the Java side it looks like cli.System.Object extends java.lang.Object. This means that you can call java.lang.Object.toString() on a .NET type (that obviously doesn't have this method), so when that happens the <alternateBody> gets invoked.

Similarly, when you extend cli.System.Object in Java and do a super.toString() call, the <nonVirtualAlternateBody> gets invoked.

Regards,
Jeroen
-----Original Message-----
Sent: Thursday, September 8, 2016 18:32
Subject: [Ikvm-developers] map.xml body vs alternateBody vs
nonVirtualAlternateBody
I have a question about the map.xml syntax. What is the difference
between <body>, <alternateBody>. and <nonVirtualAlternateBody>. Some
methods (e.g. toString()) include all three. Under what circumstance is
each used?
Best regards
Steve
------------------------------------------------------------------------------
Steve Hannah
2016-09-10 20:14:05 UTC
Permalink
Thanks for the details. Very helpful to know.

Steve
Post by Jeroen Frijters
Hi Steve,
The normal one is <body>. The other two are only used for remapped types
(Object, String and Throwable).
They have to the do the weird shape of the type system. E.g. on the Java
side it looks like cli.System.Object extends java.lang.Object. This means
that you can call java.lang.Object.toString() on a .NET type (that
obviously doesn't have this method), so when that happens the
<alternateBody> gets invoked.
Similarly, when you extend cli.System.Object in Java and do a
super.toString() call, the <nonVirtualAlternateBody> gets invoked.
Regards,
Jeroen
-----Original Message-----
Sent: Thursday, September 8, 2016 18:32
Subject: [Ikvm-developers] map.xml body vs alternateBody vs
nonVirtualAlternateBody
I have a question about the map.xml syntax. What is the difference
between <body>, <alternateBody>. and <nonVirtualAlternateBody>. Some
methods (e.g. toString()) include all three. Under what circumstance is
each used?
Best regards
Steve
--
Steve Hannah
Web Lite Solutions Corp.
Loading...