soot-oss / soot

Soot - A Java optimization framework
GNU Lesser General Public License v2.1
2.85k stars 706 forks source link

Fields missing in loaded classes from android.jar #2020

Open cgobel opened 9 months ago

cgobel commented 9 months ago

Hello,

I am writing a tool to analyse Java and Android applications. I followed the tutorial and downloaded the android jars. But I noticed that some fields are missing for some classes (e.g. String has only CASE_INSENSITIVE_ORDER but no other fields). I found that this problem occurs for a few version. However, it is working for version 11 where I can see 8 fields in String class. Can anyone help me with this? Am I doing something wrong? I am using the nightly build version 4.5.0

jpstotz commented 9 months ago

As far as I remember the provided android.jar files are from taken Android SDK, this means they only provide the public API. The methods are usually dummy stubs only throwing an Exception.

Looking at the Android API JavaDoc of the [String class]/(https://developer.android.com/reference/java/lang/String#fields_1) there is exactly one field defined: CASE_INSENSITIVE_ORDER.

If one andorid.jar (Android 11 API30 or do you mean the android.jar of API 11?) is different I don't know why, may be a mistake.

cgobel commented 9 months ago

Well, but when I unpack the Jar (especially android-10) and look into the class file using "javap -p", I do see all fields. But somehow soot does not load them.

jpstotz commented 9 months ago

Can you please post the link to the tutorial and/or the link to the android.jar files you are using?