Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Tim Cooke
Campbell Ritchie
Ron McLeod
Junilu Lacar
Liutauras Vilda
Sheriffs:
Paul Clapham
Jeanne Boyarsky
Henry Wong
Saloon Keepers:
Tim Moores
Tim Holloway
Stephan van Hulst
Piet Souris
Carey Brown
Bartenders:
Jesse Duncan
Frits Walraven
Mikalai Zaikin
Forum:
Java in General
modify method in byte code using ASM.
jing hu
Ranch Hand
Posts: 63
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
For the class
Test
public class Test{ public void f(){ int i = 10; } public void g(){ int i = 10; } }
Now I have the Test.class and have no source code.
I want to modify method f() like below.
add " int j = 10;" before " inti = 10;"
public void f(){ int j = 10; int i = 10; }
using ASM how to implement this.
Thank you very much.
Ashok Suthar
Ranch Hand
Posts: 30
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
Extend the test Class and override its methods which you want to modify... If that fulfils your purpose.
I am not sure what you are trying to do here.
SCJP 5 (98%)...SCWCD On
jing hu
Ranch Hand
Posts: 63
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I don't want to recompile this .class. recompiling the class may be hard work.
int my
thread
, the Test is just only a sample.
So I want to do some modification in the .class file. That is my main purpose.
Campbell Ritchie
Marshal
Posts: 75844
361
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
ASM? That's hardly a beginner's topic. I shall try moving this to "advanced."
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Overloading methods
Static Variables Compilation
Method Overloading
instance variable
Local Array
More...