0

Juno is highlighting my property references as invalid since I added a parameterised class.

public abstract class AbstractBaseAction<viewDataClass extends AbstractViewData>

    protected viewDataClass viewData;

    public viewDataClass getViewData(){
       return viewData;
    }
    ....
}

public class SomeAction extends AbstractBaseAction<SomeViewData>
{
    public AbstractMaturingOptionsAction()
    {
        super(new SomeViewData());
    }

    @PostConstruct
    public void setupViewData(){
        ....
    }
    ....
}

public class SomeViewData extends AbstractViewData

    String someProperty;

    public String getSomeProperty(){
        return someProperty;
    }
    ....
}

....

property="#{SomeAction.viewData.someProperty}"

Juno is highlighting someProperty

"someProperty cannot be resolved as a member of viewData"

Is this worth investigating, or should I just code it another way?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Neil Stevens
  • 825
  • 1
  • 9
  • 11
  • The problem is that JSF (and other classes will) treat the `viewData` attribute as a `AbstractViewData` instance instead of the specific child class. That explains why your IDE marks the `someProperty` attribute, because this attribute belongs to the child, not to the parent. – Luiggi Mendoza Feb 11 '13 at 17:26

1 Answers1

1

Eclipse builtin EL validation/autocomplete is indeed shortcoming.

Consider installing JBoss Tools. It properly recognizes properties in superclasses. Here's a screenshot as evidence that it does the job for me.

enter image description here

By the way, your viewDataClass naming convention is terrible. You should use a single letter capital like V or so.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Thanks for your help, I will have a look at the JBoss Tools. I don't understand this single letter approach, but that is another story ;-) – Neil Stevens Feb 19 '13 at 12:58