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" check is probably not necessary #453

Closed
shifujun opened this issue Apr 18, 2023 · 0 comments
Closed

"NEW followed by no DUP was found" check is probably not necessary #453

shifujun opened this issue Apr 18, 2023 · 0 comments

Comments

@shifujun
Copy link
Contributor

if (iterator.byteAt(pos + 3) != DUP)
throw new CannotCompileException(
"NEW followed by no DUP was found");

When I use replaceNew with this lib: implementation 'com.google.android.gms:play-services-ads:22.0.0'.
It contains a class(com.google.android.gms.internal.ads.zzceh) maybe ProGuard processed, like this:

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

Then I learned why DUP followed NEW in https://stackoverflow.com/a/8594701/11616914 .

Now I think maybe javac always generate "new+dup", but the "dup" maybe not always useful.
So I guess tool like ProGuard maybe remove useless dup instructions.

shifujun added a commit to shifujun/javassist that referenced this issue Dec 8, 2023
DUP usually come after NEW, but not necessary.

jboss-javassist#453
@shifujun shifujun closed this as completed Dec 9, 2023
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