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

NEW followed by no DUP was found #1155

Closed
malinkang opened this issue Mar 23, 2023 · 2 comments · Fixed by #1182
Closed

NEW followed by no DUP was found #1155

malinkang opened this issue Mar 23, 2023 · 2 comments · Fixed by #1182
Labels
bug Something isn't working

Comments

@malinkang
Copy link

集成Admob sdk报错
image

@shifujun shifujun added the bug Something isn't working label Apr 18, 2023
@shifujun
Copy link
Collaborator

插件添加implementation 'com.google.android.gms:play-services-ads:22.0.0'可以复现问题。

com.google.android.gms.internal.ads.zzceh反编译片段:

public final boolean onCreateWindow(android.webkit.WebView, boolean, boolean, android.os.Message);
    descriptor: (Landroid/webkit/WebView;ZZLandroid/os/Message;)Z
    flags: (0x0011) ACC_PUBLIC, ACC_FINAL
    Code:
      stack=2, locals=5, args_size=5
         0: aload         4
         2: getfield      #236                // Field android/os/Message.obj:Ljava/lang/Object;
         5: checkcast     #30                 // class android/webkit/WebView$WebViewTransport
         8: astore_2
         9: new           #32                 // class android/webkit/WebView
        12: astore_3
        13: aload_3
        14: aload_1
        15: invokevirtual #237                // Method android/webkit/WebView.getContext:()Landroid/content/Context;
        18: invokespecial #240                // Method android/webkit/WebView."<init>":(Landroid/content/Context;)V
        21: aload_0

其中9: new下一行不是dup,不符合 https://github.com/jboss-javassist/javassist/blob/700be6f6f9546e8af049b1a763ce27f1fde5955d/src/main/javassist/convert/TransformNewClass.java#L59 的预期。

错误在哪边还不确定。

@shifujun
Copy link
Collaborator

根据:https://stackoverflow.com/a/8594701/11616914

可知dup是为了接下来调用init方法和areturn时返回值。

但我们这里遇到的代码并不需要把webview返回。通过测试发现,我们的javac确实会不管后面用不用这个new出来的对象,都跟上一个dup指令。但看起来理论上来说确实不是必要的。

也许这个有问题的类就是proguard等工具把这个无用的dup给优化掉了。那么问题就是javassist实现错误了。

shifujun added a commit to shifujun/Shadow that referenced this issue Apr 18, 2023
javac总是生成new+dup,但这并不是字节码规范。proguard等工具可能会优化掉dup。

fix Tencent#1155
shifujun added a commit that referenced this issue Apr 18, 2023
javac总是生成new+dup,但这并不是字节码规范。proguard等工具可能会优化掉dup。

fix #1155
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants