Re: Get imported packages using BCEL

Torsten Curdt <[email protected]> Sat, 4 Mar 2006 02:35:53 +1100
Newsgroups gmane.comp.jakarta.bcel.user
Message-ID <[email protected]>
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]
>
smime.p7s (application/pkcs7-signature, 2.4 KB) - not displayed