I have a java library that I want to access from swift code. It has a number of public accessor methods such as getcolor() that I assumed I would be able to call by doing obj.color, but I just get “no such member”. obj.getcolor() compiles fine in Silver but then fails when used natively on XCode (where the same library is supplied as native iOS library).
The odd thing is we’re using at least one other java library where this does work, but I don’t have the source to that, so I can’t see what the difference is.
I presume you want to access it as a property, not a method?
basically the elements compiler expects it to be getColor (capital first letter after get/set).
But all the other libraries (.jar) I’ve tried it works fine. Maybe because it’s compiled ax an Android library?
maybe they all do getColor instead of getcolor? I’d have to see it, but there’s no difference between an android library and java library from the compiler side for all practical purposes.
At least one I tested definitely shows as getcolor all lower case in the decompiled class.
Was that one elements or Java written?
Elements written works with both capital and non capital letters. Java written only with capital char
I believe it was compiled with Elements yeah - but what in the .class file makes it different?
I tried changing the java file to use getColor() and it still doesn’t work - now I have to use .Color (uppercase), which isn’t going to work either.
Is it what’s in the .di files?
Tried adding a .di file to my .jar file that matched what was in the .jar file where it does work but no luck…really can’t see any other differences between it and mine.