JakeWharton / hugo

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

java.lang.Integer cannot be cast to org.aspectj.lang.JoinPoint #109

Open eboudrant opened 8 years ago

eboudrant commented 8 years ago

I have this crash when adding DebugLog to this method.

  @DebugLog
  public void notifyMessageRangeInserted(int start, int count) {
    ...
  }

Here the full stack, notice hugo is used 3 times in the same stack :

java.lang.ClassCastException: java.lang.Integer cannot be cast to org.aspectj.lang.JoinPoint
    at x.x.MyAdapter$AjcClosure9.run(MyAdapter.java:1)
    at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
    at hugo.weaving.internal.Hugo.logAndExecute(Hugo.java:39)
    at x.x.MyAdapter.notifyMessageRangeInserted(MyAdapter.java:238)
    at z.z.MyCallback.updateTable_aroundBody24(MyCallback.java:223)
    at z.z.MyCallback$AjcClosure25.run(MyCallback.java:1)
    at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
    at hugo.weaving.internal.Hugo.logAndExecute(Hugo.java:39)
    at z.z.MyCallback.updateTable(MyCallback.java:199)
    at z.z.MyCallback.updateTable(MyCallback.java:194)
    at z.z.MyCallback.onNewMessage_aroundBody2(MyCallback.java:47)
    at z.z.MyCallback$AjcClosure3.run(MyCallback.java:1)
    at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
    at hugo.weaving.internal.Hugo.logAndExecute(Hugo.java:39)
    at z.z.MyCallback.onNewMessage(MyCallback.java:46)
    at z.z.JNI.SwigDirector_Callback_onNewMessage(JNI.java:933)
    at z.z.threaddispatcherandroidJNI.AndroidThreadDispatcher_onDispatched(Native Method)
    at z.z.AndroidThreadDispatcher.onDispatched(AndroidThreadDispatcher.java:48)
    at z.z.UiThreadDispatcher$1.handleMessage(UiThreadDispatcher.java:63)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5417)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

If I remove the annotation everything is fine.

Using 'com.jakewharton.hugo:hugo-plugin:1.2.1'

eboudrant commented 8 years ago

Looks like a build issue. I removed the annotation and I got :

Caused by: java.lang.NoSuchMethodError: No static method notifyMessageSetChanged_aroundBody10(Lx/x/MyAdapter;Lorg/aspectj/lang/JoinPoint;)V in class Lx/x/MyAdapter; or its super classes (declaration of 'x.x. MyAdapter' appears in /data/app/x/base.apk)
vigilancer commented 8 years ago

same here, in my case it was "java.lang.ClassCastException: Intent". clean rebuild will help.