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

Is it possible to lazily instantiate AllArguments? #1643

Open
dogourd opened this issue May 14, 2024 · 0 comments
Open

Is it possible to lazily instantiate AllArguments? #1643

dogourd opened this issue May 14, 2024 · 0 comments

Comments

@dogourd
Copy link

dogourd commented May 14, 2024

I have a more general Advice that looks like this:

public class Advice {
    @OnMethodEnter
    public static void before(@AllArguments Object[] args) {
         if (xxxx) {
             return;
         }
         if (xxxx) {
             return;
         }
         // use the args.
         Arrays.toString(args);
    }
}

There are many logical branches inside Advice that do not pay attention to parameters information, but the generated bytecode will always copy the original parameter list into an array and assign it to the args parameter.

Can I use bytebuddy to implement lazy instantiation of AllArguments? Make sure I only actually create the target array when I'm actually going to use it.

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