Using Mirah 0.2.1 in Android - protection attributes on methods.

10 views
Skip to first unread message

jscott...@gmail.com

unread,
Feb 15, 2018, 10:27:26 AM2/15/18
to The Mirah Programming Language
Hi guys,

Since the Mirah 0.2.1 release, I dusted off my build environment and started using it for Android development again.  I've been working this angle for about 6 months now and have a number of experiences to report.  Over all, I do think the 0.2.x release is a SIGNIFICANT improvement and I absolutely love it.  However, there are some interesting issues that I think we need to look at.

1)  It's great that we have the public, private, protected attributes.  Those were sorely lacking in the past.  Unfortunately, it breaks the Android VM in strange ways.

Case number one is when I inherit from an Android API class which has such attributes, e.g.  something in the "Activity" family that you would normally base your "MainActivity" on.  If I specify the attributes in my own code, even when I'm darn sure they are correct according to the online docs, then the VM tells me it cannot find the base class that I derived mine from.  If I comment out the attributes, leaving things the way we did it in 0.1.2, then all is well.  The Android VM can load my class, and the references to it's ancestor(s), then begins normal execution.

Case number two is when I have my own independent class in the APK bundle and call it from one of the standard entries.  In that case the VM halts execution and reports that the class binary is corrupted!  If I again comment out the attributes, then all is fine.

This almost gives the appearance that there is some sort of byte code level incompatibility between how Mirah writes the attributes and how the Android VMs want to see them.

Now what makes this even more confounding is that I would swear that I had an even more indirect case where an entry point loaded a class which loaded a class which may have loaded a class that still had Mirah function attributes and it worked.

What do you guys make of this???  FYI, I ran this code on Samsung 5.0.2, and Samsung 5.1 device, both ARM32.  I have access to a Samsung 7.0 device, but haven't tried it yet.


Thanks,
-Scott-
Reply all
Reply to author
Forward
0 new messages