You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Wayne Chien <wa...@gmail.com> on 2004/12/23 13:25:28 UTC

[users@httpd] 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ā€¦

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org