The source code line number are stored in the InstructionList class in 
 int[] byte_positions. you can try:
Method[] methods=clazz.getMethods();
....
MethodGen mg = new MethodGen(methods[m ], class_name, cp);
InstructionList the = mg.getInstructionList(); 
int[ ] position=il.getInstructionPositions(); 
 
where m is the index of method.

"Nikhil C. Khedkar" <[EMAIL PROTECTED]> wrote:
Hi,
I am working on getting the source code line numbers
from class files using BCEL. 

ConstantPool constants =
java_class.getConstantPool();
ConstantPoolGen cp = new ConstantPoolGen(constants);

MethodGen methodGen = new MethodGen(method,
java_class.getClassName(), cp);
Instruction [] instructions =
methodGen.getInstructionList().getInstructions();
LineNumberGen[] aLineNumberGen =
methodGen.getLineNumbers();

I intend to use getSourceLine() API of LineNumberGen
class. But the array aLineNumberGen is returned of 0
length. Is there any setting of the compiler that will
save the line numbers in the class files, because of
which it is not working right now.

Thanks,
Nikhil

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------
Yahoo! Mail: 6MB di spazio gratuito, 30MB per i tuoi allegati, l'antivirus, il filtro 
Anti-spam

Reply via email to