Closed xurubin closed 11 years ago
Yeah, I saw those (there are others that fail with StaticGet for the same reason). They fail because the field does not exist. Haven't checked which field/class it is accessing, but they cannot be located in the hierarchy. It worked before because the class+type+name of the field were simply parsed and stored in the instruction and they were looked up in the hierarchy only if they needed to be analyzed... I think the new way is safer, because we are sure that we're not analyzing something we don't have enough information about...
Yes some tests failed because the field does not exist. But 008-instanceof.apk is different. It fails only during unit tests, and not when you run MainTest directly on it. That's why I think the hierarchy building with app may be the problem, because during unit tests the same hierarchy is reused for multiple apps.
Could it be that you use a different framework for running your tests and executing with MainTest? No matter what I do, there simply isn't an ImplA class with a field mWahoo :-D
It turns out that mWahoo is an instance field in interface IFace1. I'm surprised that this is legal, but here is the source code of that unit test: https://android.googlesource.com/platform/dalvik/+/master/tests/008-instanceof/src/Iface1.java
I ran this unit test on device and the field access succeeds.
Oh god, multiple inheritance and conflict resolution! I thought Java didn't allow that by design. Anyway, fixed now. And tests seem to suddenly be pleasantly green, except four that seem to be meant to fail.
008-instanceof.apk failed on: java.lang.NullPointerException at uk.ac.cam.db538.dexter.dex.code.insn.DexInstruction_InstanceGet.(DexInstruction_InstanceGet.java:38)
at uk.ac.cam.db538.dexter.dex.code.insn.DexInstruction_InstanceGet.parse(DexInstruction_InstanceGet.java:71)
When running the collection of unit tests. However it parses fine in a single standalone run, which makes me wonder if the app hierarchy building is acting weird.