Imports are basically a form of stating dependencies.

If you are after the dependencies - sure, they can be extracted from the class. So does e.g. minijar

 http://vafer.org/blog/tag/minijar

It uses ASM - not BCEL ...but that's just an implementation detail.

Maybe tell us a bit more what you are trying to do

cheers
--
Torsten

Not directly. You can look at all the instructions and look for INVOKEVIRTUAL, INVOKESTATIC, INVOKESPECIAL, INVOKEINTERFACE, and find all of the classes specified. And from that assume the list of imports, You would have to do the same for imports for member variables, as well. The problem idea falls apart for imports for of classes to access static final variables. In this case the variable is directly accessed from the importing class, without reference to the class where the variable is defined.

So, the answer is no you can't, and what you can get isn't pleasant.

I'm not sure
----- Original Message ----- From: "Pico Florin" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, March 03, 2006 4:14 AM
Subject: Get imported packages using BCEL


Hi!
It is possible to use BCEL API to obtain the imported packages (classes) from a java binary code?
  Thank you in advance,
         Florin


---------------------------------
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre.


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


Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to