Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

我觉得这就是dex2jar的一个bug #2

Open
nangonghuang opened this issue Jun 19, 2018 · 0 comments
Open

我觉得这就是dex2jar的一个bug #2

nangonghuang opened this issue Jun 19, 2018 · 0 comments

Comments

@nangonghuang
Copy link

nangonghuang commented Jun 19, 2018

最近也遇到这个问题,在dex2jar转换用了RecyclerView的包 的时候,里面有个LinearLayoutManager的方法,

   @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeInt(mAnchorPosition);
            dest.writeInt(mAnchorOffset);
            dest.writeInt(mAnchorLayoutFromEnd ? 1 : 0);
        }

转换之后就是

 public void writeToParcel(Parcel paramParcel, int paramInt)
    {
      throw new RuntimeException("d2j fail translate: java.lang.RuntimeException: can not merge I and Z\r\n\tat
	  ...
    }

而报错的信息是

.method public writeToParcel(Landroid/os/Parcel;I)V
    .registers 4
    iget v0, p0, Landroid/support/v7/widget/LinearLayoutManager$SavedState;->mAnchorPosition:I
    invoke-virtual { p1, v0 }, Landroid/os/Parcel;->writeInt(I)V
    iget v0, p0, Landroid/support/v7/widget/LinearLayoutManager$SavedState;->mAnchorOffset:I
    invoke-virtual { p1, v0 }, Landroid/os/Parcel;->writeInt(I)V
    iget-boolean v0, p0, Landroid/support/v7/widget/LinearLayoutManager$SavedState;->mAnchorLayoutFromEnd:Z
    invoke-virtual { p1, v0 }, Landroid/os/Parcel;->writeInt(I)V
    return-void
.end method

这里就是把谷歌的源码里面的布尔变量mAnchorLayoutFromEnd 直接返回了,而去掉了 ? 1 : 0这个过程,把Z类型直接传给I类型的参数去调用,报错。看起来就是dex2jar的bug,反编译smali到jar的时候没有判断这里的bool其实也可以作为1和0去传值的

@nangonghuang nangonghuang changed the title 我觉得这就是dex2jiar的一个bug 我觉得这就是dex2jar的一个bug Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant