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

Add "insertAfterLocalVariable" method on CtBehavior #430

Open
Adahel opened this issue Aug 31, 2022 · 2 comments · May be fixed by #452
Open

Add "insertAfterLocalVariable" method on CtBehavior #430

Adahel opened this issue Aug 31, 2022 · 2 comments · May be fixed by #452

Comments

@Adahel
Copy link

Adahel commented Aug 31, 2022

Why has javassist never had a method as useful as this?

The purpose of this method is to make changes to code where the line number or variable name is unknown or does not exist. I use it for some obfuscated code, but it doesn't work for all obfuscated code. For unobfuscated code it obviously works.
The implementation is included with a test.
This is the only method that got the expected result as JVM is not my area of expertise.
I hope I've helped. Thank you very much and have a nice day!

@Adahel
Copy link
Author

Adahel commented Sep 26, 2022

Good Day,
I consider in the last edition the method as complete. I was thinking of making a pull-request, but first I would like to know if the project is still alive? I didn't get any comments, is it because of your country's culture or did I write something disrespectful? I will consider silence as a zombie or dead project. Thank you, Átila César.

@Adahel Adahel changed the title Insert After Local Variable? Add "insertAfterLocalVariable" method on CtBehavior Sep 26, 2022
@chibash
Copy link
Member

chibash commented Sep 26, 2022

Well the project is not dead but its development is now very slow.
But if you contribute any good code, I'm happy to merge it.
Please add a good javadoc comment describing this method and also test code.
The range of a local variable is often tricky. When you write test code, please check various corner cases.
For example,

void foo(int x) {
    int y;
    do {
       int z;
       bar(x, y, z);
    } while (expr);
       :
}

Also check the case when a try-catch statement is the first statement in a method body and a local variable is declared before the statement or in its try block.

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

Successfully merging a pull request may close this issue.

2 participants