JakeWharton / hugo

Annotation-triggered method call logging for your debug builds.
Apache License 2.0
7.92k stars 797 forks source link

java.lang.ClassCastException: FragmentManagerImpl can not be converted to int #90

Open eduardb opened 9 years ago

eduardb commented 9 years ago

If I annotate my method with DebugLog, I get the following crash: java.lang.ClassCastException: android.support.v4.app.FragmentManagerImpl can not be converted to int at org.aspectj.runtime.internal.Conversions.intValue(Conversions.java:57) at com.company.app.ui.activities.MainActivity$AjcClosure1.run(MainActivity.java:1) at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149) at hugo.weaving.internal.Hugo.logAndExecute(Hugo.java:39) at com.company.app.ui.activities.MainActivity.hasChildrenInBackStack(MainActivity.java:205) at com.company.app.ui.activities.MainActivity.onBackPressed(MainActivity.java:191) at android.app.Activity.onKeyUp(Activity.java:2145) at android.view.KeyEvent.dispatch(KeyEvent.java:2633) at android.app.Activity.dispatchKeyEvent(Activity.java:2375) at android.support.v7.internal.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:49) at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent(AppCompatDelegateImplBase.java:258) at android.support.v7.internal.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:49) at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1847) at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:3701) at android.view.ViewRootImpl.handleImeFinishedEvent(ViewRootImpl.java:3651) at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:2818) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5041) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) at dalvik.system.NativeStart.main(Native Method)

The signature of the method is the following: private boolean hasChildrenInBackStack(FragmentManager fm) It also contains a recursive call, if that is relevant. I tried reproducing in a new project, but it didn't occur anymore. But I would like to resolve this issue in my project, so I will provide any additional info needed.