cuplv / droidel

Framework model for static analysis of Android
Apache License 2.0
46 stars 14 forks source link

Reference to method is ambiguous #3

Closed highwater closed 10 years ago

highwater commented 10 years ago

I don't know if this were expected or not. I ran droidel with APK com.path from Google Play and android-17 from Sable and this was the result.

/home/vip/droidel_test/com.path/bin/droidel_classes/generatedharness/GeneratedAndroidHarness.java:3213: 
error: reference to wheatbiscuit is ambiguous, both method wheatbiscuit(com.path.util.InternalUri) in com.path.activities.BaseFragment and 
method wheatbiscuit(com.path.activities.feed.contract.FeedContract$DataFetchingState) in com.path.activities.feed.PersistentFeedFragment match
      loc_43.wheatbiscuit(null);

However with APK com.kai.kaiticketing and android-17, droidel ran successfully.

Generating harness
Compiling harness took 4.412
Generating and compiling harness took 11.858
[success] Total time: 286 s, completed Sep 24, 2014 4:40:23 AM
sblackshear commented 10 years ago

I've certainly seen this ambiguous method issue before--the problem is when Droidel's type inhabitation fails, it inhabits the type with null, which can lead to ambiguous method calls like the one in the error message you saw. I've just pushed a fix that does a bit better by returning the result of casting null to the desired type, thus avoiding the ambiguity.

Hope this fixes the issue with your example, though the "real" fix would be improving Droidel's type inhabitation with a backtracking search that gets triggered upon failure (rather than just giving up and returning null).

highwater commented 10 years ago

Thanks, I'll just close this for now.