0

Is there some way to replace a call like

Socket s = new Socket(Proxy.NO_PROXY);

with

Socket s = new Socket();

using BCEL because i can't figure out how. I understand it would involve changing the InstructionList but i don't know how to scan for it and i don't know which opcodes to look for.

ILOVEPIE
  • 177
  • 1
  • 10

1 Answers1

0

You may get away with much shorter learning curve if you use AspectJ or similar high level tools.

For a low-level bytecode modification you can't get away without learning Java opcodes. A good starting point is JVM Specification. Also, BCEL is not well documented and if you're flexible with choice of low level, I'd suggest using ASM framework. Here is corresponding tutorial on implementing simple bytecode transformation with ASM. It is based on an older ASM version, but the ideas are still the same.

Eugene Kuleshov
  • 31,461
  • 5
  • 66
  • 67
  • I am flexible the problem is I started with BCEL for this project... and i don't really want to go rewrite my code. – ILOVEPIE Jun 01 '12 at 20:16