jakarta-bcel-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: How do you convert a JavaClass to a regular Class object?
Date Mon, 24 Mar 2003 18:37:48 GMT
Stephen Kolaroff wrote:
> Well, I must disagree: I think BCEL should not try to foresee "where a 
> developer wants to go today". So the InstructionFactory class (and 
> corresponding Instruction subclasses) will be kept small, fast and 
> clean; for example:
> class BaseClass {
> protected something;
> }
> 
> class DerivedClass extends BaseClass{
> protected something;
> }
> 
> the above declarations are perfectly correct; and the fields with same 
> name are simply different fields (pls., avoid constructions like 
> this:)). Then:
> 1. what should be the default field access?
> 2. How can we trace potentially huge number of classes fast and tricky?
> 3. And so on.

Same rules as a standard compiler.

getField("something");
if ( null ) getSuper().getField("something");

The biggest frustration is the difference between static and virtual
fields.

class Demo
{
     protected something;
     protected static otherThing;
}

Currently both of these require a separate way of accessing them.
The first is not static, so we can access it with:

Constants.GETFIELD

The second is static, so we have to access it with:

Constants.GETSTATIC

It is really simple to check the associated Field for whether it
is static or not:

javaClass.getField("something").isStatic() ? GETSTATIC : GETFIELD



---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org


Mime
View raw message