I've found a bug or at least a "notable difference"  with previous behaviour
regarding this.
I send it as a mail, if you find it interesting I can open a ticket for
this. It took me some to understand what was going on.

And yes: I'd like too to have the possibility to stick to ognl 2.6.7 with
latest trunk if possible ;-)

This is the situation:


public interface I1 {

   public String getXyz();

   public void setXyz(String x);

   public void doSomething();

}

abstract class A implements interface I1 {

   public void doSomething() {

        // blah blah blah

   }

}


public class B extends A {

    private String xyz;

    public String getXyz() {
        return xyz;
    }

   public void setXyz(String x);
       this.xyz = x;
   }

}


Now I have a page:

public abstract MyPage extends BasePage {

   public A getObjectA()

   @Component(bindings="value=objecta.xyz")
   public abstract TextField getObjectATextField();

}


The page has a getter for object of type A but obviously I'm feeding it with
non abstract classes extending A that actually implement the
interface XYZ getters and setters.
now this WAS NOT failing with previous OGNL, it's failing with OGNL
2.7complaining for inconsistent method signatures.

After some experimenting I've discovered that in order for this to work I
need to implement, at least as an abstract method, in the A class the XYZ
getters ans setters that is turning A into:


abstract class A implements interface I1 {

   public void doSomething() {

        // blah blah blah

   }


   public abstract String getXyz();

   public abstract void setXyz(String x);



}


After this modification it works like charms. So I think is missing proper
interface checking for accessing property: that is to say you might have to
do with an abstract class not directly implementing an interface method and
the expression evaluator should check for it. I think this should be
checked.

Reply via email to