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.



Berin Loritsch wrote:


Juozas Baliuka wrote:

Fields are not "virtual" in java, you must specify "AbstractXMLSource" as
declaring class not test_xml


I found that, and fixed it.

One thing that would be really cool though is for BCEL to automatically
recognize the type of field access, and make adjustments.

When we write a class, as Java developers we are used to doing this:

class BaseDemo
{
    private static final m_name = "Base";
}

class DemoClass extends BaseDemo
{
    public static void main(String[] main)
    {
        System.out.println(m_name);
    }
}

The compiler knows that when I reference "m_name", that the location
is in BaseDemo, and not DemoClass.  It also knows that the reference
is static, and not virtual/normal.

Couldn't InstructionList/InstructionFactory be able to examine the
JavaClass for ClassGen to determine which classname the referenced
field belongs to, AND what the proper access type is.

That way, instead of having GETFIELD and GETSTATIC, you could just
have GETFIELD and it can determine the true bytecode that needs to
be written?

I am sure this is a common error that affects alot of new BCEL users.



---------------------------------------------------------------------
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