Building for Android

Panicz Maciej Godek godek.maciek@gmail.com
Mon Oct 24 12:01:06 GMT 2022


pon., 24 paź 2022 o 12:48 Per Bothner <per@bothner.com> napisał(a):

>
>
> On 10/24/22 00:22, Panicz Maciej Godek wrote:
> > I've noticed that, in my code, I've been using the names "hash-code" and
> "java.lang.System:identity-hash-code".
>
> I think it is best to use Java names (such as identityHashCode) for things
> that come from Java.
> (I haven't always been consistent about that.)
>

It seems reasonable in principle.
When I was writing that code, I read about name mangling in Kawa's
documentation,
and I didn't know whether I'm supposed to use Java names, mangled names
or whether both forms were acceptable. So I made a guess, it worked and I
left it the way it was.

And, it would be reasonable to expect hash-code to be mangled as hash$Mncode
in the Android build. And it would be reasonable to expect that replacing
hash-code
with hashCode would fix the issue - but it doesn not.

It seems that:
- Kawa's stack trace points to the proper hashCode function's position
- but instead of simply calling the overridden hashCode method (which is
implemented as (java.lang.System:identityHashCode (this))), it calls some
methods from gnu.lists.AbstractSequence. I suppose there might be some
inlining occurring along the way. My current bets are that either Kawa
doesn't actually override the hashCode function and uses the one from
AbstractSequence, or it treats some of my code as an application of the
"cons" cell, and inserts a call to AbstractSequence's "get" method.


More information about the Kawa mailing list