using getClassName in bcel 5.2

Satria Mandala <[email protected]> Fri, 22 May 2009 16:01:22 +0800
Newsgroups gmane.comp.jakarta.bcel.user
Message-ID <[email protected]>
--0016364571aa9d5be0046a7baa9b
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hi Ramesh,

Let me introduced myself, my name satria.
I am new in BCEL 5.2, and need using method getClassName in class
FieldOrMethod of bcel 5.2.
Let say I have a snippet codes as follows:

public void doInstruction(ClassGen cg, MethodGen mg, InstructionHandle ih,
Instruction inst) throws ClassNotFoundException
  {
    if(inst instanceof FieldInstruction)
    {
      FieldInstruction fieldinst = (FieldInstruction)inst;
      ConstantPoolGen cpg = cg.getConstantPool();
      if(rewriter.isEntity(fieldinst.getClassName(cpg)) &&
          !rewriter.isIgnored(fieldinst.getClassName(cpg))
        )
    ....
   }
}

The FieldInstruction extends the FieldOrMethod class. Unfortunately, the
method String getClassName(ConstantPoolGen cpg ) deprecated.

Referring to note in this code, In Java 1.5 may get wrong. Thus a suggestion
is to use the getReferenceType().

I need getting array of String classname from the
fieldinst.getClassName(cpg).
If I used "fieldinst.getLoadClassType(cpg).getClassName()", the method
getLoadClassType(cpg), would return getClassType(cpg), which deprecated
also.

Any suggestion? In addition I can not use the getReferenceType() using the
fieldinst variable.

Regards,
Satria Mandala
Network Security Laboratory
FSKSM - 81310 UTM Skudai
Johor Malaysia

--0016364571aa9d5be0046a7baa9b--