You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-dev@jakarta.apache.org by Wayne Chien <wa...@gmail.com> on 2004/12/23 14:09:36 UTC
try to get a code statement with BCEL library
Hi,
I am using BCEL to parse a java class file to get the information
I need and I run into the following issue:
Question: How can I get a line of code that I am interested from a
class file? This is what my current implementation:
"Utility.codeToString(mthd.getCode().getCode(), mthd.getConstantPool(), 0, -1)"
But this code will generate a bunch of instructions like this:
1: getfield myPackageName.myClass.m_myObj LmySuperClass; (177)
4: ldc " aValue" (185)
6: invokevirtual mySuperClass.getFieldValue
(Ljava/lang/String;)Ljava/lang/String; (186)
9: invokevirtual java.lang.String.toString ()Ljava/lang/String; (15)
Instead, I wish I can locate a code string like this:
"String prevValue = m_myObj.getFieldValue("aValue").toString();"
Do you have any better way to achieve this?
Thank you in advanceā¦
---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org