In the case of static finals, i believe the constant value is just folded into the class that uses it, and there is no reference of the class where the constant is defined.

----- Original Message ----- From: "Dean Hiller" <[EMAIL PROTECTED]>
To: "BCEL Users List" <[email protected]>
Sent: Thursday, January 13, 2005 2:33 PM
Subject: Re: getting type information from this code



Sweet!!! That is exactly what I want. I will try to figure out the methods
I use in bcel to get that info.


2 more questions then....
1. Is there a way to find out if the -g option was used when looking at the
byte code? I see there are different debug info also(lines, source, and
vars)...I really would just like to see if all are on or not, or at least
the vars so I can give an error saying class was not compiled with -g
option.
2. If I have code like this


public class Client {
public void method() {
   String s = SomeClass.CONSTANT;  //CONSTANT is static final
}
}

Is there a way from the "Client" class file to tell that it depends on
"SomeClass" class? Is there anything in the bytecode that would tell me
that? I remember reading constants were compiled in though so I am thinking
this one is not possible, or am I wrong?
thanks,
dean



----- Original Message ----- From: "Dave Brosius" <[EMAIL PROTECTED]>
To: "BCEL Users List" <[email protected]>
Sent: Wednesday, January 12, 2005 10:55 PM
Subject: Re: getting type information from this code



No, all you know is what local variable slot the variable is found in.
Then
you can look in the LocalVariableTable to find the information out
(assuming
it is in the class file) [compiled with -g]

the byte code would be something like

aconst_null
astore_1

----- Original Message ----- From: "Dean Hiller" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, January 13, 2005 12:36 AM
Subject: getting type information from this code



Am I correct in saying the byte code will not contain information on the type for line 2 in the following code


line 1: public void someMethod() { line 2: DummyClass c = null; line 3: }

Is it correct to say that the byte code will not contain info that the
variable c is of type DummyClass?  If I am incorrect, how do I get the
type
information?
thanks,
dean



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



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





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



Reply via email to