map.xml syntax

Steve Hannah <[email protected]> Tue, 1 Mar 2016 16:05:04 -0800
Newsgroups gmane.comp.java.ikvm.devel
Message-ID <CABiRg+SOBCwkN0A78WJ=Jm6qVR3iUc-chvUQ=p1Syoct2kJJUw@mail.gmail.com>
I'm trying to make some changes to the JDK java.lang.Throwable class.  I
have followed the trail to the map.xml file that seems to provide drop-in
replacements for some classes but using XML syntax.  What I'm trying to do
is remove the static initializer (cinit), and perform this initialization
lazily.

Essentially, I'm just adding a static boolean INITIALIZED field, then
created a static method named __clinit() which I call at the beginning of
each method.

Unfortunately, I seem to have done something wrong here as, when I build, I
now get this error:

[exec] fatal error IKVMC5042: Type 'java.lang.Throwable' referenced in
remap file was not found


My Throwable class (defined in XML) is shown here:

https://gist.github.com/shannah/84b307b2952a3dab42b3

The parts I added are:

<field name="INITIALIZED" sig="Z" modifiers="static" />

and

<method name="__clinit" sig="()V" modifiers="private static">
            <attribute type="IKVM.Attributes.HideFromJavaAttribute"
sig="()V" />
            <attribute
type="System.ComponentModel.EditorBrowsableAttribute"
sig="(Lcli.System.ComponentModel.EditorBrowsableState;)V">
              <parameter>Never</parameter>
            </attribute>
            <body>
              <ldsfld class="java.lang.Throwable" name="INITIALIZED"
sig="Z" />
              <brfalse name="notinitialized"/>
              <ret/>
              <label name="notinitialized"/>

              <ldc_i4_1 />
              <stsfld class="java.lang.Throwable" name="INITIALIZED"
sig="Z" />

              <call type="IKVM.Internal.ExceptionHelper"
name="getPersistentFields" sig="()[Ljava.io.ObjectStreamField;" />
              <stsfld class="java.lang.Throwable"
name="serialPersistentFields" sig="[Ljava.io.ObjectStreamField;" />
              <ldc_i4_0 />
              <newarr sig="Ljava.lang.StackTraceElement;" />
              <stsfld class="java.lang.Throwable" name="UNASSIGNED_STACK"
sig="[Ljava.lang.StackTraceElement;" />
              <ldc_i4_0 />
              <newobj class="java.util.ArrayList" name="&lt;init&gt;"
sig="(I)V" />
              <call class="java.util.Collections" name="unmodifiableList"
sig="(Ljava.util.List;)Ljava.util.List;" />
              <stsfld class="java.lang.Throwable"
name="SUPPRESSED_SENTINEL" sig="Ljava.util.List;" />
              <ret />
            </body>
          </method>


And I removed the <clinit> tag.

I also added calls to this __clinit() method at the beginning of each
method <body> in the class def.

Are there any obvious errors here?

Is there any way to get it to show a more descriptive error for map.xml
defined classes?  Or is there a way to just generate the XML from Java
somehow?

Any pointers appreciated.

Best regards

Steve


And


-- 
Steve Hannah
Web Lite Solutions Corp.

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140

_______________________________________________
Ikvm-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ikvm-developers